Skip to content

Commit e23f4d0

Browse files
committed
solution to osx issue
1 parent 15a062d commit e23f4d0

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

setup.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
import numpy
99
import re
1010
import os
11+
import sys
12+
import subprocess
1113

1214
here = path.abspath(path.dirname(__file__))
1315

16+
17+
os.environ["CC"] = "g++"
18+
os.environ["CXX"] = "g++"
19+
1420
# dirty but working
1521
__version__ = re.search(
1622
r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', # It excludes inline comment too
@@ -24,12 +30,13 @@
2430
with open(os.path.join(ROOT, 'README.md'), encoding="utf-8") as f:
2531
README = f.read()
2632

27-
# add platform dependant optional compilation argument
2833
opt_arg=["-O3"]
29-
import platform
30-
if platform.system()=='Darwin':
31-
if platform.release()=='18.0.0':
32-
opt_arg.append("-stdlib=libc++") # correspond to a compilation problem with Mojave and XCode 10
34+
35+
# add platform dependant optional compilation argument
36+
if sys.platform.startswith('darwin'):
37+
opt_arg.append("-stdlib=libc++")
38+
sdk_path = subprocess.check_output(['xcrun', '--show-sdk-path'])
39+
os.environ['CFLAGS'] = '-isysroot "{}"'.format(sdk_path.rstrip().decode("utf-8"))
3340

3441
setup(name='POT',
3542
version=__version__,

0 commit comments

Comments
 (0)