Skip to content

Commit 01c46f7

Browse files
committed
setup.py: Set platform specific compiler arguments
1 parent ac85ea3 commit 01c46f7

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

nl-writer2/setup.py

+26-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,36 @@
1515
# Sort input source files if you glob sources to ensure bit-for-bit
1616
# reproducible builds (https://github.com/pybind/python_example/pull/53)
1717

18+
19+
def compile_args():
20+
from platform import system
21+
22+
if system() == "Windows":
23+
return ["/std:c++17"]
24+
elif system() == "Linux":
25+
ignore_warnings = [
26+
"-Wno-stringop-truncation",
27+
"-Wno-catch-value",
28+
"-Wno-unused-variable",
29+
]
30+
return ["-std=c++17"] + ignore_warnings
31+
elif system() == "Darwin":
32+
ignore_warnings = [
33+
"-Wno-unused-variable",
34+
]
35+
return [
36+
"-std=c++17",
37+
"-mmacosx-version-min=10.15",
38+
] + ignore_warnings
39+
else:
40+
return []
41+
42+
1843
ext_modules = [
1944
Extension(
2045
"nlwpy",
2146
["nlwpy/src/nlw_bindings.cc"] + glob.glob("./src/" + "*.cc"),
22-
# extra_compile_args=["-std=c++17"], - need all platforms
47+
extra_compile_args=compile_args(),
2348
include_dirs=["include", pybind11.get_include()],
2449
# Example: passing in the version to the compiled code
2550
define_macros=[("VERSION_INFO", __version__)],

0 commit comments

Comments
 (0)