diff options
author | James R. Barlow <jim@purplerock.ca> | 2019-07-16 00:42:49 -0700 |
---|---|---|
committer | James R. Barlow <jim@purplerock.ca> | 2019-07-16 00:42:49 -0700 |
commit | 2570df805db4d0e367ef59108f23f36f5aae1591 (patch) | |
tree | e133bdfb37cee5eb085076620cc8495e06d80551 /setup.py | |
parent | 96148fe59342346aaf977774603a7ee16f49d673 (diff) |
setup: supply linker arguments for macOS too
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -67,25 +67,27 @@ def has_flag(compiler, flagname): def cpp_flag(compiler): """Return the -std=c++[11/14] compiler flag. - The c++14 is preferred over c++11 (when it is available). + Notes on c++17 and macOS: + https://github.com/pybind/python_example/issues/44 """ - if has_flag(compiler, '-std=c++14'): - return '-std=c++14' - elif has_flag(compiler, '-std=c++11'): - return '-std=c++11' - else: - raise RuntimeError( - 'Unsupported compiler -- at least C++11 support ' 'is needed!' - ) + flags = ['-std=c++14', '-std=c++11'] + + for flag in flags: + if has_flag(compiler, flag): + return flag + raise RuntimeError('Unsupported compiler -- at least C++11 support ' 'is needed!') class BuildExt(build_ext): """A custom build extension for adding compiler-specific options.""" c_opts = {'msvc': ['/EHsc'], 'unix': []} + l_opts = {'msvc': [], 'unix': []} if sys.platform == 'darwin': - c_opts['unix'] += ['-stdlib=libc++', '-mmacosx-version-min=10.7'] + darwin_opts = ['-stdlib=libc++', '-mmacosx-version-min=10.7'] + c_opts['unix'] += darwin_opts + l_opts['unix'] += darwin_opts def build_extensions(self): ct = self.compiler.compiler_type |