From 206a9cf5d03662ddb1aa2d853dc1e1a87fa01c21 Mon Sep 17 00:00:00 2001 From: Stinkfist0 Date: Wed, 4 Nov 2015 16:25:13 +0200 Subject: [PATCH] Work around https://github.com/swig/swig/issues/325 --- src/ifcwrap/CMakeLists.txt | 6 ++++++ src/ifcwrap/IfcPython.i | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/ifcwrap/CMakeLists.txt b/src/ifcwrap/CMakeLists.txt index 8e65a06b10..3ad7f1cb69 100644 --- a/src/ifcwrap/CMakeLists.txt +++ b/src/ifcwrap/CMakeLists.txt @@ -41,6 +41,12 @@ INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) SET(CMAKE_SWIG_FLAGS "") +# NOTE Workaround for most likely missing debug Python libraries on Windows (requires Python built from the source). +# Python 3.5 intaller and onwards will have an option to install the debug libraries too. +IF (WIN32 AND NOT PYTHON_DEBUG_LIBRARIES) + MESSAGE(STATUS "PYTHON_DEBUG_LIBRARIES not found, defining SWIG_PYTHON_INTERPRETER_NO_DEBUG workaround for IfcWrap.") + ADD_DEFINITIONS(-DSWIG_PYTHON_INTERPRETER_NO_DEBUG) +ENDIF() SET_SOURCE_FILES_PROPERTIES(IfcPython.i PROPERTIES CPLUSPLUS ON) SWIG_ADD_MODULE(ifcopenshell_wrapper python IfcPython.i) diff --git a/src/ifcwrap/IfcPython.i b/src/ifcwrap/IfcPython.i index 4fb584a088..3aca18456c 100644 --- a/src/ifcwrap/IfcPython.i +++ b/src/ifcwrap/IfcPython.i @@ -17,6 +17,27 @@ * * ********************************************************************************/ +%begin %{ +#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG) +/* https://github.com/swig/swig/issues/325 */ +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +#endif +%} + %include "std_string.i" %include "exception.i"