Skip to content

Commit 0baf83b

Browse files
authored
Merge pull request #130 from rflamary/osx-issue
[MRG] solution to osx issue this PR closes issue #118
2 parents 81e9d42 + 00535f3 commit 0baf83b

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)