summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt20
-rw-r--r--libshiboken/CMakeLists.txt13
-rw-r--r--tests/otherbinding/CMakeLists.txt2
-rw-r--r--tests/samplebinding/CMakeLists.txt2
4 files changed, 23 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97d010af..8a58de66 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,26 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake"
add_custom_target(uninstall "${CMAKE_COMMAND}"
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+# Detect if the python libs were compiled in debug mode
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; \\
+ print sysconfig.get_config_var('Py_DEBUG')"
+ OUTPUT_VARIABLE PY_DEBUG
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ if(NOT PYTHON_DEBUG_LIBRARIES)
+ message(FATAL_ERROR "Python debug library not found. Try compile shiboken with -DCMAKE_BUILD_TYPE=Release")
+ endif()
+ if(NOT PY_DEBUG)
+ message(WARNING "Compiling shiboken with debug enabled, but the python executable was not compiled with debug support.")
+ endif()
+ add_definitions("-DPy_DEBUG")
+ set(SBK_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
+else()
+ set(SBK_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
+endif()
+
if (BUILD_TESTS)
enable_testing()
endif()
diff --git a/libshiboken/CMakeLists.txt b/libshiboken/CMakeLists.txt
index 4571a4cf..d39afc0f 100644
--- a/libshiboken/CMakeLists.txt
+++ b/libshiboken/CMakeLists.txt
@@ -24,16 +24,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ShibokenConfigVersion.cmake.in"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shiboken.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/shiboken.pc" @ONLY)
-# Detect if the python libs were compiled in debug mode
-execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; \\
- print sysconfig.get_config_var('Py_DEBUG')"
- OUTPUT_VARIABLE PY_DEBUG
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-if (PY_DEBUG)
- add_definitions("-DPy_DEBUG")
-endif()
-
set(libshiboken_SRC
basewrapper.cpp
helper.cpp
@@ -47,8 +37,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${SPARSEHASH_INCLUDE_PATH})
add_library(libshiboken SHARED ${libshiboken_SRC})
set_property(TARGET libshiboken PROPERTY PREFIX "")
-target_link_libraries(libshiboken
- ${PYTHON_LIBRARIES})
+target_link_libraries(libshiboken ${SBK_PYTHON_LIBRARIES})
set_target_properties(libshiboken PROPERTIES VERSION ${libshiboken_VERSION} SOVERSION ${libshiboken_SOVERSION})
install(FILES
diff --git a/tests/otherbinding/CMakeLists.txt b/tests/otherbinding/CMakeLists.txt
index d9b97147..9a67d41e 100644
--- a/tests/otherbinding/CMakeLists.txt
+++ b/tests/otherbinding/CMakeLists.txt
@@ -40,7 +40,7 @@ set_property(TARGET other PROPERTY PREFIX "")
target_link_libraries(other
libother
libsample
- ${PYTHON_LIBRARIES}
+ ${SBK_PYTHON_LIBRARIES}
libshiboken)
add_dependencies(other sample shiboken_generator)
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt
index a41ad727..a9dea7cf 100644
--- a/tests/samplebinding/CMakeLists.txt
+++ b/tests/samplebinding/CMakeLists.txt
@@ -95,7 +95,7 @@ add_library(sample MODULE ${sample_SRC})
set_property(TARGET sample PROPERTY PREFIX "")
target_link_libraries(sample
libsample
- ${PYTHON_LIBRARIES}
+ ${SBK_PYTHON_LIBRARIES}
libshiboken)
add_dependencies(sample shiboken_generator)