aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2018-10-18 19:40:49 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-02-07 08:26:31 +0000
commit97df448edbc035a2f531508a5cfe5739fb2de18d (patch)
tree732de8143e1dcb6a5b25e25eb8ec2954bf8ac87f /sources/shiboken2
parent9a371088d6b8e8a0986a30a8dfb0076669275103 (diff)
Modernize cmake build
Add a CMake super project that includes the shiboken2, PySide2 and pyside2-tools subprojects, so that it's possible to build everything from Qt Creator (or any other IDE that supports CMake) with minimal set up effort, and thus inform the IDE CMake integration of all relevant files, for easier code editing, navigation and refactoring. This also lays the foundation for allowing 3rd parties to use the shiboken2 generator to generate custom modules. This is achieved by eliminating various hardcoded paths for libraries and include directories. Start using CMake targets throughout the build code to correctly propagate link flags and include dirs for libshiboken and shiboken2 executable targets. Same for the libpyside target. Generate two separate cmake config files (build-tree / install-tree) that can be used with find_package(Shiboken2), to make sure that the PySide2 project can be built as part of the super project build. This is currently the only way I've found to allow the super build to work. Note that for the build-tree find_package() to work, the CMAKE_MODULE_PATH has to be adjusted in the super project file. The generated config files contain variables and logic that allow usage of the installed shiboken package in downstream projects (PySide2). This involves things like getting the includes and libraries for the currently found python interpreter, the shiboken build type (release or debug), was shiboken built with limited api support, etc. Generate 2 separate (build-tree and install-tree) config files for PySide2, similar to how it's done for the shiboken case, for pyside2-tools to build correctly. Install shiboken2 target files using install(EXPORT) to allow building PySide2 with an installed Shiboken2 package (as opposed to one that is built as part of the super project). Same with PySide2 targets for pyside2-tools subproject. Make sure not to redefine uninstall targets if they are already defined. Add a --shorter-paths setup.py option, which would be used by the Windows CI, to circumvent creating paths that are too long, and thus avoiding build issues. Output the build characteristics / classifiers into the generated build_history/YYYY-MM-DD_AAAAAA/build_dir.txt file, so it can be used by the test runner to properly filter out blacklisted tests. This was necessary due to the shorter paths options. Fix various issues regarding target includes and library dependencies. Remove certain duplicated cmake code (like limited api check and build type checks) in PySide2, given that that information will now be present in the exported shiboken2 config file. Include a short README.cmake.md file that describes how to build the super project. References used https://rix0r.nl/blog/2015/08/13/cmake-guide/ https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/ https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1 https://cliutils.gitlab.io/modern-cmake/chapters/basics/functions.html https://cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html https://github.com/ComicSansMS/libstratcom/blob/master/CMakeLists.txt Abandoned approach using ExternalProject references: https://cmake.org/cmake/help/latest/module/ExternalProject.html https://stackoverflow.com/questions/44990964/how-to-perform-cmakefind-package-at-build-stage-only Fixes: PYSIDE-919 Change-Id: Iaa15d20b279a04c5e16ce2795d03f912bc44a389 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2')
-rw-r--r--sources/shiboken2/ApiExtractor/CMakeLists.txt4
-rw-r--r--sources/shiboken2/CMakeLists.txt96
-rw-r--r--sources/shiboken2/data/CMakeLists.txt39
-rw-r--r--sources/shiboken2/data/Shiboken2Config-spec.cmake.in65
-rw-r--r--sources/shiboken2/data/Shiboken2Config.cmake.in2
-rw-r--r--sources/shiboken2/data/shiboken2.pc.in6
-rw-r--r--sources/shiboken2/data/shiboken_helpers.cmake201
-rw-r--r--sources/shiboken2/generator/CMakeLists.txt5
-rw-r--r--sources/shiboken2/libshiboken/CMakeLists.txt48
-rw-r--r--sources/shiboken2/shibokenmodule/CMakeLists.txt2
-rw-r--r--sources/shiboken2/tests/minimalbinding/CMakeLists.txt2
-rw-r--r--sources/shiboken2/tests/otherbinding/CMakeLists.txt2
-rw-r--r--sources/shiboken2/tests/samplebinding/CMakeLists.txt2
-rw-r--r--sources/shiboken2/tests/smartbinding/CMakeLists.txt2
14 files changed, 345 insertions, 131 deletions
diff --git a/sources/shiboken2/ApiExtractor/CMakeLists.txt b/sources/shiboken2/ApiExtractor/CMakeLists.txt
index b4fd1cb99..add5221c9 100644
--- a/sources/shiboken2/ApiExtractor/CMakeLists.txt
+++ b/sources/shiboken2/ApiExtractor/CMakeLists.txt
@@ -17,10 +17,6 @@ if (NOT DISABLE_DOCSTRINGS)
endif()
endif()
-if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE Release)
-endif()
-
if(BUILD_TESTS)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/tests)
endif ()
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index 01efddaa5..1e52c4297 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -5,14 +5,14 @@ include(CheckIncludeFileCXX)
cmake_minimum_required(VERSION 3.1)
cmake_policy(VERSION 3.1)
-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake_helpers/
- ${CMAKE_MODULE_PATH})
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_helpers/")
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data/")
+
include(helpers)
+include(shiboken_helpers)
find_package(Qt5 5.12 REQUIRED COMPONENTS Core Xml XmlPatterns)
-add_definitions(${Qt5Core_DEFINITIONS})
-
option(BUILD_TESTS "Build tests." TRUE)
option(USE_PYTHON_VERSION "Use specific python version to build shiboken2." "")
@@ -36,11 +36,9 @@ if (QUIET_BUILD)
endif()
if (USE_PYTHON_VERSION)
- find_package(PythonInterp ${USE_PYTHON_VERSION} REQUIRED)
- find_package(PythonLibs ${USE_PYTHON_VERSION} REQUIRED)
+ shiboken_find_required_python(${USE_PYTHON_VERSION})
else()
- find_package(PythonInterp 2.7)
- find_package(PythonLibs 2.7)
+ shiboken_find_required_python()
endif()
macro(get_python_arch)
@@ -153,7 +151,7 @@ if (NOT CLANG_INCLUDE_FOUND)
package? (e.g. libclang-6.0-dev)")
endif()
-set(SHIBOKEN_VERSION_FILE_PATH "${CMAKE_SOURCE_DIR}/shiboken_version.py")
+set(SHIBOKEN_VERSION_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/shiboken_version.py")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
${SHIBOKEN_VERSION_FILE_PATH}
)
@@ -219,34 +217,7 @@ endif()
option(FORCE_LIMITED_API "Enable the limited API." "yes")
set(PYTHON_LIMITED_API 0)
-# On Windows, PYTHON_LIBRARIES can be a list. Example:
-# optimized;C:/Python36/libs/python36.lib;debug;C:/Python36/libs/python36_d.lib
-# On other platforms, this result is not used at all.
-execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "if True:
- for lib in '${PYTHON_LIBRARIES}'.split(';'):
- if '/' in lib:
- prefix, py = lib.rsplit('/', 1)
- if py.startswith('python3'):
- print(prefix + '/python3.lib')
- break
- "
- OUTPUT_VARIABLE PYTHON_LIMITED_LIBRARIES
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-if(FORCE_LIMITED_API STREQUAL "yes")
- if (${PYTHON_VERSION_MAJOR} EQUAL 3 AND ${PYTHON_VERSION_MINOR} GREATER 4)
- # GREATER_EQUAL is available only from cmake 3.7 on. We mean python 3.5 .
- add_definitions("-DPy_LIMITED_API=0x03050000")
- set(PYTHON_LIMITED_API 1)
- endif()
- if(WIN32)
- if (${PYTHON_VERSION_MAJOR} EQUAL 3 AND ${PYTHON_VERSION_MINOR} GREATER 4)
- # PYSIDE-560: XXX maybe add an option to setup.py as override
- set(SBK_PYTHON_LIBRARIES ${PYTHON_LIMITED_LIBRARIES})
- endif()
- endif()
-endif()
+shiboken_check_if_limited_api()
if (PYTHON_LIMITED_API)
if (WIN32 AND NOT EXISTS "${PYTHON_LIMITED_LIBRARIES}")
@@ -270,8 +241,10 @@ if (NOT PYTHON_CONFIG_SUFFIX)
else()
set(PYTHON_EXTENSION_SUFFIX ".abi3")
endif()
+ set(PYTHON_CONFIG_SUFFIX ".abi3")
+ else()
+ set(PYTHON_CONFIG_SUFFIX "${PYTHON_EXTENSION_SUFFIX}")
endif()
- set(PYTHON_CONFIG_SUFFIX "${PYTHON_EXTENSION_SUFFIX}")
endif()
endif()
@@ -285,6 +258,10 @@ if (NOT PYTHON_SHARED_LIBRARY_SUFFIX)
endif()
endif()
+if (NOT PYTHON_CONFIG_SUFFIX)
+ message(FATAL_ERROR
+ "PYTHON_CONFIG_SUFFIX is empty. It should never be empty. Please file a bug report.")
+endif()
message(STATUS "PYTHON_EXTENSION_SUFFIX: ${PYTHON_EXTENSION_SUFFIX}")
message(STATUS "PYTHON_CONFIG_SUFFIX: ${PYTHON_CONFIG_SUFFIX}")
@@ -318,7 +295,6 @@ else()
set(CMAKE_CXX_FLAGS_DEBUG "-g")
option(ENABLE_GCC_OPTIMIZATION "Enable specific GCC flags to optimization library size and performance. Only available on Release Mode" 0)
if(ENABLE_GCC_OPTIMIZATION)
- set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -Os -Wl,-O1")
if(NOT CMAKE_HOST_APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--hash-style=gnu")
@@ -334,7 +310,8 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
-set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
+set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
+set(BIN_INSTALL_DIR "bin" CACHE PATH "The subdirectory relative to the install prefix where dlls will be installed (default is /bin)" FORCE)
if (WIN32)
set(PATH_SEP "\;")
@@ -408,16 +385,15 @@ execute_process(
OUTPUT_VARIABLE PYTHON_WITH_COUNT_ALLOCS
OUTPUT_STRIP_TRAILING_WHITESPACE)
-set(SHIBOKEN_BUILD_TYPE "Release")
-
-# We do not want to link against the python shared / static library on Linux and macOS.
-# The dynamic linker will pick up the python symbols at runtime automatically.
-# On Windows we do need to link against the python.lib import library.
-if (NOT SBK_PYTHON_LIBRARIES)
- set(SBK_PYTHON_LIBRARIES "")
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Release)
endif()
+set(SHIBOKEN_BUILD_TYPE "Release")
+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ set(SHIBOKEN_BUILD_TYPE "Debug")
+
if(NOT PYTHON_DEBUG_LIBRARIES)
message(WARNING "Python debug shared library not found; assuming python was built with shared library support disabled.")
endif()
@@ -425,38 +401,12 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
if(NOT PYTHON_WITH_DEBUG)
message(WARNING "Compiling shiboken2 with debug enabled, but the python executable was not compiled with debug support.")
else()
- add_definitions("-DPy_DEBUG")
- set(SBK_ADD_PY_DEBUG_DEFINITION "add_definitions(\"-DPy_DEBUG\")")
set(SBK_PKG_CONFIG_PY_DEBUG_DEFINITION " -DPy_DEBUG")
endif()
if (PYTHON_WITH_COUNT_ALLOCS)
- add_definitions("-DCOUNT_ALLOCS")
- set(SBK_ADD_PY_DEBUG_DEFINITION "${SBK_ADD_PY_DEBUG_DEFINITION} \nadd_definitions(\"-DCOUNT_ALLOCS\")")
set(SBK_PKG_CONFIG_PY_DEBUG_DEFINITION "${SBK_PKG_CONFIG_PY_DEBUG_DEFINITION} -DCOUNT_ALLOCS")
endif()
-
- if(WIN32 AND NOT SBK_PYTHON_LIBRARIES)
- set(SBK_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
- endif()
- set(SHIBOKEN_BUILD_TYPE "Debug")
-endif()
-
-if(CMAKE_BUILD_TYPE STREQUAL "Release")
- add_definitions("-DNDEBUG")
- if(WIN32 AND NOT SBK_PYTHON_LIBRARIES)
- set(SBK_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
- endif()
-endif()
-
-
-if(APPLE)
- set(SBK_PYTHON_LIBRARIES "-undefined dynamic_lookup")
-endif()
-if(CMAKE_VERSION VERSION_LESS 2.8)
- set(SBK_PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_PATH})
-else()
- set(SBK_PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIRS})
endif()
add_subdirectory(ApiExtractor)
diff --git a/sources/shiboken2/data/CMakeLists.txt b/sources/shiboken2/data/CMakeLists.txt
index d248ceb33..e7ce95456 100644
--- a/sources/shiboken2/data/CMakeLists.txt
+++ b/sources/shiboken2/data/CMakeLists.txt
@@ -8,10 +8,37 @@ add_custom_target(data)
add_dependencies(data shiboken2)
get_target_property(SHIBOKEN_GENERATOR shiboken2 OUTPUT_NAME)
+include(CMakePackageConfigHelpers)
+
+# Build-tree / super project package config file.
+set(SHIBOKEN_PYTHON_MODULE_DIR "${shiboken2_BINARY_DIR}/shibokenmodule")
+set(SHIBOKEN_SHARED_LIBRARY_DIR "${shiboken2_BINARY_DIR}/libshiboken")
+
+configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/Shiboken2Config-spec.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/Shiboken2Config${PYTHON_CONFIG_SUFFIX}.cmake"
+ INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}"
+ PATH_VARS SHIBOKEN_PYTHON_MODULE_DIR SHIBOKEN_SHARED_LIBRARY_DIR
+ INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
+)
+
+# Install-tree / relocatable package config file.
+set(SHIBOKEN_PYTHON_MODULE_DIR "${PYTHON_SITE_PACKAGES}/shiboken2")
+if (WIN32)
+ set(SHIBOKEN_SHARED_LIBRARY_DIR "${BIN_INSTALL_DIR}")
+else()
+ set(SHIBOKEN_SHARED_LIBRARY_DIR "${LIB_INSTALL_DIR}")
+endif()
+
+configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/Shiboken2Config-spec.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/install/Shiboken2Config${PYTHON_CONFIG_SUFFIX}.cmake"
+ INSTALL_DESTINATION "${LIB_INSTALL_DIR}/cmake/Shiboken2-${shiboken2_VERSION}"
+ PATH_VARS SHIBOKEN_PYTHON_MODULE_DIR SHIBOKEN_SHARED_LIBRARY_DIR
+)
+
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Shiboken2Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/Shiboken2Config.cmake" @ONLY)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Shiboken2Config-spec.cmake.in"
- "${CMAKE_CURRENT_BINARY_DIR}/Shiboken2Config${PYTHON_CONFIG_SUFFIX}.cmake" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Shiboken2ConfigVersion.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/Shiboken2ConfigVersion.cmake" @ONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shiboken2.pc.in"
@@ -19,10 +46,16 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/shiboken2.pc.in"
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Shiboken2Config.cmake"
DESTINATION "${LIB_INSTALL_DIR}/cmake/Shiboken2-${shiboken2_VERSION}")
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Shiboken2Config${PYTHON_CONFIG_SUFFIX}.cmake"
+
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/install/Shiboken2Config${PYTHON_CONFIG_SUFFIX}.cmake"
DESTINATION "${LIB_INSTALL_DIR}/cmake/Shiboken2-${shiboken2_VERSION}")
+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Shiboken2ConfigVersion.cmake"
DESTINATION "${LIB_INSTALL_DIR}/cmake/Shiboken2-${shiboken2_VERSION}")
+
+install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/shiboken_helpers.cmake"
+ DESTINATION "${LIB_INSTALL_DIR}/cmake/Shiboken2-${shiboken2_VERSION}")
+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/shiboken2${shiboken2_SUFFIX}.pc"
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
diff --git a/sources/shiboken2/data/Shiboken2Config-spec.cmake.in b/sources/shiboken2/data/Shiboken2Config-spec.cmake.in
index 576bed0e2..db8373806 100644
--- a/sources/shiboken2/data/Shiboken2Config-spec.cmake.in
+++ b/sources/shiboken2/data/Shiboken2Config-spec.cmake.in
@@ -1,32 +1,41 @@
-# SHIBOKEN_INCLUDE_DIR - Directories to include to use SHIBOKEN
-# SHIBOKEN_LIBRARY - Files to link against to use SHIBOKEN
-# SHIBOKEN_BINARY - Executable name
# 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/shiboken2@shiboken2_SUFFIX@")
-if(MSVC)
- SET(SHIBOKEN_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken2@shiboken2_SUFFIX@@PYTHON_SHARED_LIBRARY_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@.lib")
-elseif(CYGWIN)
- SET(SHIBOKEN_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_IMPORT_LIBRARY_PREFIX@shiboken2@shiboken2_SUFFIX@@PYTHON_SHARED_LIBRARY_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_IMPORT_LIBRARY_SUFFIX@")
-elseif(WIN32)
- SET(SHIBOKEN_LIBRARY "@CMAKE_INSTALL_PREFIX@/bin/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken2@shiboken2_SUFFIX@@PYTHON_SHARED_LIBRARY_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
-else()
- SET(SHIBOKEN_LIBRARY "@LIB_INSTALL_DIR@/@CMAKE_SHARED_LIBRARY_PREFIX@shiboken2@shiboken2_SUFFIX@@PYTHON_SHARED_LIBRARY_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@")
+
+@PACKAGE_INIT@
+
+# This is the version of Python against which Shiboken was built. Not necessarily the version
+# against which a downstream project is built (e.g. PySide2).
+set(SHIBOKEN_PYTHON_VERSION_MAJOR "@PYTHON_VERSION_MAJOR@")
+set(SHIBOKEN_PYTHON_VERSION_MINOR "@PYTHON_VERSION_MINOR@")
+set(SHIBOKEN_PYTHON_VERSION_PATCH "@PYTHON_VERSION_PATCH@")
+set(SHIBOKEN_PYTHON_LIMITED_API "@PYTHON_LIMITED_API@")
+
+# Import targets and call variable set up functions only when using an installed shiboken config
+# file (so not during a regular shiboken build, or during a super project build).
+if (NOT TARGET Shiboken2::shiboken2)
+ include("${CMAKE_CURRENT_LIST_DIR}/Shiboken2Targets.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/shiboken_helpers.cmake")
+
+ # Compute the python include and libraries path if needed (aka not part of super project build).
+ shiboken_find_required_python(@PYTHON_VERSION_MAJOR@)
+ shiboken_check_if_built_and_target_python_are_compatible()
+ shiboken_check_if_limited_api()
+ shiboken_compute_python_includes(IS_CALLED_FROM_EXPORT)
+ shiboken_compute_python_libraries(IS_CALLED_FROM_EXPORT)
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_VERSION_MAJOR "@PYTHON_VERSION_MAJOR@")
-SET(SHIBOKEN_PYTHON_VERSION_MINOR "@PYTHON_VERSION_MINOR@")
-SET(SHIBOKEN_PYTHON_VERSION_PATCH "@PYTHON_VERSION_PATCH@")
-SET(SHIBOKEN_PYTHON_LIBRARIES "@SBK_PYTHON_LIBRARIES@")
-SET(SHIBOKEN_PYTHON_EXTENSION_SUFFIX "@PYTHON_EXTENSION_SUFFIX@")
-SET(SHIBOKEN_PYTHON_SHARED_LIBRARY_SUFFIX "@PYTHON_SHARED_LIBRARY_SUFFIX@")
-SET(SHIBOKEN_PYTHON_CONFIG_SUFFIX "@PYTHON_CONFIG_SUFFIX@")
-SET(SHIBOKEN_SO_VERSION "@shiboken2_library_so_version@")
-message(STATUS "libshiboken built for @SHIBOKEN_BUILD_TYPE@")
-@SBK_ADD_PY_DEBUG_DEFINITION@
-set(SHIBOKEN_BINARY "@CMAKE_INSTALL_PREFIX@/bin/@SHIBOKEN_GENERATOR@")
+# Get the "python interpreter" dynamic global property as a variable instead. It brings it into
+# scope for super project builds.
+get_property(SHIBOKEN_PYTHON_INTERPRETER GLOBAL PROPERTY SHIBOKEN_PYTHON_INTERPRETER)
+
+# Set static variables.
+set(SHIBOKEN_PYTHON_EXTENSION_SUFFIX "@PYTHON_EXTENSION_SUFFIX@")
+set(SHIBOKEN_PYTHON_SHARED_LIBRARY_SUFFIX "@PYTHON_SHARED_LIBRARY_SUFFIX@")
+set(SHIBOKEN_PYTHON_CONFIG_SUFFIX "@PYTHON_CONFIG_SUFFIX@")
+set(SHIBOKEN_SO_VERSION "@shiboken2_library_so_version@")
+set(SHIBOKEN_BUILD_TYPE "@SHIBOKEN_BUILD_TYPE@")
+
+set_and_check(SHIBOKEN_PYTHON_MODULE_DIR "@PACKAGE_SHIBOKEN_PYTHON_MODULE_DIR@")
+set_and_check(SHIBOKEN_SHARED_LIBRARY_DIR "@PACKAGE_SHIBOKEN_SHARED_LIBRARY_DIR@")
+
+message(STATUS "libshiboken built for @SHIBOKEN_BUILD_TYPE@")
diff --git a/sources/shiboken2/data/Shiboken2Config.cmake.in b/sources/shiboken2/data/Shiboken2Config.cmake.in
index 7891c5a2d..e13bd2a12 100644
--- a/sources/shiboken2/data/Shiboken2Config.cmake.in
+++ b/sources/shiboken2/data/Shiboken2Config.cmake.in
@@ -2,4 +2,4 @@ if (NOT PYTHON_CONFIG_SUFFIX)
message(STATUS "Shiboken2Config: Using default python: @PYTHON_CONFIG_SUFFIX@")
SET(PYTHON_CONFIG_SUFFIX @PYTHON_CONFIG_SUFFIX@)
endif()
-include("@LIB_INSTALL_DIR@/cmake/Shiboken2-@shiboken2_VERSION@/Shiboken2Config${PYTHON_CONFIG_SUFFIX}.cmake")
+include("${CMAKE_CURRENT_LIST_DIR}/Shiboken2Config${PYTHON_CONFIG_SUFFIX}.cmake")
diff --git a/sources/shiboken2/data/shiboken2.pc.in b/sources/shiboken2/data/shiboken2.pc.in
index 99a26298d..10db59e1e 100644
--- a/sources/shiboken2/data/shiboken2.pc.in
+++ b/sources/shiboken2/data/shiboken2.pc.in
@@ -4,10 +4,10 @@ libdir=@LIB_INSTALL_DIR@
includedir=@CMAKE_INSTALL_PREFIX@/include/shiboken2
generator_location=@CMAKE_INSTALL_PREFIX@/bin/@SHIBOKEN_GENERATOR@
python_interpreter=@PYTHON_EXECUTABLE@
-python_include_dir=@SBK_PYTHON_INCLUDE_DIR@
+python_include_dir=@PYTHON_INCLUDE_DIRS@
Name: shiboken2
Description: Support library for Python bindings created with the Shiboken2 generator.
Version: @shiboken2_VERSION@
-Libs: @SBK_PYTHON_LIBRARIES@ -L${libdir} -lshiboken2@shiboken2_SUFFIX@@PYTHON_SHARED_LIBRARY_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@
-Cflags: -I@SBK_PYTHON_INCLUDE_DIR@ -I${includedir}/@shiboken2_SUFFIX@@SBK_PKG_CONFIG_PY_DEBUG_DEFINITION@
+Libs: @SHIBOKEN_PYTHON_LIBRARIES@ -L${libdir} -lshiboken2@shiboken2_SUFFIX@@PYTHON_SHARED_LIBRARY_SUFFIX@@LIBRARY_OUTPUT_SUFFIX@
+Cflags: -I@PYTHON_INCLUDE_DIRS@ -I${includedir}/@shiboken2_SUFFIX@@SBK_PKG_CONFIG_PY_DEBUG_DEFINITION@
diff --git a/sources/shiboken2/data/shiboken_helpers.cmake b/sources/shiboken2/data/shiboken_helpers.cmake
new file mode 100644
index 000000000..c55ee89fe
--- /dev/null
+++ b/sources/shiboken2/data/shiboken_helpers.cmake
@@ -0,0 +1,201 @@
+include(CMakeParseArguments)
+
+macro(shiboken_parse_all_arguments prefix type flags options multiopts)
+ cmake_parse_arguments(${prefix} "${flags}" "${options}" "${multiopts}" ${ARGN})
+ if(DEFINED ${prefix}_UNPARSED_ARGUMENTS)
+ message(FATAL_ERROR "Unknown arguments were passed to ${type} (${${prefix}_UNPARSED_ARGUMENTS}).")
+ endif()
+endmacro()
+
+macro(shiboken_check_if_limited_api)
+ # On Windows, PYTHON_LIBRARIES can be a list. Example:
+ # optimized;C:/Python36/libs/python36.lib;debug;C:/Python36/libs/python36_d.lib
+ # On other platforms, this result is not used at all.
+ execute_process(
+ COMMAND ${PYTHON_EXECUTABLE} -c "if True:
+ for lib in '${PYTHON_LIBRARIES}'.split(';'):
+ if '/' in lib:
+ prefix, py = lib.rsplit('/', 1)
+ if py.startswith('python3'):
+ print(prefix + '/python3.lib')
+ break
+ "
+ OUTPUT_VARIABLE PYTHON_LIMITED_LIBRARIES
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if(FORCE_LIMITED_API STREQUAL "yes")
+ if (${PYTHON_VERSION_MAJOR} EQUAL 3 AND ${PYTHON_VERSION_MINOR} GREATER 4)
+ # GREATER_EQUAL is available only from cmake 3.7 on. We mean python 3.5 .
+ set(PYTHON_LIMITED_API 1)
+ endif()
+ if(WIN32)
+ if (${PYTHON_VERSION_MAJOR} EQUAL 3 AND ${PYTHON_VERSION_MINOR} GREATER 4)
+ # PYSIDE-560: XXX maybe add an option to setup.py as override
+ set(SHIBOKEN_PYTHON_LIBRARIES ${PYTHON_LIMITED_LIBRARIES})
+ endif()
+ endif()
+ endif()
+endmacro()
+
+
+macro(shiboken_find_required_python)
+ if(${ARGC} GREATER 0)
+ find_package(PythonInterp ${ARGV0} REQUIRED)
+ find_package(PythonLibs ${ARGV0} REQUIRED)
+ else()
+ # If no version is specified, just use any interpreter that can be found (from PATH).
+ # This is useful for super-project builds, so that the default system interpeter
+ # gets picked up (e.g. /usr/bin/python and not /usr/bin/python2.7).
+ find_package(PythonInterp REQUIRED)
+ find_package(PythonLibs REQUIRED)
+ endif()
+ shiboken_validate_python_version()
+
+ set(SHIBOKEN_PYTHON_INTERPRETER "${PYTHON_EXECUTABLE}")
+ set_property(GLOBAL PROPERTY SHIBOKEN_PYTHON_INTERPRETER "${PYTHON_EXECUTABLE}")
+endmacro()
+
+macro(shiboken_validate_python_version)
+ if((PYTHON_VERSION_MAJOR EQUAL "2" AND PYTHON_VERSION_MINOR LESS "7") OR
+ (PYTHON_VERSION_MAJOR EQUAL "3" AND PYTHON_VERSION_MINOR LESS "5"))
+ message(FATAL_ERROR
+ "Shiboken requires Python 2.7+ or Python 3.5+.")
+ endif()
+endmacro()
+
+macro(shiboken_compute_python_includes)
+ shiboken_parse_all_arguments(
+ "SHIBOKEN_COMPUTE_INCLUDES" "shiboken_compute_python_includes"
+ "IS_CALLED_FROM_EXPORT" "" "" ${ARGN})
+
+
+ # If the installed shiboken config file is used,
+ # append the found Python include dirs as an interface property on the libshiboken target.
+ # This needs to be dynamic because the user of the library might have python installed
+ # in a different path than when shiboken was originally built.
+ # Otherwise if shiboken is currently being built itself (either as standalone, or super project
+ # build) append the include dirs as PUBLIC.
+ if (SHIBOKEN_COMPUTE_INCLUDES_IS_CALLED_FROM_EXPORT)
+ #TODO target_include_directories works on imported targets only starting with v3.11.0.
+ set_property(TARGET Shiboken2::libshiboken
+ APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${PYTHON_INCLUDE_DIRS})
+ else()
+ target_include_directories(libshiboken
+ PUBLIC $<BUILD_INTERFACE:${PYTHON_INCLUDE_DIRS}>)
+ endif()
+
+
+ set(SHIBOKEN_PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS}")
+ message(STATUS
+ "SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: '${SHIBOKEN_PYTHON_INCLUDE_DIRS}'")
+endmacro()
+
+# Given a list of the following form:
+# optimized;C:/Python36/libs/python36.lib;debug;C:/Python36/libs/python36_d.lib
+# choose the correpsonding library to use, based on the current configuration type.
+function(shiboken_get_library_for_current_config library_list current_config out_var)
+ list(FIND library_list "optimized" optimized_found)
+ list(FIND library_list "general" general_found)
+ list(FIND library_list "debug" debug_found)
+
+ if (optimized_found OR general_found OR debug_found)
+ # Iterate over library list to find the most appropriate library.
+ foreach(token ${library_list})
+ if(token STREQUAL "optimized" OR token STREQUAL "general")
+ set(is_debug 0)
+ set(token1 1)
+ set(lib "")
+ elseif(token STREQUAL "debug")
+ set(is_debug 1)
+ set(token1 1)
+ set(lib "")
+ elseif(EXISTS ${token})
+ set(lib ${token})
+ set(token2 1)
+ else()
+ set(token1 0)
+ set(token2 0)
+ set(lib "")
+ endif()
+
+ if(token1 AND token2)
+ if((is_debug AND lib AND current_config STREQUAL "Debug")
+ OR (NOT is_debug AND lib AND (NOT current_config STREQUAL "Debug")))
+ set(${out_var} ${lib} PARENT_SCOPE)
+ return()
+ endif()
+ endif()
+ endforeach()
+ else()
+ # No configuration specific libraries found, just set the original value.
+ set(${out_var} "${library_list}" PARENT_SCOPE)
+ endif()
+
+endfunction()
+
+macro(shiboken_compute_python_libraries)
+ shiboken_parse_all_arguments(
+ "SHIBOKEN_COMPUTE_LIBS" "shiboken_compute_python_libraries"
+ "IS_CALLED_FROM_EXPORT" "" "" ${ARGN})
+
+ if (NOT SHIBOKEN_PYTHON_LIBRARIES)
+ set(SHIBOKEN_PYTHON_LIBRARIES "")
+ endif()
+
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ if(WIN32 AND NOT SHIBOKEN_PYTHON_LIBRARIES)
+ set(SHIBOKEN_PYTHON_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
+ endif()
+ endif()
+
+ if(CMAKE_BUILD_TYPE STREQUAL "Release")
+ if(WIN32 AND NOT SHIBOKEN_PYTHON_LIBRARIES)
+ set(SHIBOKEN_PYTHON_LIBRARIES ${PYTHON_LIBRARIES})
+ endif()
+ endif()
+
+ # If the resulting variable
+ # contains a "debug;X;optimized;Y" list like described in shiboken_check_if_limited_api,
+ # make sure to pick just one, so that the final generator expressions are valid.
+ shiboken_get_library_for_current_config("${SHIBOKEN_PYTHON_LIBRARIES}" ${CMAKE_BUILD_TYPE} "SHIBOKEN_PYTHON_LIBRARIES")
+
+ if(APPLE)
+ set(SHIBOKEN_PYTHON_LIBRARIES "-undefined dynamic_lookup")
+ endif()
+
+ # If the installed shiboken config file is used,
+ # append the computed Python libraries as an interface property on the libshiboken target.
+ # This needs to be dynamic because the user of the library might have python installed
+ # in a different path than when shiboken was originally built.
+ # Otherwise if shiboken is currently being built itself (either as standalone, or super project
+ # build) append the libraries as PUBLIC.
+ if (SHIBOKEN_COMPUTE_LIBS_IS_CALLED_FROM_EXPORT)
+ #TODO target_link_libraries works on imported targets only starting with v3.11.0.
+ set_property(TARGET Shiboken2::libshiboken
+ APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${SHIBOKEN_PYTHON_LIBRARIES})
+ else()
+ target_link_libraries(libshiboken
+ PUBLIC $<BUILD_INTERFACE:${SHIBOKEN_PYTHON_LIBRARIES}>)
+ endif()
+
+ message(STATUS "SHIBOKEN_PYTHON_LIBRARIES computed to value: '${SHIBOKEN_PYTHON_LIBRARIES}'")
+endmacro()
+
+function(shiboken_check_if_built_and_target_python_are_compatible)
+ if(NOT SHIBOKEN_PYTHON_VERSION_MAJOR STREQUAL PYTHON_VERSION_MAJOR)
+ message(FATAL_ERROR "The detected Python major version is not \
+compatible with the Python major version which was used when Shiboken was built.
+Built with: '${SHIBOKEN_PYTHON_VERSION_MAJOR}.${SHIBOKEN_PYTHON_VERSION_MINOR}' \
+Detected: '${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}'")
+ else()
+ if(NOT SHIBOKEN_PYTHON_LIMITED_API
+ AND NOT SHIBOKEN_PYTHON_VERSION_MINOR STREQUAL PYTHON_VERSION_MINOR)
+ message(FATAL_ERROR
+ "The detected Python minor version is not compatible with the Python minor \
+version which was used when Shiboken was built. Consider building shiboken with \
+FORCE_LIMITED_API set to '1', so that only the Python major version matters.
+Built with: '${SHIBOKEN_PYTHON_VERSION_MAJOR}.${SHIBOKEN_PYTHON_VERSION_MINOR}' \
+Detected: '${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}'")
+ endif()
+ endif()
+endfunction()
diff --git a/sources/shiboken2/generator/CMakeLists.txt b/sources/shiboken2/generator/CMakeLists.txt
index fb8058b2d..943e8d19b 100644
--- a/sources/shiboken2/generator/CMakeLists.txt
+++ b/sources/shiboken2/generator/CMakeLists.txt
@@ -27,6 +27,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/shiboken2
)
add_executable(shiboken2 ${shiboken2_SRC})
+add_executable(Shiboken2::shiboken2 ALIAS shiboken2)
add_dependencies(shiboken2 apiextractor)
set_target_properties(shiboken2 PROPERTIES OUTPUT_NAME shiboken2${shiboken2_SUFFIX})
target_link_libraries(shiboken2
@@ -37,7 +38,9 @@ target_link_libraries(shiboken2
configure_file(shibokenconfig.h.in "${CMAKE_CURRENT_BINARY_DIR}/shibokenconfig.h" @ONLY)
-install(TARGETS shiboken2 DESTINATION bin)
+install(TARGETS shiboken2
+ EXPORT Shiboken2Targets
+ DESTINATION bin)
set(shiboken_generator_package_name "shiboken2_generator")
diff --git a/sources/shiboken2/libshiboken/CMakeLists.txt b/sources/shiboken2/libshiboken/CMakeLists.txt
index dd304bdca..79f83ec73 100644
--- a/sources/shiboken2/libshiboken/CMakeLists.txt
+++ b/sources/shiboken2/libshiboken/CMakeLists.txt
@@ -56,19 +56,49 @@ bufferprocs_py37.cpp
get_numpy_location()
-set(libshiboken_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${SBK_PYTHON_INCLUDE_DIR})
-
if (NOT "${PYTHON_NUMPY_LOCATION}" STREQUAL "")
- set(libshiboken_INCLUDES ${libshiboken_INCLUDES} ${PYTHON_NUMPY_LOCATION}/core/include)
- set(libshiboken_SRC ${libshiboken_SRC} sbknumpyarrayconverter.cpp)
- add_definitions(-DHAVE_NUMPY -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
+ list(APPEND libshiboken_SRC sbknumpyarrayconverter.cpp)
endif()
set(APIEXTRACTOR_EXTRA_INCLUDES ${APIEXTRACTOR_EXTRA_INCLUDES} ${LIBXSLT_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR})
-include_directories(${libshiboken_INCLUDES})
add_library(libshiboken SHARED ${libshiboken_SRC})
-target_link_libraries(libshiboken ${SBK_PYTHON_LIBRARIES})
+add_library(Shiboken2::libshiboken ALIAS libshiboken)
+
+target_include_directories(libshiboken PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
+ $<INSTALL_INTERFACE:include/shiboken2>
+)
+
+if (NOT "${PYTHON_NUMPY_LOCATION}" STREQUAL "")
+ target_include_directories(libshiboken PRIVATE ${PYTHON_NUMPY_LOCATION}/core/include)
+ target_compile_definitions(libshiboken PRIVATE -DHAVE_NUMPY
+ PRIVATE -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION)
+
+endif()
+
+shiboken_compute_python_includes()
+# On Windows we need to link against the python.lib import library.
+# On macOS and Linux we don't link against the python shared / static library,
+# the dynamic linker will pick up the python symbols at runtime automatically.
+shiboken_compute_python_libraries()
+
+if(PYTHON_LIMITED_API)
+ target_compile_definitions(libshiboken PUBLIC "-DPy_LIMITED_API=0x03050000")
+endif()
+
+if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ if(PYTHON_WITH_DEBUG)
+ target_compile_definitions(libshiboken PUBLIC "-DPy_DEBUG")
+ endif()
+ if (PYTHON_WITH_COUNT_ALLOCS)
+ target_compile_definitions(libshiboken PUBLIC "-DCOUNT_ALLOCS")
+ endif()
+elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
+ target_compile_definitions(libshiboken PUBLIC "-DNDEBUG")
+endif()
+
set_target_properties(libshiboken PROPERTIES OUTPUT_NAME "shiboken2${shiboken2_SUFFIX}${PYTHON_SHARED_LIBRARY_SUFFIX}"
VERSION ${libshiboken_VERSION}
SOVERSION ${libshiboken_SOVERSION}
@@ -100,7 +130,9 @@ install(FILES
bufferprocs_py37.h
"${CMAKE_CURRENT_BINARY_DIR}/sbkversion.h"
DESTINATION include/shiboken2${shiboken2_SUFFIX})
-install(TARGETS libshiboken EXPORT shiboken2
+install(TARGETS libshiboken EXPORT Shiboken2Targets
LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
ARCHIVE DESTINATION "${LIB_INSTALL_DIR}"
RUNTIME DESTINATION bin)
+install(EXPORT Shiboken2Targets NAMESPACE Shiboken2::
+ DESTINATION ${LIB_INSTALL_DIR}/cmake/Shiboken2-${shiboken2_VERSION})
diff --git a/sources/shiboken2/shibokenmodule/CMakeLists.txt b/sources/shiboken2/shibokenmodule/CMakeLists.txt
index 373ce102f..b37d0c941 100644
--- a/sources/shiboken2/shibokenmodule/CMakeLists.txt
+++ b/sources/shiboken2/shibokenmodule/CMakeLists.txt
@@ -26,7 +26,6 @@ COMMENT "Running generator for 'shiboken2'..."
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}
- ${SBK_PYTHON_INCLUDE_DIR}
${libshiboken_SOURCE_DIR}
${libshiboken_BINARY_DIR})
add_library(shibokenmodule MODULE ${sample_SRC})
@@ -37,7 +36,6 @@ if(WIN32)
set_property(TARGET shibokenmodule PROPERTY SUFFIX ".pyd")
endif()
target_link_libraries(shibokenmodule
- ${SBK_PYTHON_LIBRARIES}
libshiboken)
add_dependencies(shibokenmodule shiboken2)
diff --git a/sources/shiboken2/tests/minimalbinding/CMakeLists.txt b/sources/shiboken2/tests/minimalbinding/CMakeLists.txt
index ec674b56b..7301e1882 100644
--- a/sources/shiboken2/tests/minimalbinding/CMakeLists.txt
+++ b/sources/shiboken2/tests/minimalbinding/CMakeLists.txt
@@ -26,7 +26,6 @@ COMMENT "Running generator for 'minimal' test binding..."
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}
- ${SBK_PYTHON_INCLUDE_DIR}
${libminimal_SOURCE_DIR}
${libshiboken_SOURCE_DIR}
${libshiboken_BINARY_DIR})
@@ -38,6 +37,5 @@ if(WIN32)
endif()
target_link_libraries(minimal
libminimal
- ${SBK_PYTHON_LIBRARIES}
libshiboken)
create_generator_target(minimal)
diff --git a/sources/shiboken2/tests/otherbinding/CMakeLists.txt b/sources/shiboken2/tests/otherbinding/CMakeLists.txt
index 0be66f797..44855e297 100644
--- a/sources/shiboken2/tests/otherbinding/CMakeLists.txt
+++ b/sources/shiboken2/tests/otherbinding/CMakeLists.txt
@@ -28,7 +28,6 @@ COMMENT "Running generator for 'other' test binding..."
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}
- ${SBK_PYTHON_INCLUDE_DIR}
${libother_SOURCE_DIR}
${libsample_SOURCE_DIR}
${libsample_SOURCE_DIR}/..
@@ -46,7 +45,6 @@ endif()
target_link_libraries(other
libother
libsample
- ${SBK_PYTHON_LIBRARIES}
libshiboken)
add_dependencies(other sample)
diff --git a/sources/shiboken2/tests/samplebinding/CMakeLists.txt b/sources/shiboken2/tests/samplebinding/CMakeLists.txt
index 7f4bec5f4..9ecbd98e6 100644
--- a/sources/shiboken2/tests/samplebinding/CMakeLists.txt
+++ b/sources/shiboken2/tests/samplebinding/CMakeLists.txt
@@ -139,7 +139,6 @@ COMMENT "Running generator for 'sample' test binding..."
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}
- ${SBK_PYTHON_INCLUDE_DIR}
${libsample_SOURCE_DIR}
${libshiboken_SOURCE_DIR}
${libshiboken_BINARY_DIR})
@@ -152,6 +151,5 @@ if(WIN32)
endif()
target_link_libraries(sample
libsample
- ${SBK_PYTHON_LIBRARIES}
libshiboken)
create_generator_target(sample)
diff --git a/sources/shiboken2/tests/smartbinding/CMakeLists.txt b/sources/shiboken2/tests/smartbinding/CMakeLists.txt
index 43888fae2..0fb7de825 100644
--- a/sources/shiboken2/tests/smartbinding/CMakeLists.txt
+++ b/sources/shiboken2/tests/smartbinding/CMakeLists.txt
@@ -27,7 +27,6 @@ COMMENT "Running generator for 'smart' test binding..."
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}
- ${SBK_PYTHON_INCLUDE_DIR}
${libsmart_SOURCE_DIR}
${libshiboken_SOURCE_DIR}
${libshiboken_BINARY_DIR})
@@ -40,6 +39,5 @@ if(WIN32)
endif()
target_link_libraries(smart
libsmart
- ${SBK_PYTHON_LIBRARIES}
libshiboken)
create_generator_target(smart)