Make pybind more verbose in debug on windows (#2045)
* Make pybind more verbose in debug on windows * Remove the NDEBUG flag everywhere * Code complexity reduction... * Missing colon * And now the missing empty line... * Reusable functions * Now the mood of the sentence was wrong... * Free functions instead of methods
This commit is contained in:
parent
8e9b733534
commit
51fa5ab8cb
@ -100,6 +100,34 @@ if len([fn for fn in os.listdir(NGRAPH_CPP_LIBRARY_DIR) if re.search("onnx_impor
|
||||
ONNX_IMPORTER_CPP_LIBRARY_NAME = "onnx_importerd"
|
||||
|
||||
|
||||
def _remove_compiler_flags(obj):
|
||||
"""Make pybind11 more verbose in debug builds."""
|
||||
try:
|
||||
# pybind11 is much more verbose without the NDEBUG define
|
||||
if sys.platform == "win32":
|
||||
obj.compiler.remove("/DNDEBUG")
|
||||
obj.compiler.remove("/O2")
|
||||
else:
|
||||
obj.compiler.remove("-DNDEBUG")
|
||||
obj.compiler.remove("-O2")
|
||||
except (AttributeError, ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def _remove_compiler_so_flags(obj):
|
||||
"""Make pybind11 more verbose in debug builds."""
|
||||
try:
|
||||
# pybind11 is much more verbose without the NDEBUG define
|
||||
if sys.platform == "win32":
|
||||
obj.compiler_so.remove("/DNDEBUG")
|
||||
obj.compiler_so.remove("/O2")
|
||||
else:
|
||||
obj.compiler_so.remove("-DNDEBUG")
|
||||
obj.compiler_so.remove("-O2")
|
||||
except (AttributeError, ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def parallelCCompile(
|
||||
self,
|
||||
sources,
|
||||
@ -124,14 +152,9 @@ def parallelCCompile(
|
||||
cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
|
||||
|
||||
if NGRAPH_PYTHON_DEBUG in ["TRUE", "ON", True]:
|
||||
try:
|
||||
# pybind11 is much more verbose without -DNDEBUG
|
||||
self.compiler.remove("-DNDEBUG")
|
||||
self.compiler.remove("-O2")
|
||||
self.compiler_so.remove("-DNDEBUG")
|
||||
self.compiler_so.remove("-O2")
|
||||
except (AttributeError, ValueError):
|
||||
pass
|
||||
_remove_compiler_flags(self)
|
||||
_remove_compiler_so_flags(self)
|
||||
|
||||
# parallel code
|
||||
import multiprocessing.pool
|
||||
|
||||
@ -330,9 +353,8 @@ class BuildExt(build_ext):
|
||||
# -Wstrict-prototypes is not a valid option for c++
|
||||
self.compiler.compiler_so.remove("-Wstrict-prototypes")
|
||||
if NGRAPH_PYTHON_DEBUG in ["TRUE", "ON", True]:
|
||||
# pybind11 is much more verbose without -DNDEBUG
|
||||
self.compiler.compiler_so.remove("-DNDEBUG")
|
||||
self.compiler.compiler_so.remove("-O2")
|
||||
_remove_compiler_so_flags(self)
|
||||
|
||||
except (AttributeError, ValueError):
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user