From e23f4d0646a3e8d28cc146c28574359585295249 Mon Sep 17 00:00:00 2001 From: Nicolas Courty Date: Fri, 28 Feb 2020 11:44:55 +0100 Subject: solution to osx issue --- setup.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index bbcaf04..2cc3e50 100755 --- a/setup.py +++ b/setup.py @@ -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__, -- cgit v1.2.3