From cdbd5528625ea3b1fe429134013f7cc6dd18b41f Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 11 May 2016 11:37:56 +0200 Subject: Add option to link with libc++ on older OSX versions. Versions of OSX lower than 10.9 link libstdc++ by default. Also libstdc++ is linked when the osx minimum deployment target is lower than 10.9. The new option allows explicitly linking libc++ in the cases mentioned above. It is not enabled by default, because most libraries and executables on versions lower than 10.9 are compiled with libstdc++, and mixing standard library versions can lead to crashes. Change-Id: I7397d2bbce2cfceaeb848f25e0bbf1a24ac9bde8 Reviewed-by: Christian Tismer --- setup.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index b7cd3fb9c..236d9f1e8 100644 --- a/setup.py +++ b/setup.py @@ -160,6 +160,7 @@ OPTION_JOBS = option_value('jobs') # number of parallel build job OPTION_JOM = has_option('jom') # use jom instead of nmake with msvc OPTION_BUILDTESTS = has_option("build-tests") OPTION_OSXARCH = option_value("osx-arch") +OPTION_OSX_USE_LIBCPP = has_option("osx-use-libc++") OPTION_XVFB = has_option("use-xvfb") if OPTION_QT_VERSION is None: @@ -634,6 +635,15 @@ class pyside_build(_build): # also tell cmake which architecture to use cmake_cmd.append("-DCMAKE_OSX_ARCHITECTURES:STRING={}".format(OPTION_OSXARCH)) + if OPTION_OSX_USE_LIBCPP: + # Explicitly link the libc++ standard library (useful for osx deployment targets + # lower than 10.9). This is not on by default, because most libraries and + # executables on OSX <= 10.8 are linked to libstdc++, and mixing standard libraries + # can lead to crashes. + # On OSX >= 10.9 with a similar minimum deployment target, libc++ is linked in + # implicitly, thus the option is a no-op in those cases. + cmake_cmd.append("-DOSX_USE_LIBCPP=ON") + log.info("Configuring module %s (%s)..." % (extension, module_src_dir)) if run_process(cmake_cmd) != 0: raise DistutilsSetupError("Error configuring " + extension) -- cgit v1.2.3