summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorJames R. Barlow <jim@purplerock.ca>2019-07-16 00:42:49 -0700
committerJames R. Barlow <jim@purplerock.ca>2019-07-16 00:42:49 -0700
commit2570df805db4d0e367ef59108f23f36f5aae1591 (patch)
treee133bdfb37cee5eb085076620cc8495e06d80551 /setup.py
parent96148fe59342346aaf977774603a7ee16f49d673 (diff)
setup: supply linker arguments for macOS too
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/setup.py b/setup.py
index 82f15bf..1c19a90 100644
--- a/setup.py
+++ b/setup.py
@@ -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