aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-06-16 16:57:30 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:26 -0300
commitd08c86eebf68d049fe80795955fbcf1446e8b0f7 (patch)
tree0de2fc8e7d7215c90c376ee330311db725951bd4
parent45a008604122af4e4ff4e7db440d9e65be3093fc (diff)
Fixed python debug likage.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--CMakeLists.txt19
-rw-r--r--cmake/Modules/FindPythonInterpWithDebug.cmake34
2 files changed, 30 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 40cae19fd..f05cc41b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,29 +54,12 @@ 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 bool(sysconfig.get_config_var('Py_DEBUG'))"
- OUTPUT_VARIABLE PY_DEBUG
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-
-execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "import sys; \\
- from distutils import sysconfig; \\
- vr = sys.version_info; \\
- suffix = '-dbg' if bool(sysconfig.get_config_var('Py_DEBUG')) else ''; \\
- print 'python%d.%d%s' % (vr[0], vr[1], suffix)"
- OUTPUT_VARIABLE PYTHON_BASENAME
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
set(SHIBOKEN_BUILD_TYPE "Release")
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)
+ if(NOT PYTHON_WITH_DEBUG)
message(WARNING "Compiling shiboken with debug enabled, but the python executable was not compiled with debug support.")
else()
add_definitions("-DPy_DEBUG")
diff --git a/cmake/Modules/FindPythonInterpWithDebug.cmake b/cmake/Modules/FindPythonInterpWithDebug.cmake
index 264dd5d81..76c93fcfe 100644
--- a/cmake/Modules/FindPythonInterpWithDebug.cmake
+++ b/cmake/Modules/FindPythonInterpWithDebug.cmake
@@ -1,12 +1,8 @@
INCLUDE(FindPythonInterp)
+INCLUDE(FindPythonLibs)
find_package(PythonInterp REQUIRED)
-#Fix missing variable on UNIX env
-if(NOT PYTHON_DEBUG_LIBRARIES AND UNIX)
- set(PYTHON_DEBUG_LIBRARIES "${PYTHON_LIBRARIES}")
-endif()
-
if(PYTHONINTERP_FOUND AND UNIX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
# This is for Debian
set(PYTHON_EXECUTABLE_TMP "${PYTHON_EXECUTABLE}-dbg")
@@ -19,3 +15,31 @@ if(PYTHONINTERP_FOUND AND UNIX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_TMP}")
endif()
+# Detect if the python libs were compiled in debug mode
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; \\
+ print bool(sysconfig.get_config_var('Py_DEBUG'))"
+ OUTPUT_VARIABLE PYTHON_WITH_DEBUG
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "import sys; \\
+ from distutils import sysconfig; \\
+ vr = sys.version_info; \\
+ suffix = '-dbg' if bool(sysconfig.get_config_var('Py_DEBUG')) else ''; \\
+ print 'python%d.%d%s' % (vr[0], vr[1], suffix)"
+ OUTPUT_VARIABLE PYTHON_BASENAME
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+#Fix missing variable on UNIX env
+if(NOT PYTHON_DEBUG_LIBRARIES AND UNIX)
+ string(REPLACE "-dbg" "" PYTHON_NAME ${PYTHON_BASENAME})
+ find_library(LIBRARY_FOUND ${PYTHON_NAME}_d)
+ if (LIBRARY_FOUND)
+ set(PYTHON_DEBUG_LIBRARIES "${LIBRARY_FOUND}")
+ else()
+ set(PYTHON_DEBUG_LIBRARIES "${PYTHON_LIBRARIES}")
+ endif()
+endif()
+
+