summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2011-01-11 17:07:26 -0300
committerRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2011-01-12 17:23:46 -0300
commit297151081ffae13c8dbb66ffde61f2c15eaae2a3 (patch)
tree802d1533c5749a50859e97beec19b4552839fb30
parent498ba2f39e64129d6911cedfd1334032350543eb (diff)
downloadshiboken-297151081ffae13c8dbb66ffde61f2c15eaae2a3.tar.gz
shiboken-297151081ffae13c8dbb66ffde61f2c15eaae2a3.tar.xz
shiboken-297151081ffae13c8dbb66ffde61f2c15eaae2a3.zip
Append python name to libshiboken output file
libshiboken is strongly tied to the python it was compiled against. This commit adds the python name to the output file to make this connection explicit. The generator plugin, binary and includes are untouched as they don't depend on python. Also, Instead of installing the cmake info in a single file, ShibokenConfig.cmake will load the correct file (ShibokenConfig-<python name>.cmake) based on the value of PYTHON_BASENAME when cmake is called. The last shiboken installed will be the default as each install will overwrite ShibokenConfig.cmake. To select an specific python, call cmake with -DPYTHON_BASENAME=python2.6, for python2.6 release. Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Lauro Moura <lauro.neto@openbossa.org>
-rw-r--r--CMakeLists.txt10
-rw-r--r--data/CMakeLists.txt4
-rw-r--r--data/ShibokenConfig-spec.cmake.in29
-rw-r--r--data/ShibokenConfig.cmake.in31
-rw-r--r--libshiboken/CMakeLists.txt2
5 files changed, 48 insertions, 28 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0891ce9..52aea434 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,6 +70,16 @@ execute_process(
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)
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 9ad9381d..66838599 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -6,6 +6,8 @@ endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ShibokenConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/ShibokenConfig.cmake" @ONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ShibokenConfig-spec.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/ShibokenConfig-${PYTHON_BASENAME}.cmake" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ShibokenConfigVersion.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/ShibokenConfigVersion.cmake" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shiboken.pc.in"
@@ -13,6 +15,8 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shiboken.pc.in"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ShibokenConfig.cmake"
DESTINATION "${LIB_INSTALL_DIR}/cmake/Shiboken-${shiboken_VERSION}")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ShibokenConfig-${PYTHON_BASENAME}.cmake"
+ DESTINATION "${LIB_INSTALL_DIR}/cmake/Shiboken-${shiboken_VERSION}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ShibokenConfigVersion.cmake"
DESTINATION "${LIB_INSTALL_DIR}/cmake/Shiboken-${shiboken_VERSION}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/shiboken${shiboken_SUFFIX}.pc"
diff --git a/data/ShibokenConfig-spec.cmake.in b/data/ShibokenConfig-spec.cmake.in
new file mode 100644
index 00000000..36f0e733
--- /dev/null
+++ b/data/ShibokenConfig-spec.cmake.in
@@ -0,0 +1,29 @@
+# SHIBOKEN_INCLUDE_DIR - Directories to include to use SHIBOKEN
+# SHIBOKEN_LIBRARIES - Files to link against to use SHIBOKEN
+# SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode.
+# SHIBOKEN_PYTHON_INTERPRETER - Python interpreter (regular or debug) to be used with the bindings.
+# SHIBOKEN_PYTHON_LIBRARIES - Python libraries (regular or debug) Shiboken is linked against.
+
+SET(SHIBOKEN_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/shiboken@shiboken_SUFFIX@")
+if(MSVC)
+ SET(SHIBOKEN_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken@shiboken_SUFFIX@-@PYTHON_BASENAME@@LIBRARY_OUTPUT_SUFFIX@.lib")
+elseif(WIN32)
+ SET(SHIBOKEN_LIBRARY "@CMAKE_INSTALL_PREFIX@/bin/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken@shiboken_SUFFIX@-@PYTHON_BASENAME@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
+else()
+ SET(SHIBOKEN_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken@shiboken_SUFFIX@-@PYTHON_BASENAME@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
+endif()
+SET(SHIBOKEN_PYTHON_INCLUDE_DIR "@SBK_PYTHON_INCLUDE_DIR@")
+SET(SHIBOKEN_PYTHON_INCLUDE_DIR "@SBK_PYTHON_INCLUDE_DIR@")
+SET(SHIBOKEN_PYTHON_INTERPRETER "@PYTHON_EXECUTABLE@")
+SET(SHIBOKEN_PYTHON_LIBRARIES "@SBK_PYTHON_LIBRARIES@")
+SET(SHIBOKEN_PYTHON_BASENAME "@PYTHON_BASENAME@")
+message(STATUS "libshiboken built for @SHIBOKEN_BUILD_TYPE@")
+@SBK_ADD_PY_DEBUG_DEFINITION@
+
+# We don't use just "if (@AVOID_PROTECTED_HACK@)" to avoid require all users to turn on the cmake policy CMP0012
+# for more info type: cmake --help-policy CMP0012
+set(SHIBOKEN_AVOID_PROTECTED_HACK @AVOID_PROTECTED_HACK@)
+if (SHIBOKEN_AVOID_PROTECTED_HACK)
+ add_definitions(-DAVOID_PROTECTED_HACK)
+ message(STATUS "Avoiding protected hack!")
+endif()
diff --git a/data/ShibokenConfig.cmake.in b/data/ShibokenConfig.cmake.in
index c7abc831..92f5d02c 100644
--- a/data/ShibokenConfig.cmake.in
+++ b/data/ShibokenConfig.cmake.in
@@ -1,28 +1,5 @@
-# SHIBOKEN_INCLUDE_DIR - Directories to include to use SHIBOKEN
-# SHIBOKEN_LIBRARIES - Files to link against to use SHIBOKEN
-# SHIBOKEN_BUILD_TYPE - Tells if Shiboken was compiled in Release or Debug mode.
-# SHIBOKEN_PYTHON_INTERPRETER - Python interpreter (regular or debug) to be used with the bindings.
-# SHIBOKEN_PYTHON_LIBRARIES - Python libraries (regular or debug) Shiboken is linked against.
-
-SET(SHIBOKEN_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/shiboken@shiboken_SUFFIX@")
-if(MSVC)
- SET(SHIBOKEN_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken@shiboken_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@.lib")
-elseif(WIN32)
- SET(SHIBOKEN_LIBRARY "@CMAKE_INSTALL_PREFIX@/bin/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken@shiboken_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
-else()
- SET(SHIBOKEN_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken@shiboken_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
-endif()
-SET(SHIBOKEN_PYTHON_INCLUDE_DIR "@SBK_PYTHON_INCLUDE_DIR@")
-SET(SHIBOKEN_PYTHON_INTERPRETER "@PYTHON_EXECUTABLE@")
-SET(SHIBOKEN_PYTHON_LIBRARIES "@SBK_PYTHON_LIBRARIES@")
-SET(SHIBOKEN_BUILD_TYPE "@SHIBOKEN_BUILD_TYPE@")
-message(STATUS "libshiboken built for @SHIBOKEN_BUILD_TYPE@")
-@SBK_ADD_PY_DEBUG_DEFINITION@
-
-# We don't use just "if (@AVOID_PROTECTED_HACK@)" to avoid require all users to turn on the cmake policy CMP0012
-# for more info type: cmake --help-policy CMP0012
-set(SHIBOKEN_AVOID_PROTECTED_HACK @AVOID_PROTECTED_HACK@)
-if (SHIBOKEN_AVOID_PROTECTED_HACK)
- add_definitions(-DAVOID_PROTECTED_HACK)
- message(STATUS "Avoiding protected hack!")
+if (NOT PYTHON_BASENAME)
+ message(STATUS "Using default python: @PYTHON_BASENAME@")
+ SET(PYTHON_BASENAME @PYTHON_BASENAME@)
endif()
+include(@LIB_INSTALL_DIR@/cmake/Shiboken-@shiboken_VERSION@/ShibokenConfig-${PYTHON_BASENAME}.cmake)
diff --git a/libshiboken/CMakeLists.txt b/libshiboken/CMakeLists.txt
index 36156065..d08c1f45 100644
--- a/libshiboken/CMakeLists.txt
+++ b/libshiboken/CMakeLists.txt
@@ -36,7 +36,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${SPARSEHASH_INCLUDE_PATH})
add_library(libshiboken SHARED ${libshiboken_SRC})
target_link_libraries(libshiboken ${SBK_PYTHON_LIBRARIES})
-set_target_properties(libshiboken PROPERTIES OUTPUT_NAME "shiboken${shiboken_SUFFIX}"
+set_target_properties(libshiboken PROPERTIES OUTPUT_NAME "shiboken${shiboken_SUFFIX}-${PYTHON_BASENAME}"
VERSION ${libshiboken_VERSION}
SOVERSION ${libshiboken_SOVERSION}
DEFINE_SYMBOL LIBSHIBOKEN_EXPORTS)