Check shiboken2's python version matches python version we're linking to

* We also reverse Python_ADDITIONAL_VERSIONS so it finds the newest one. It
  doesn't seem like there's a way in general to make these match, so we hope
  that searching from newest to oldest will find the same in both - or at least
  it makes it easier for the user to fix by installing the newest in both.
This commit is contained in:
baldurk
2020-09-01 17:39:05 +01:00
parent 3b9b0d8887
commit 55febc88c4
2 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -390,7 +390,7 @@ add_subdirectory(renderdoc)
# are handled in common
if(ENABLE_QRENDERDOC OR ENABLE_PYRENDERDOC)
# Make sure Python 3 is found
set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7 3.8)
set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6 3.5 3.4)
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
# we also need python3-config for swig
+9 -1
View File
@@ -215,9 +215,17 @@ if(NOT BUILD_VERSION_DIST_CONTACT STREQUAL "")
"DEFINES+=DISTRIBUTION_CONTACT='\\\\\"${BUILD_VERSION_DIST_CONTACT}\\\\\"'\n")
endif()
if(PySide2_FOUND AND Shiboken2_FOUND)
option(QRENDERDOC_ENABLE_PYSIDE2 "Enable PySide2 if found" ON)
if(NOT QRENDERDOC_ENABLE_PYSIDE2)
message(STATUS "PySide2 integration disabled")
elseif(PySide2_FOUND AND Shiboken2_FOUND)
message(STATUS "Building with PySide2 ${PySide2_VERSION} from ${PySide2_DIR}")
if(NOT PYTHONLIBS_VERSION_STRING MATCHES "${SHIBOKEN_PYTHON_VERSION_MAJOR}.${SHIBOKEN_PYTHON_VERSION_MINOR}")
message(FATAL_ERROR "Shiboken2 that we found was linked against python ${SHIBOKEN_PYTHON_VERSION_MAJOR}.${SHIBOKEN_PYTHON_VERSION_MINOR} but the python library we're linking against is ${PYTHONLIBS_VERSION_STRING}. Ensure these versions are identical or disable PySide2 compilation with QRENDERDOC_ENABLE_PYSIDE2.")
endif()
get_target_property(SHIBOKEN2_INCLUDE_DIRS Shiboken2::libshiboken INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(PYSIDE2_INCLUDE_DIRS PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES)