diff options
author | Stefan Brüns <stefan.bruens@rwth-aachen.de> | 2018-08-17 21:02:23 +0200 |
---|---|---|
committer | Stefan Brüns <stefan.bruens@rwth-aachen.de> | 2018-08-31 23:45:30 +0200 |
commit | 4275cfc3f75d784398034dcc5e096c375dba6c2b (patch) | |
tree | 77b45e2a591692ed33a4167c1ee86126736bdfe6 /find-modules/FindPythonModuleGeneration.cmake | |
parent | 451bc7609c2d6380599c71e371ccb7b183abef8c (diff) | |
download | extra-cmake-modules-4275cfc3f75d784398034dcc5e096c375dba6c2b.tar.gz extra-cmake-modules-4275cfc3f75d784398034dcc5e096c375dba6c2b.tar.bz2 |
Bindings: Check if bindings can be generated for a specific python version
Summary:
The generated C++ sources include <sip.h>, so it must be available.
Check for it in the version specific directories and fall back to
the default include directories.
Test Plan:
install python2-devel and python3-devel
install one of python{x}-sip-devel
bindings should be generated for the matching python version.
Reviewers: #frameworks, arojas
Reviewed By: arojas
Subscribers: arojas, kde-frameworks-devel, kde-buildsystem
Tags: #frameworks, #build_system
Differential Revision: https://phabricator.kde.org/D14915
Diffstat (limited to 'find-modules/FindPythonModuleGeneration.cmake')
-rw-r--r-- | find-modules/FindPythonModuleGeneration.cmake | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/find-modules/FindPythonModuleGeneration.cmake b/find-modules/FindPythonModuleGeneration.cmake index 8688787f..0468f9d8 100644 --- a/find-modules/FindPythonModuleGeneration.cmake +++ b/find-modules/FindPythonModuleGeneration.cmake @@ -100,13 +100,22 @@ macro(_find_python version minor_version) python${_CURRENT_VERSION}u python${_CURRENT_VERSION} ) + # sip.h is version agnostic, it may be located in the version specific path + # or one of the default locations + find_path(GPB_PYTHON${version}_SIP_DIR + NAMES sip.h + PATHS + ${GPB_PYTHON${version}_INCLUDE_DIR} + ) endif() find_program(GPB_PYTHON${version}_COMMAND python${version}) endmacro() macro(_create_imported_python_target version) - if(GPB_PYTHON${version}_LIBRARY AND GPB_PYTHON${version}_INCLUDE_DIR AND EXISTS "${GPB_PYTHON${version}_INCLUDE_DIR}/patchlevel.h") + if(GPB_PYTHON${version}_LIBRARY AND GPB_PYTHON${version}_INCLUDE_DIR AND + EXISTS "${GPB_PYTHON${version}_INCLUDE_DIR}/patchlevel.h" AND + EXISTS "${GPB_PYTHON${version}_SIP_DIR}/sip.h") list(APPEND _pyversions ${version}) file(STRINGS "${GPB_PYTHON${version}_INCLUDE_DIR}/patchlevel.h" python_version_define @@ -434,6 +443,7 @@ headers = sipAPI${modulename_value} "${CMAKE_CURRENT_BINARY_DIR}/pybuild/${pythonnamespace_value}/${modulename_value}") foreach(pyversion ${_pyversions}) + message(STATUS "Found dependencies for python${pyversion}, generating bindings") execute_process(COMMAND "${CMAKE_COMMAND}" "-DPYTHON_UMBRELLA_MODULE_FILE=${CMAKE_BINARY_DIR}/py${pyversion}/${pythonnamespace_value}/__init__.py" |