generated from dopt-python/py311
add Windows specific compiler and linker options, related to #3
This commit is contained in:
parent
4b42f0f03a
commit
f37e3c8c30
31
setup.py
31
setup.py
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from Cython.Build import cythonize
|
from Cython.Build import cythonize
|
||||||
from Cython.Compiler import Options
|
from Cython.Compiler import Options
|
||||||
@ -9,20 +10,44 @@ Options.embed_pos_in_docstring = False
|
|||||||
Options.annotate = False
|
Options.annotate = False
|
||||||
Options.fast_fail = True
|
Options.fast_fail = True
|
||||||
|
|
||||||
|
DEBUG = bool(os.getenv("DOPT_DEBUG", None))
|
||||||
|
|
||||||
|
linetrace_opt: bool = False
|
||||||
|
if DEBUG:
|
||||||
|
linetrace_opt = True
|
||||||
|
|
||||||
ext_modules = cythonize(
|
ext_modules = cythonize(
|
||||||
["src/dopt_sensor_anomalies/detection.py"],
|
["src/dopt_sensor_anomalies/detection.py"],
|
||||||
compiler_directives={
|
compiler_directives={
|
||||||
"language_level": 3,
|
"language_level": 3,
|
||||||
|
"boundscheck": False,
|
||||||
|
"wraparound": False,
|
||||||
"embedsignature": False,
|
"embedsignature": False,
|
||||||
"annotation_typing": True,
|
"annotation_typing": True,
|
||||||
"linetrace": True,
|
"linetrace": linetrace_opt,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
DEBUG = bool(os.getenv("DOPT_DEBUG", None))
|
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
ext_modules[0].define_macros.append(("CYTHON_TRACE", "1"))
|
ext_modules[0].define_macros.append(("CYTHON_TRACE", "1"))
|
||||||
|
|
||||||
|
compiler_args: list[str] = []
|
||||||
|
linker_args: list[str] = []
|
||||||
|
|
||||||
|
|
||||||
|
if sys.platform.startswith("win") and not DEBUG:
|
||||||
|
c_args = ("/O2", "/GL", "/Gy")
|
||||||
|
l_args = ("/LTCG", "/OPT:REF", "/OPT:ICF")
|
||||||
|
else:
|
||||||
|
c_args = tuple()
|
||||||
|
l_args = tuple()
|
||||||
|
|
||||||
|
compiler_args.extend(c_args)
|
||||||
|
linker_args.extend(l_args)
|
||||||
|
|
||||||
|
for ext in ext_modules:
|
||||||
|
ext.extra_compile_args.extend(compiler_args)
|
||||||
|
ext.extra_link_args.extend(linker_args)
|
||||||
|
|
||||||
setup(ext_modules=ext_modules)
|
setup(ext_modules=ext_modules)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user