From f5d172c869295ef9fff2e3de524690e523dc5d42 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Wed, 24 May 2017 10:04:20 +0100 Subject: Build also in debug mode for windows (#2192) * Build also in debug mode for windows See #2191 * Don't mix /Od and -O2 on windows build. -O2 comes from perl * Reindent perlcore CMakeLists * Fix debug python build on windows * Rearrange environment vars in appveyor * Try to publish pdb files too * install qts and kvirc's debug pdbs in debug config * use TARGET_PDB_FILE instead --- src/modules/perlcore/CMakeLists.txt | 44 +++++++++++++++------------- src/modules/python/libkvipython.cpp | 2 +- src/modules/pythoncore/kvircmodule.cpp | 2 +- src/modules/pythoncore/kvircmodule.h | 2 +- src/modules/pythoncore/libkvipythoncore.cpp | 2 +- src/modules/pythoncore/pythonheaderwrapper.h | 14 +++++++++ 6 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 src/modules/pythoncore/pythonheaderwrapper.h (limited to 'src/modules') diff --git a/src/modules/perlcore/CMakeLists.txt b/src/modules/perlcore/CMakeLists.txt index 82652138a..7abf88ac9 100644 --- a/src/modules/perlcore/CMakeLists.txt +++ b/src/modules/perlcore/CMakeLists.txt @@ -12,14 +12,14 @@ if(COMPILE_PERL_SUPPORT) OUTPUT_VARIABLE PERL_COMPILE_FLAGS ) -if(CMAKE_COMPILER_IS_GNUCXX) - # GCC whines because perl isn't extremely C++11 compliant - set(PERL_COMPILE_FLAGS "${PERL_COMPILE_FLAGS} -Wno-literal-suffix") -elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - # If the perl version is too old, clang will throw errors due to C++11 - # incompatibilities - set(PERL_COMPILE_FLAGS "${PERL_COMPILE_FLAGS} -Wno-reserved-user-defined-literal") -endif() + if(CMAKE_COMPILER_IS_GNUCXX) + # GCC whines because perl isn't extremely C++11 compliant + set(PERL_COMPILE_FLAGS "${PERL_COMPILE_FLAGS} -Wno-literal-suffix") + elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + # If the perl version is too old, clang will throw errors due to C++11 + # incompatibilities + set(PERL_COMPILE_FLAGS "${PERL_COMPILE_FLAGS} -Wno-reserved-user-defined-literal") + endif() #remove new line characters string(REGEX REPLACE "(\r?\n)+$" "" PERL_COMPILE_FLAGS ${PERL_COMPILE_FLAGS}) @@ -32,19 +32,21 @@ endif() OUTPUT_VARIABLE PERL_LINK_FLAGS ) -if(MSVC) - # breaks with -nodefaultlib - string(REPLACE " -nodefaultlib" "" PERL_LINK_FLAGS "${PERL_LINK_FLAGS}") -endif() - -if(APPLE) - # ldopts contains all archs supported by the current platform, but we - # only want those we specified in CMAKE_OSX_ARCHITECTURES. - string(REGEX REPLACE "-arch [-a-zA-Z0-9_]*" "" PERL_LINK_FLAGS "${PERL_LINK_FLAGS}") - foreach (arch ${CMAKE_OSX_ARCHITECTURES}) - set(PERL_LINK_FLAGS " -arch ${arch} ${PERL_LINK_FLAGS}") - endforeach(arch) -endif() + if(MSVC) + # breaks with -nodefaultlib + string(REPLACE " -nodefaultlib" "" PERL_LINK_FLAGS "${PERL_LINK_FLAGS}") + # conflicts with opt level set by user, especially in debug mode + string(REPLACE " -O2" "" PERL_COMPILE_FLAGS "${PERL_COMPILE_FLAGS}") + endif() + + if(APPLE) + # ldopts contains all archs supported by the current platform, but we + # only want those we specified in CMAKE_OSX_ARCHITECTURES. + string(REGEX REPLACE "-arch [-a-zA-Z0-9_]*" "" PERL_LINK_FLAGS "${PERL_LINK_FLAGS}") + foreach (arch ${CMAKE_OSX_ARCHITECTURES}) + set(PERL_LINK_FLAGS " -arch ${arch} ${PERL_LINK_FLAGS}") + endforeach(arch) + endif() # Remove new line characters string(REGEX REPLACE "(\r?\n)+$" "" PERL_LINK_FLAGS "${PERL_LINK_FLAGS}") diff --git a/src/modules/python/libkvipython.cpp b/src/modules/python/libkvipython.cpp index 4a44370b8..0af0eec34 100644 --- a/src/modules/python/libkvipython.cpp +++ b/src/modules/python/libkvipython.cpp @@ -29,7 +29,7 @@ #ifdef COMPILE_PYTHON_SUPPORT #include "../pythoncore/pythoncoreinterface.h" -#include +#include "../pythoncore/pythonheaderwrapper.h" static KviModule * g_pPythonCoreModule = nullptr; diff --git a/src/modules/pythoncore/kvircmodule.cpp b/src/modules/pythoncore/kvircmodule.cpp index 235e3545a..8937b6a63 100644 --- a/src/modules/pythoncore/kvircmodule.cpp +++ b/src/modules/pythoncore/kvircmodule.cpp @@ -26,7 +26,7 @@ #ifdef COMPILE_PYTHON_SUPPORT -#include +#include "pythonheaderwrapper.h" #define KVIRC_MODULE diff --git a/src/modules/pythoncore/kvircmodule.h b/src/modules/pythoncore/kvircmodule.h index 53376d577..53e716d7d 100644 --- a/src/modules/pythoncore/kvircmodule.h +++ b/src/modules/pythoncore/kvircmodule.h @@ -37,7 +37,7 @@ #ifdef COMPILE_PYTHON_SUPPORT -#include +#include "pythonheaderwrapper.h" // python included like to pollute the global namespace, let's #undef some beef #undef isspace diff --git a/src/modules/pythoncore/libkvipythoncore.cpp b/src/modules/pythoncore/libkvipythoncore.cpp index 812e414b6..90dca594d 100644 --- a/src/modules/pythoncore/libkvipythoncore.cpp +++ b/src/modules/pythoncore/libkvipythoncore.cpp @@ -34,7 +34,7 @@ #ifdef COMPILE_PYTHON_SUPPORT #include "pythoncoreinterface.h" -#include +#include "pythonheaderwrapper.h" KviKvsRunTimeContext * g_pCurrentKvsContext = nullptr; bool g_bExecuteQuiet = false; diff --git a/src/modules/pythoncore/pythonheaderwrapper.h b/src/modules/pythoncore/pythonheaderwrapper.h new file mode 100644 index 000000000..47f60d361 --- /dev/null +++ b/src/modules/pythoncore/pythonheaderwrapper.h @@ -0,0 +1,14 @@ +#ifndef _PYTHONHEADERWRAPPER_H_ +#define _PYTHONHEADERWRAPPER_H_ + +// See http://stackoverflow.com/questions/16200997/why-doesnt-include-python-h-work and http://stackoverflow.com/questions/19716859/puzzling-dependency-of-boost-python-1-54-debug-build-to-python27-lib-on-window + +#if defined(_DEBUG) && defined(_MSC_VER) +# undef _DEBUG +# include +# define _DEBUG 1 +#else +# include +#endif + +#endif -- cgit v1.3.1-10-gc9f91