Skip to content

Commit

Permalink
setup.py: Set platform specific compiler arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
fdabrandao committed Feb 23, 2024
1 parent ac85ea3 commit f81e68e
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion nl-writer2/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,36 @@
# Sort input source files if you glob sources to ensure bit-for-bit
# reproducible builds (https://github.com/pybind/python_example/pull/53)


def compile_args():
from platform import system

if system() == "Windows":
return ["/std:c++17"]
elif system() == "Linux":
ignore_warnings = [
"-Wno-stringop-truncation",
"-Wno-catch-value",
"-Wno-unused-variable",
]
return ["-std=c++17"] + ignore_warnings
elif system() == "Darwin":
ignore_warnings = [
"-Wno-unused-variable",
]
return [
"-std=c++17",
"-mmacosx-version-min=10.15",
] + ignore_warnings
else:
return []


ext_modules = [
Extension(
"nlwpy",
["nlwpy/src/nlw_bindings.cc"] + glob.glob("./src/" + "*.cc"),
# extra_compile_args=["-std=c++17"], - need all platforms
extra_compile_args=compile_args(),
include_dirs=["include", pybind11.get_include()],
# Example: passing in the version to the compiled code
define_macros=[("VERSION_INFO", __version__)],
Expand Down

0 comments on commit f81e68e

Please sign in to comment.