diff options
author | Nicolas Courty <ncourty@irisa.fr> | 2020-02-28 11:44:55 +0100 |
---|---|---|
committer | Nicolas Courty <ncourty@irisa.fr> | 2020-02-28 11:44:55 +0100 |
commit | e23f4d0646a3e8d28cc146c28574359585295249 (patch) | |
tree | 48b4bfd55b6c82d47f3c368cff2526915a9c9bdb | |
parent | 15a062d55ad5a14d351a4f0c57d4d7359011f510 (diff) |
solution to osx issue
-rwxr-xr-x | setup.py | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -8,9 +8,15 @@ from Cython.Build import cythonize import numpy import re import os +import sys +import subprocess here = path.abspath(path.dirname(__file__)) + +os.environ["CC"] = "g++" +os.environ["CXX"] = "g++" + # dirty but working __version__ = re.search( r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', # It excludes inline comment too @@ -24,12 +30,13 @@ ROOT = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(ROOT, 'README.md'), encoding="utf-8") as f: README = f.read() -# add platform dependant optional compilation argument opt_arg=["-O3"] -import platform -if platform.system()=='Darwin': - if platform.release()=='18.0.0': - opt_arg.append("-stdlib=libc++") # correspond to a compilation problem with Mojave and XCode 10 + +# add platform dependant optional compilation argument +if sys.platform.startswith('darwin'): + opt_arg.append("-stdlib=libc++") + sdk_path = subprocess.check_output(['xcrun', '--show-sdk-path']) + os.environ['CFLAGS'] = '-isysroot "{}"'.format(sdk_path.rstrip().decode("utf-8")) setup(name='POT', version=__version__, |