[CMakeModules] search for v3.1+ PythonQT

This commit is contained in:
Philip 2017-06-18 21:21:37 +02:00
parent 971a77bdcd
commit 9817dba3af
2 changed files with 49 additions and 8 deletions

View File

@ -96,7 +96,7 @@ if ( PYTHONLIBS_FOUND )
"PythonQt" "PythonQt"
"A Python embedding solution for Qt applications." "A Python embedding solution for Qt applications."
"http://pythonqt.sourceforge.net" "http://pythonqt.sourceforge.net"
FALSE "3.2" FALSE "3.1"
"PythonQt is used for the Python modules API." "PythonQt is used for the Python modules API."
) )
endif() endif()

View File

@ -21,13 +21,20 @@ find_path(PYTHONQT_INCLUDE_DIR PythonQt.h
PATHS "${PYTHONQT_INSTALL_DIR}/include/PythonQt" PATHS "${PYTHONQT_INSTALL_DIR}/include/PythonQt"
"${PYTHONQT_INSTALL_DIR}/src" "${PYTHONQT_INSTALL_DIR}/src"
DOC "Path to the PythonQt include directory") DOC "Path to the PythonQt include directory")
find_library(PYTHONQT_LIBRARY_RELEASE PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.") # Minimum v3.1 is needed
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.") find_library(PYTHONQT_LIBRARY_RELEASE PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG NAMES PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.") find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt${CTK_CMAKE_DEBUG_POSTFIX} PythonQt${CMAKE_DEBUG_POSTFIX} PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE PythonQt_QtAll PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG NAMES PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
# Also check for v3.2+
find_library(PYTHONQT_LIBRARY_V32_RELEASE PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_LIBRARY_V32_DEBUG NAMES PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_V32_RELEASE PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_V32_DEBUG NAMES PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
set(PYTHONQT_LIBRARY) set(PYTHONQT_LIBRARY)
if(PYTHONQT_LIBRARY_RELEASE) if(PYTHONQT_LIBRARY_RELEASE)
list(APPEND PYTHONQT_LIBRARY optimized ${PYTHONQT_LIBRARY_RELEASE}) list(APPEND PYTHONQT_LIBRARY optimized ${PYTHONQT_LIBRARY_RELEASE})
endif() endif()
@ -35,6 +42,14 @@ if(PYTHONQT_LIBRARY_DEBUG)
list(APPEND PYTHONQT_LIBRARY debug ${PYTHONQT_LIBRARY_DEBUG}) list(APPEND PYTHONQT_LIBRARY debug ${PYTHONQT_LIBRARY_DEBUG})
endif() endif()
set(PYTHONQT_LIBRARY_V32)
if(PYTHONQT_LIBRARY_V32_RELEASE)
list(APPEND PYTHONQT_LIBRARY_V32 optimized ${PYTHONQT_LIBRARY_V32_RELEASE})
endif()
if(PYTHONQT_LIBRARY_V32_DEBUG)
list(APPEND PYTHONQT_LIBRARY_V32 debug ${PYTHONQT_LIBRARY_V32_DEBUG})
endif()
set(PYTHONQT_QTALL_LIBRARY) set(PYTHONQT_QTALL_LIBRARY)
if(PYTHONQT_QTALL_LIBRARY_RELEASE) if(PYTHONQT_QTALL_LIBRARY_RELEASE)
list(APPEND PYTHONQT_QTALL_LIBRARY optimized ${PYTHONQT_QTALL_LIBRARY_RELEASE}) list(APPEND PYTHONQT_QTALL_LIBRARY optimized ${PYTHONQT_QTALL_LIBRARY_RELEASE})
@ -43,12 +58,24 @@ if(PYTHONQT_QTALL_LIBRARY_DEBUG)
list(APPEND PYTHONQT_QTALL_LIBRARY debug ${PYTHONQT_QTALL_LIBRARY_DEBUG}) list(APPEND PYTHONQT_QTALL_LIBRARY debug ${PYTHONQT_QTALL_LIBRARY_DEBUG})
endif() endif()
set(PYTHONQT_QTALL_LIBRARY_V32)
if(PYTHONQT_QTALL_LIBRARY_RELEASE)
list(APPEND PYTHONQT_QTALL_LIBRARY_V32 optimized ${PYTHONQT_QTALL_LIBRARY_V32_RELEASE})
endif()
if(PYTHONQT_QTALL_LIBRARY_V32_DEBUG)
list(APPEND PYTHONQT_QTALL_LIBRARY_V32 debug ${PYTHONQT_QTALL_LIBRARY_V32_DEBUG})
endif()
mark_as_advanced(PYTHONQT_INSTALL_DIR) mark_as_advanced(PYTHONQT_INSTALL_DIR)
mark_as_advanced(PYTHONQT_INCLUDE_DIR) mark_as_advanced(PYTHONQT_INCLUDE_DIR)
mark_as_advanced(PYTHONQT_LIBRARY_RELEASE) mark_as_advanced(PYTHONQT_LIBRARY_RELEASE)
mark_as_advanced(PYTHONQT_LIBRARY_DEBUG) mark_as_advanced(PYTHONQT_LIBRARY_DEBUG)
mark_as_advanced(PYTHONQT_QTALL_LIBRARY_RELEASE) mark_as_advanced(PYTHONQT_QTALL_LIBRARY_RELEASE)
mark_as_advanced(PYTHONQT_QTALL_LIBRARY_DEBUG) mark_as_advanced(PYTHONQT_QTALL_LIBRARY_DEBUG)
mark_as_advanced(PYTHONQT_LIBRARY_V32_RELEASE)
mark_as_advanced(PYTHONQT_LIBRARY_V32_DEBUG)
mark_as_advanced(PYTHONQT_QTALL_LIBRARY_V32_RELEASE)
mark_as_advanced(PYTHONQT_QTALL_LIBRARY_V32_DEBUG)
# On linux, also find libutil # On linux, also find libutil
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
@ -59,11 +86,25 @@ endif()
# All upper case _FOUND variable is maintained for backwards compatibility. # All upper case _FOUND variable is maintained for backwards compatibility.
set(PYTHONQT_FOUND 0) set(PYTHONQT_FOUND 0)
set(PythonQt_FOUND 0) set(PythonQt_FOUND 0)
if(PYTHONQT_INCLUDE_DIR AND PYTHONQT_LIBRARY AND PYTHONQT_QTALL_LIBRARY)
if(PYTHONQT_LIBRARY AND PYTHONQT_QTALL_LIBRARY)
set(PYTHONQT_LIB)
endif()
if(PYTHONQT_LIBRARY_V32 AND PYTHONQT_QTALL_LIBRARY_V32)
set(PYTHONQT_LIB)
set(PYTHONQT_LIB_V32)
endif()
if(PYTHONQT_INCLUDE_DIR AND PYTHONQT_LIB)
# Currently CMake'ified PythonQt only supports building against a python Release build. # Currently CMake'ified PythonQt only supports building against a python Release build.
# This applies independently of CTK build type (Release, Debug, ...) # This applies independently of CTK build type (Release, Debug, ...)
add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK) add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK)
set(PYTHONQT_FOUND 1) set(PYTHONQT_FOUND 1)
set(PythonQt_FOUND ${PYTHONQT_FOUND}) set(PythonQt_FOUND ${PYTHONQT_FOUND})
set(PYTHONQT_LIBRARIES ${PYTHONQT_LIBRARY} ${PYTHONQT_LIBUTIL} ${PYTHONQT_QTALL_LIBRARY}) if(PYTHONQT_LIB_V32)
set(PYTHONQT_LIBRARIES ${PYTHONQT_LIBRARY_V32} ${PYTHONQT_LIBUTIL} ${PYTHONQT_QTALL_LIBRARY_V32})
else
set(PYTHONQT_LIBRARIES ${PYTHONQT_LIBRARY} ${PYTHONQT_LIBUTIL} ${PYTHONQT_QTALL_LIBRARY})
endif()
endif() endif()