From 4275cfc3f75d784398034dcc5e096c375dba6c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Fri, 17 Aug 2018 21:02:23 +0200 Subject: Bindings: Check if bindings can be generated for a specific python version Summary: The generated C++ sources include , 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 --- find-modules/FindPythonModuleGeneration.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'find-modules/FindPythonModuleGeneration.cmake') 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" -- cgit v1.2.1