From 636f36126863dd5696eff420455a7262a4fc72f1 Mon Sep 17 00:00:00 2001 From: triplus Date: Mon, 8 Jan 2018 21:38:38 +0100 Subject: [PATCH] Qt5 build related improvements Addition of PYTHON_SUFFIX and PYTHON_BASENAME available in all build scenarios offers more control when compiling (Py2/Py3/Qt5). Using symlinks as a workaround is not needed anymore. Forum discussion: https://forum.freecadweb.org/viewtopic.php?f=10&t=12534&p=208323#p208323 --- CMakeLists.txt | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7041f3ec9..7b9bdf9f7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -921,8 +921,15 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(BUILD_QT5) # set(PYTHON_SUFFIX -python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) - SET(PYTHON_SUFFIX -python2.7) # for shiboken - SET(PYTHON_BASENAME -python2.7) # for PySide + # Below are two variables that can be left empty for standard python 3 version, + # but must be set by the user for different python versions such as 2.7, 3.5 ... + if (PYTHON_VERSION_MAJOR LESS 3) + SET(PYTHON_SUFFIX -python2.7 CACHE STRING "Shiboken cmake file suffix. If left empty, system default will be used: ") + SET(PYTHON_BASENAME -python2.7 CACHE STRING "Same as PYTHON_SUFFIX but for PySide. If left empty, PYTHON_SUFFIX will be used: ") + else() + SET(PYTHON_SUFFIX "" CACHE STRING "Shiboken cmake file suffix. If left empty, system default will be used: ") + SET(PYTHON_BASENAME "" CACHE STRING "Same as PYTHON_SUFFIX but for PySide. If left empty, PYTHON_SUFFIX will be used: ") + endif() if(DEFINED MACPORTS_PREFIX) find_package(Shiboken REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake") @@ -973,15 +980,17 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ) endif() else() - if (PYTHON_VERSION_MAJOR LESS 3) - SET(PYTHON_SUFFIX -python2.7) - SET(PYTHON_BASENAME -python2.7) - else(PYTHON_VERSION_MAJOR LESS 3) # set(PYTHON_SUFFIX -python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) - # below are two variables that can be left empty for standard python, but must be set by the user for different python versions such as 3.5 - SET(PYTHON_SUFFIX "" CACHE STRING "Shiboken cmake file suffix. If left empty, system default python version will be used: ") - SET(PYTHON_BASENAME "" CACHE STRING "Same as PYTHON_SUFFIX but for PySide. if left empty, PYTHON_SUFFIX will be used: ") - endif(PYTHON_VERSION_MAJOR LESS 3) + # Below are two variables that can be left empty for standard python 3 version, + # but must be set by the user for different python versions such as 2.7, 3.5 ... + if (PYTHON_VERSION_MAJOR LESS 3) + SET(PYTHON_SUFFIX -python2.7 CACHE STRING "Shiboken cmake file suffix. If left empty, system default will be used: ") + SET(PYTHON_BASENAME -python2.7 CACHE STRING "Same as PYTHON_SUFFIX but for PySide. If left empty, PYTHON_SUFFIX will be used: ") + else() + SET(PYTHON_SUFFIX "" CACHE STRING "Shiboken cmake file suffix. If left empty, system default will be used: ") + SET(PYTHON_BASENAME "" CACHE STRING "Same as PYTHON_SUFFIX but for PySide. If left empty, PYTHON_SUFFIX will be used: ") + endif() + if(DEFINED MACPORTS_PREFIX) find_package(Shiboken REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake") find_package(PySide REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake")