diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b177362e649..b90d876f7fb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -# april 2020, the oldest we have to support : Ununtu 16.04 LTS (Xenial) -cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR) +# March 2021, the oldest we have to support : Ununtu 18.04 LTS +cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) # policy CMP0072 was introduced with CMake 3.11 # relates to FindOpenGL module @@ -17,8 +17,8 @@ project(FreeCAD) set(PACKAGE_VERSION_NAME "Vulcan") set(PACKAGE_VERSION_MAJOR "0") -set(PACKAGE_VERSION_MINOR "19") -set(PACKAGE_VERSION_PATCH "16100") +set(PACKAGE_VERSION_MINOR "20") +set(PACKAGE_VERSION_PATCH "0") set(PACKAGE_VERSION_SUFFIX "dev") # either "dev" for development snapshot or "" (empty string) set(FREECAD_VERSION_PATCH "0") # number of patch release (e.g. "4" for the 0.18.4 release) diff --git a/cMake/FindPySideTools.cmake b/cMake/FindPySideTools.cmake deleted file mode 100644 index ca1d4fe05391..000000000000 --- a/cMake/FindPySideTools.cmake +++ /dev/null @@ -1,101 +0,0 @@ -# Try to find PySide utilities, PYSIDEUIC4 and PYSIDERCC4: -# PYSIDEUIC4BINARY - Location of PYSIDEUIC4 executable -# PYSIDERCC4BINARY - Location of PYSIDERCC4 executable -# PYSIDE_TOOLS_FOUND - PySide utilities found. - -# Also provides macro similar to FindQt4.cmake's WRAP_UI and WRAP_RC, -# for the automatic generation of Python code from Qt4's user interface -# ('.ui') and resource ('.qrc') files. These macros are called: -# - PYSIDE_WRAP_UI -# - PYSIDE_WRAP_RC - -IF(PYSIDEUIC4BINARY AND PYSIDERCC4BINARY) - # Already in cache, be silent - set(PYSIDE_TOOLS_FOUND_QUIETLY TRUE) -ENDIF(PYSIDEUIC4BINARY AND PYSIDERCC4BINARY) - -if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - #pyside tools are often in same location as python interpreter - get_filename_component(PYTHON_BIN_DIR ${PYTHON_EXECUTABLE} PATH) - set(PYSIDE_BIN_DIR ${PYTHON_BIN_DIR}) -endif(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - -FIND_PROGRAM(PYSIDEUIC4BINARY NAMES python2-pyside-uic pyside-uic pyside-uic-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} HINTS ${PYSIDE_BIN_DIR}) -FIND_PROGRAM(PYSIDERCC4BINARY NAMES pyside-rcc pyside-rcc-${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} HINTS ${PYSIDE_BIN_DIR}) - -MACRO(PYSIDE_WRAP_UI outfiles) - FOREACH(it ${ARGN}) - GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) - GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) - SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.py) - #ADD_CUSTOM_TARGET(${it} ALL - # DEPENDS ${outfile} - #) - if(WIN32) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${PYSIDEUIC4BINARY} ${infile} -o ${outfile} - MAIN_DEPENDENCY ${infile} - ) - else(WIN32) - # Especially on Open Build Service we don't want changing date like - # pyside-uic generates in comments at beginning, which is why - # we follow the tool command with in-place sed. - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND "${PYSIDEUIC4BINARY}" "${infile}" -o "${outfile}" - COMMAND sed -i "/^# /d" "${outfile}" - MAIN_DEPENDENCY "${infile}" - ) - endif(WIN32) - list(APPEND ${outfiles} ${outfile}) - ENDFOREACH(it) -ENDMACRO (PYSIDE_WRAP_UI) - -MACRO(PYSIDE_WRAP_RC outfiles) - FOREACH(it ${ARGN}) - GET_FILENAME_COMPONENT(outfile ${it} NAME_WE) - GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE) - SET(outfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}_rc.py") - #ADD_CUSTOM_TARGET(${it} ALL - # DEPENDS ${outfile} - #) - if (${PYTHON_VERSION_MAJOR} LESS 3) - SET(PY_ATTRIBUTE "") - else (${PYTHON_VERSION_MAJOR} LESS 3) - SET(PY_ATTRIBUTE "-py3") - endif (${PYTHON_VERSION_MAJOR} LESS 3) - if(WIN32) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${PYSIDERCC4BINARY} ${infile} ${PY_ATTRIBUTE} -o ${outfile} - MAIN_DEPENDENCY ${infile} - ) - else(WIN32) - # Especially on Open Build Service we don't want changing date like - # pyside-rcc generates in comments at beginning, which is why - # we follow the tool command with in-place sed. - ADD_CUSTOM_COMMAND(OUTPUT "${outfile}" - COMMAND "${PYSIDERCC4BINARY}" "${infile}" ${PY_ATTRIBUTE} -o "${outfile}" - COMMAND sed -i "/^# /d" "${outfile}" - MAIN_DEPENDENCY "${infile}" - ) - endif(WIN32) - list(APPEND ${outfiles} ${outfile}) - ENDFOREACH(it) -ENDMACRO (PYSIDE_WRAP_RC) - -IF(EXISTS ${PYSIDEUIC4BINARY} AND EXISTS ${PYSIDERCC4BINARY}) - set(PYSIDE_TOOLS_FOUND TRUE) -ENDIF(EXISTS ${PYSIDEUIC4BINARY} AND EXISTS ${PYSIDERCC4BINARY}) - -if(PYSIDERCC4BINARY AND PYSIDEUIC4BINARY) - if (NOT PySideTools_FIND_QUIETLY) - message(STATUS "Found PySide Tools: ${PYSIDEUIC4BINARY}, ${PYSIDERCC4BINARY}") - endif (NOT PySideTools_FIND_QUIETLY) -else(PYSIDERCC4BINARY AND PYSIDEUIC4BINARY) - if(PySideTools_FIND_REQUIRED) - message(FATAL_ERROR "PySideTools could not be found, but are required.") - else(PySideTools_FIND_REQUIRED) - if (NOT PySideTools_FIND_QUIETLY) - message(STATUS "PySideTools: not found.") - endif (NOT PySideTools_FIND_QUIETLY) - endif(PySideTools_FIND_REQUIRED) -endif(PYSIDERCC4BINARY AND PYSIDEUIC4BINARY) diff --git a/cMake/FindWix.cmake b/cMake/FindWix.cmake deleted file mode 100644 index cd022909df08..000000000000 --- a/cMake/FindWix.cmake +++ /dev/null @@ -1,164 +0,0 @@ -# - Try to find Windows Installer XML -# See http://wix.sourceforge.net -# -# The following variables are optionally searched for defaults -# WIX_ROOT_DIR: Base directory of WIX2 tree to use. -# -# The following are set after configuration is done: -# WIX_FOUND -# WIX_ROOT_DIR -# WIX_CANDLE -# WIX_LIGHT -# -# 2009/02 Petr Pytelka (pyta at lightcomp.cz) -# - -MACRO(DBG_MSG _MSG) -# MESSAGE(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}):\n ${_MSG}") -ENDMACRO(DBG_MSG) - - -# typical root dirs of installations, exactly one of them is used -SET (WIX_POSSIBLE_ROOT_DIRS - "${WIX_ROOT_DIR}" - "$ENV{WIX_ROOT_DIR}" - "$ENV{ProgramFiles}/Windows Installer XML" - ) - - -#DBG_MSG("DBG (WIX_POSSIBLE_ROOT_DIRS=${WIX_POSSIBLE_ROOT_DIRS}") - -# -# select exactly ONE WIX base directory/tree -# to avoid mixing different version headers and libs -# -FIND_PATH(WIX_ROOT_DIR - NAMES - bin/candle.exe - bin/light.exe - PATHS ${WIX_POSSIBLE_ROOT_DIRS}) -DBG_MSG("WIX_ROOT_DIR=${WIX_ROOT_DIR}") - - -# -# Logic selecting required libs and headers -# -SET(WIX_FOUND OFF) -IF(WIX_ROOT_DIR) - SET(WIX_FOUND ON) -ENDIF(WIX_ROOT_DIR) - - -# display help message -IF(NOT WIX_FOUND) - # make FIND_PACKAGE friendly - IF(NOT WIX_FIND_QUIETLY) - IF(WIX_FIND_REQUIRED) - MESSAGE(FATAL_ERROR - "Windows Installer XML required but some files not found. Please specify it's location with WIX_ROOT_DIR env. variable.") - ELSE(WIX_FIND_REQUIRED) - MESSAGE(STATUS - "ERROR: Windows Installer XML was not found.") - ENDIF(WIX_FIND_REQUIRED) - ENDIF(NOT WIX_FIND_QUIETLY) -ELSE(NOT WIX_FOUND) - SET(WIX_CANDLE ${WIX_ROOT_DIR}/bin/candle.exe) - SET(WIX_LIGHT ${WIX_ROOT_DIR}/bin/light.exe) -# MESSAGE(STATUS "Windows Installer XML found.") -ENDIF(NOT WIX_FOUND) - - -MARK_AS_ADVANCED( - WIX_ROOT_DIR - WIX_CANDLE - WIX_LIGHT - ) - -# -# Call wix compiler -# -# Parameters: -# _sources - name of list with sources -# _obj - name of list for target objects -# -MACRO(WIX_COMPILE _sources _objs _extra_dep) - DBG_MSG("WIX compile: ${${_sources}}") - FOREACH (_current_FILE ${${_sources}}) - GET_FILENAME_COMPONENT(_tmp_FILE ${_current_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_basename ${_tmp_FILE} NAME_WE) - - SET (SOURCE_WIX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${_current_FILE} ) - DBG_MSG("WIX source file: ${SOURCE_WIX_FILE}") - - # Check whether source exists - IF(EXISTS ${SOURCE_WIX_FILE}) - ELSE(EXISTS ${SOURCE_WIX_FILE}) - MESSAGE(FATAL_ERROR "Path not exists: ${SOURCE_WIX_FILE}") - ENDIF(EXISTS ${SOURCE_WIX_FILE}) - - SET (OUTPUT_WIXOBJ ${_basename}.wixobj ) - - DBG_MSG("WIX output: ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_WIXOBJ}") - DBG_MSG("WIX command: ${WIX_CANDLE}") - - ADD_CUSTOM_COMMAND( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_WIXOBJ} - COMMAND ${WIX_CANDLE} - ARGS ${WIX_CANDLE_FLAGS} ${SOURCE_WIX_FILE} - DEPENDS ${SOURCE_WIX_FILE} ${${_extra_dep}} - COMMENT "Compiling ${SOURCE_WIX_FILE} -> ${OUTPUT_WIXOBJ}" - ) - SET(${_objs} ${${_objs}} ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_WIXOBJ} ) - DBG_MSG("WIX compile output: ${${_objs}}") - - ENDFOREACH (_current_FILE) -ENDMACRO(WIX_COMPILE) - -# -# Call wix compiler -# -# Parameters: -# _sources - name of list with sources -# _obj - name of list for target objects -# -MACRO(WIX_COMPILE_ALL _target _sources _extra_dep) - DBG_MSG("WIX compile all: ${${_sources}}, dependencies: ${${_extra_dep}}") - - ADD_CUSTOM_COMMAND( - OUTPUT ${_target} - COMMAND ${WIX_CANDLE} - ARGS ${WIX_CANDLE_FLAGS} -out "${_target}" ${${_sources}} - DEPENDS ${${_sources}} ${${_extra_dep}} - COMMENT "Compiling ${${_sources}} -> ${_target}" - ) - -ENDMACRO(WIX_COMPILE_ALL) - - -# -# Link MSI file -# -# Parameters -# _target - Name of target file -# _sources - Name of list with sources -# -MACRO(WIX_LINK _target _sources _loc_files) - DBG_MSG("WIX command: ${WIX_LIGHT}\n WIX target: ${_target} objs: ${${_sources}}") - - SET( WIX_LINK_FLAGS_A "" ) - # Add localization - FOREACH (_current_FILE ${${_loc_files}}) - SET( WIX_LINK_FLAGS_A ${WIX_LINK_FLAGS_A} -loc "${_current_FILE}" ) - DBG_MSG("WIX link localization: ${_current_FILE}") - ENDFOREACH (_current_FILE) - DBG_MSG("WIX link flags: ${WIX_LINK_FLAGS_A}") - - ADD_CUSTOM_COMMAND( - OUTPUT ${_target} - COMMAND ${WIX_LIGHT} - ARGS ${WIX_LINK_FLAGS_A} -out "${_target}" ${${_sources}} - DEPENDS ${${_sources}} - COMMENT "Linking ${${_sources}} -> ${_target}" - ) - -ENDMACRO(WIX_LINK) diff --git a/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake b/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake index 55370ed8837a..d0641b2284b1 100644 --- a/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake +++ b/cMake/FreeCAD_Helpers/CompilerChecksAndSetups.cmake @@ -28,22 +28,18 @@ macro(CompilerChecksAndSetups) OUTPUT_VARIABLE CMAKE_CXX_COMPILER_VERSION) endif(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION) - # Enabled C++11 for Freecad 0.17 and later - if (FREECAD_VERSION VERSION_GREATER 0.16) - set(BUILD_ENABLE_CXX_STD "C++11" CACHE STRING "Enable C++ standard") + # Enabled C++17 for Freecad 0.20 and later + set(BUILD_ENABLE_CXX_STD "C++17" CACHE STRING "Enable C++ standard") set_property(CACHE BUILD_ENABLE_CXX_STD PROPERTY STRINGS - "C++11" - "C++14" "C++17" "C++20" ) - if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7) - message(FATAL_ERROR "FreeCAD 0.17 and later requires C++11. G++ must be 4.7 or later, the used version is ${CMAKE_CXX_COMPILER_VERSION}") - elseif(CMAKE_COMPILER_IS_CLANGXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) - message(FATAL_ERROR "FreeCAD 0.17 and later requires C++11. Clang must be 3.3 or later, the used version is ${CMAKE_CXX_COMPILER_VERSION}") + if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3) + message(FATAL_ERROR "FreeCAD 0.20 and later requires C++17. G++ must be 7.3 or later, the used version is ${CMAKE_CXX_COMPILER_VERSION}") + elseif(CMAKE_COMPILER_IS_CLANGXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) + message(FATAL_ERROR "FreeCAD 0.20 and later requires C++17. Clang must be 6.0 or later, the used version is ${CMAKE_CXX_COMPILER_VERSION}") endif() - endif(FREECAD_VERSION VERSION_GREATER 0.16) # Escape the two plus chars as otherwise cmake complains about invalid regex if(${BUILD_ENABLE_CXX_STD} MATCHES "C\\+\\+20") diff --git a/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake b/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake index a5a1d56a7412..2801cfccb388 100644 --- a/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake +++ b/cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake @@ -31,18 +31,8 @@ macro(InitializeFreeCADBuildOptions) if (DEFINED ENV{FREECAD_LIBPACK_DIR}) set(FREECAD_LIBPACK_DIR $ENV{FREECAD_LIBPACK_DIR} CACHE PATH "Directory of the FreeCAD LibPack") message(STATUS "Found libpack env variable: ${FREECAD_LIBPACK_DIR}") - if (EXISTS ${FREECAD_LIBPACK_DIR}/lib/Qt5Core.lib) - option(BUILD_QT5 "Build with Qt5." ON) - else() - option(BUILD_QT5 "Build with Qt5." OFF) - endif() else() set(FREECAD_LIBPACK_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Directory of the FreeCAD LibPack") - if (EXISTS ${FREECAD_LIBPACK_DIR}/lib/Qt5Core.lib) - option(BUILD_QT5 "Build with Qt5." ON) - else() - option(BUILD_QT5 "Build with Qt5." OFF) - endif() endif() set(LIBPACK_FOUND OFF ) @@ -68,10 +58,10 @@ macro(InitializeFreeCADBuildOptions) message(STATUS "Visit: https://github.com/apeltauer/FreeCAD/releases/ for Windows libpack downloads.") endif() else(MSVC) - option(BUILD_QT5 "Build with Qt5." OFF) option(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." OFF) set(FREECAD_LIBPACK_DIR "" CACHE PATH "Directory of the FreeCAD LibPack") endif(MSVC) + option(BUILD_QT5 "Build with Qt5." ON) # https://blog.kitware.com/constraining-values-with-comboboxes-in-cmake-cmake-gui/ set(FREECAD_USE_OCC_VARIANT "Community Edition" CACHE STRING "Official OpenCASCADE version or community edition") diff --git a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake index 2146c2d53e92..c863011bac1b 100644 --- a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake +++ b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake @@ -70,88 +70,76 @@ macro(PrintFinalReport) message(STATUS "Eigen3: not found") endif(DEFINED EIGEN3_FOUND) - if(NOT BUILD_QT5) - message(STATUS "Qt4: ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}") - if(QT_QTWEBKIT_FOUND) - message(STATUS "QtWebKit: found") - else(QT_QTWEBKIT_FOUND) - message(STATUS "QtWebKit: not found") - endif(QT_QTWEBKIT_FOUND) - message(STATUS "Shiboken: ${Shiboken_VERSION} [${SHIBOKEN_INCLUDE_DIR}]") - message(STATUS "PySide: ${PySide_VERSION} [${PYSIDE_INCLUDE_DIR}]") - message(STATUS "PySideTools: [${PYSIDEUIC4BINARY}] [${PYSIDERCC4BINARY}]") - else(NOT BUILD_QT5) - message(STATUS "Qt5Core: ${Qt5Core_VERSION}") - message(STATUS "Qt5Network: ${Qt5Network_VERSION}") - message(STATUS "Qt5Xml: ${Qt5Xml_VERSION}") - message(STATUS "Qt5XmlPatterns: ${Qt5XmlPatterns_VERSION}") - if (BUILD_GUI) - message(STATUS "Qt5Widgets: ${Qt5Widgets_VERSION}") - message(STATUS "Qt5PrintSupport: ${Qt5PrintSupport_VERSION}") - message(STATUS "Qt5OpenGL: ${Qt5OpenGL_VERSION}") - message(STATUS "Qt5Svg: ${Qt5Svg_VERSION}") - message(STATUS "Qt5UiTools: ${Qt5UiTools_VERSION}") - message(STATUS "Qt5Concurrent: ${Qt5Concurrent_VERSION}") - if(BUILD_WEB) - if (Qt5WebKitWidgets_FOUND) - message(STATUS "Qt5WebKitWidgets: ${Qt5WebKitWidgets_VERSION}") - endif() - if (Qt5WebEngineWidgets_FOUND) - message(STATUS "Qt5WebEngineWidgets: ${Qt5WebEngineWidgets_VERSION}") - endif() - else(BUILD_WEB) - message(STATUS "Qt5WebKitWidgets: not needed (BUILD_WEB)") - message(STATUS "Qt5WebEngineWidgets: not needed (BUILD_WEB)") - endif(BUILD_WEB) - if(${Qt5WinExtras_FOUND}) - message(STATUS "Qt5WinExtras: ${Qt5WinExtras_VERSION}") + message(STATUS "Qt5Core: ${Qt5Core_VERSION}") + message(STATUS "Qt5Network: ${Qt5Network_VERSION}") + message(STATUS "Qt5Xml: ${Qt5Xml_VERSION}") + message(STATUS "Qt5XmlPatterns: ${Qt5XmlPatterns_VERSION}") + if (BUILD_GUI) + message(STATUS "Qt5Widgets: ${Qt5Widgets_VERSION}") + message(STATUS "Qt5PrintSupport: ${Qt5PrintSupport_VERSION}") + message(STATUS "Qt5OpenGL: ${Qt5OpenGL_VERSION}") + message(STATUS "Qt5Svg: ${Qt5Svg_VERSION}") + message(STATUS "Qt5UiTools: ${Qt5UiTools_VERSION}") + message(STATUS "Qt5Concurrent: ${Qt5Concurrent_VERSION}") + if(BUILD_WEB) + if (Qt5WebKitWidgets_FOUND) + message(STATUS "Qt5WebKitWidgets: ${Qt5WebKitWidgets_VERSION}") endif() + if (Qt5WebEngineWidgets_FOUND) + message(STATUS "Qt5WebEngineWidgets: ${Qt5WebEngineWidgets_VERSION}") + endif() + else(BUILD_WEB) + message(STATUS "Qt5WebKitWidgets: not needed (BUILD_WEB)") + message(STATUS "Qt5WebEngineWidgets: not needed (BUILD_WEB)") + endif(BUILD_WEB) + if(${Qt5WinExtras_FOUND}) + message(STATUS "Qt5WinExtras: ${Qt5WinExtras_VERSION}") + endif() - else(BUILD_GUI) - message(STATUS "Qt5Widgets: not needed") - message(STATUS "Qt5PrintSupport: not needed") - message(STATUS "Qt5OpenGL: not needed") - message(STATUS "Qt5Svg: not needed") - message(STATUS "Qt5UiTools: not needed") - message(STATUS "Qt5Concurrent: not needed") - message(STATUS "Qt5WebKitWidgets: not needed") - endif(BUILD_GUI) - - if(DEFINED MACPORTS_PREFIX) - if(DEFINED Shiboken_FOUND) - message(STATUS "Shiboken: ${Shiboken_VERSION} [${SHIBOKEN_INCLUDE_DIR}]") - else(DEFINED Shiboken_FOUND) - message(STATUS "Shiboken: not found (only searched if MACPORTS_PREFIX is defined)") - endif(DEFINED Shiboken_FOUND) - if(DEFINED PySide_FOUND) - message(STATUS "PySide: ${PySide_VERSION} [${PYSIDE_INCLUDE_DIR}]") - if(NOT PYSIDE_INCLUDE_DIR) - message(STATUS " IncludeDir: Unable to find, python version mismatch?") - endif(NOT PYSIDE_INCLUDE_DIR) - else(DEFINED PySide_FOUND) - message(STATUS "PySide: not found (only searched if MACPORTS_PREFIX is defined)") - endif(DEFINED PySide_FOUND) - endif(DEFINED MACPORTS_PREFIX) + else(BUILD_GUI) + message(STATUS "Qt5Widgets: not needed") + message(STATUS "Qt5PrintSupport: not needed") + message(STATUS "Qt5OpenGL: not needed") + message(STATUS "Qt5Svg: not needed") + message(STATUS "Qt5UiTools: not needed") + message(STATUS "Qt5Concurrent: not needed") + message(STATUS "Qt5WebKitWidgets: not needed") + endif(BUILD_GUI) - if(DEFINED Shiboken2_FOUND) - message(STATUS "Shiboken2: ${Shiboken2_VERSION} [${Shiboken2_DIR}] [${SHIBOKEN_INCLUDE_DIR}]") - else(DEFINED Shiboken2_FOUND) - message(STATUS "Shiboken2: not found") - endif(DEFINED Shiboken2_FOUND) - if(DEFINED PySide2_FOUND) - message(STATUS "PySide2: ${PySide2_VERSION} [${PYSIDE_INCLUDE_DIR}]") + if(DEFINED MACPORTS_PREFIX) + if(DEFINED Shiboken_FOUND) + message(STATUS "Shiboken: ${Shiboken_VERSION} [${SHIBOKEN_INCLUDE_DIR}]") + else(DEFINED Shiboken_FOUND) + message(STATUS "Shiboken: not found (only searched if MACPORTS_PREFIX is defined)") + endif(DEFINED Shiboken_FOUND) + if(DEFINED PySide_FOUND) + message(STATUS "PySide: ${PySide_VERSION} [${PYSIDE_INCLUDE_DIR}]") if(NOT PYSIDE_INCLUDE_DIR) message(STATUS " IncludeDir: Unable to find, python version mismatch?") endif(NOT PYSIDE_INCLUDE_DIR) - else(DEFINED PySide2_FOUND) - message(STATUS "PySide2: not found") - endif(DEFINED PySide2_FOUND) - if(DEFINED PYSIDE2_TOOLS_FOUND) - message(STATUS "PySide2Tools: [${PYSIDE2UICBINARY}] [${PYSIDE2RCCBINARY}]") - else(DEFINED PYSIDE2_TOOLS_FOUND) - message(STATUS "PySide2Tools: not found") - endif(DEFINED PYSIDE2_TOOLS_FOUND) - endif(NOT BUILD_QT5) + else(DEFINED PySide_FOUND) + message(STATUS "PySide: not found (only searched if MACPORTS_PREFIX is defined)") + endif(DEFINED PySide_FOUND) + endif(DEFINED MACPORTS_PREFIX) + + if(DEFINED Shiboken2_FOUND) + message(STATUS "Shiboken2: ${Shiboken2_VERSION} [${Shiboken2_DIR}] [${SHIBOKEN_INCLUDE_DIR}]") + else(DEFINED Shiboken2_FOUND) + message(STATUS "Shiboken2: not found") + endif(DEFINED Shiboken2_FOUND) + if(DEFINED PySide2_FOUND) + message(STATUS "PySide2: ${PySide2_VERSION} [${PYSIDE_INCLUDE_DIR}]") + if(NOT PYSIDE_INCLUDE_DIR) + message(STATUS " IncludeDir: Unable to find, python version mismatch?") + endif(NOT PYSIDE_INCLUDE_DIR) + else(DEFINED PySide2_FOUND) + message(STATUS "PySide2: not found") + endif(DEFINED PySide2_FOUND) + if(DEFINED PYSIDE2_TOOLS_FOUND) + message(STATUS "PySide2Tools: [${PYSIDE2UICBINARY}] [${PYSIDE2RCCBINARY}]") + else(DEFINED PYSIDE2_TOOLS_FOUND) + message(STATUS "PySide2Tools: not found") + endif(DEFINED PYSIDE2_TOOLS_FOUND) if(FREECAD_USE_FREETYPE) if(DEFINED FREETYPE_FOUND) diff --git a/cMake/FreeCAD_Helpers/SetupQt.cmake b/cMake/FreeCAD_Helpers/SetupQt.cmake index 22ac6ba1e229..cb51e528049d 100644 --- a/cMake/FreeCAD_Helpers/SetupQt.cmake +++ b/cMake/FreeCAD_Helpers/SetupQt.cmake @@ -1,117 +1,53 @@ # -------------------------------- Qt -------------------------------- -if (NOT BUILD_QT5) - # If using MacPorts, help the Qt4 finder. - if(MACPORTS_PREFIX) - if(NOT QT_QMAKE_EXECUTABLE) - set(QT_QMAKE_EXECUTABLE ${MACPORTS_PREFIX}/libexec/qt4/bin/qmake) - endif() - endif() - - set(QT_MIN_VERSION 4.5.0) - set(QT_USE_QTNETWORK TRUE) - set(QT_USE_QTXML TRUE) - if(BUILD_GUI) - set(QT_USE_QTOPENGL TRUE) - set(QT_USE_QTSVG TRUE) - set(QT_USE_QTUITOOLS TRUE) - set(QT_USE_QTWEBKIT TRUE) - endif(BUILD_GUI) - - find_package(Qt4)# REQUIRED - - include(${QT_USE_FILE}) - - if(NOT QT4_FOUND) - message(FATAL_ERROR "========================\n" - "Qt4 libraries not found.\n" - "========================\n") - endif(NOT QT4_FOUND) - - if(NOT QT_QTWEBKIT_FOUND) - message("========================================================\n" - "Qt Webkit not found, will not build browser integration.\n" - "========================================================\n") - endif(NOT QT_QTWEBKIT_FOUND) - - # This is a special version of the built in macro qt4_wrap_cpp - # It is required since moc'ed files are now included instead of being added to projects directly - # It adds a reverse dependency to solve this - # This has the unfortunate side effect that some files are always rebuilt - # There is probably a cleaner solution than this - macro(fc_wrap_cpp outfiles) - # get include dirs - QT4_GET_MOC_FLAGS(moc_flags) - QT4_EXTRACT_OPTIONS(moc_files moc_options moc_target ${ARGN}) - # fixes bug 0000585: bug with boost 1.48 - set(moc_options ${moc_options} -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) - - foreach(it ${moc_files}) - get_filename_component(it ${it} ABSOLUTE) - QT4_MAKE_OUTPUT_FILE(${it} moc_ cpp outfile) - ADD_CUSTOM_COMMAND(OUTPUT ${outfile} - COMMAND ${QT_MOC_EXECUTABLE} - ARGS ${moc_options} ${it} -o ${outfile} - MAIN_DEPENDENCY ${it} - ) - set(${outfiles} ${${outfiles}} ${outfile}) - add_file_dependencies(${it} ${outfile}) - endforeach(it) - endmacro(fc_wrap_cpp) - -elseif (BUILD_QT5) - find_package(Qt5Core REQUIRED) - find_package(Qt5Network REQUIRED) - find_package(Qt5Xml REQUIRED) - find_package(Qt5XmlPatterns REQUIRED) - find_package(Qt5Concurrent REQUIRED) - if(BUILD_GUI) - find_package(Qt5Widgets REQUIRED) - find_package(Qt5PrintSupport REQUIRED) - find_package(Qt5OpenGL REQUIRED) - find_package(Qt5Svg REQUIRED) - find_package(Qt5UiTools REQUIRED) - if (BUILD_WEB) - if (${FREECAD_USE_QTWEBMODULE} MATCHES "Qt Webkit") - find_package(Qt5WebKitWidgets REQUIRED) - elseif(${FREECAD_USE_QTWEBMODULE} MATCHES "Qt WebEngine") +find_package(Qt5Core REQUIRED) + +# For FreeCAD 0.20, pegged to Ubutu 18.04 LTS: +if(${Qt5Core_VERSION} VERSION_LESS "5.9") + message (FATAL_ERROR "FreeCAD v0.20 requires Qt5 5.9 or later") +endif() +find_package(Qt5Network REQUIRED) +find_package(Qt5Xml REQUIRED) +find_package(Qt5XmlPatterns REQUIRED) +find_package(Qt5Concurrent REQUIRED) +if(BUILD_GUI) + find_package(Qt5Widgets REQUIRED) + find_package(Qt5PrintSupport REQUIRED) + find_package(Qt5OpenGL REQUIRED) + find_package(Qt5Svg REQUIRED) + find_package(Qt5UiTools REQUIRED) + if (BUILD_WEB) + if (${FREECAD_USE_QTWEBMODULE} MATCHES "Qt Webkit") + find_package(Qt5WebKitWidgets REQUIRED) + elseif(${FREECAD_USE_QTWEBMODULE} MATCHES "Qt WebEngine") + find_package(Qt5WebEngineWidgets REQUIRED) + else() # Automatic + find_package(Qt5WebKitWidgets QUIET) + if(NOT Qt5WebKitWidgets_FOUND) find_package(Qt5WebEngineWidgets REQUIRED) - if (Qt5WebEngineWidgets_VERSION VERSION_LESS 5.7.0) - message(FATAL_ERROR "** Minimum supported Qt5WebEngine version is 5.7.0!\n") - endif() - else() # Automatic - find_package(Qt5WebKitWidgets QUIET) - if(NOT Qt5WebKitWidgets_FOUND) - find_package(Qt5WebEngineWidgets REQUIRED) - if (Qt5WebEngineWidgets_VERSION VERSION_LESS 5.7.0) - message(FATAL_ERROR "** Minimum supported Qt5WebEngine version is 5.7.0!\n") - endif() - endif() endif() endif() - if(MSVC AND ${Qt5Core_VERSION} VERSION_GREATER "5.2.0") - find_package(Qt5WinExtras QUIET) - endif() - endif(BUILD_GUI) - - # This is a special version of the built in macro qt5_wrap_cpp - # It is required since moc'ed files are now included instead of being added to projects directly - # It adds a reverse dependency to solve this - # This has the unfortunate side effect that some files are always rebuilt - # There is probably a cleaner solution than this - macro(fc_wrap_cpp outfiles ) - # get include dirs - qt5_get_moc_flags(moc_flags) - set(moc_files ${ARGN}) - # fixes bug 0000585: bug with boost 1.48 - set(moc_options ${moc_options} -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED) - - foreach(it ${moc_files}) - get_filename_component(it ${it} ABSOLUTE) - qt5_make_output_file(${it} moc_ cpp outfile) - qt5_create_moc_command(${it} ${outfile} "${moc_flags}" "${moc_options}" "${moc_target}" "${moc_depends}") - set(${outfiles} ${${outfiles}} ${outfile}) - add_file_dependencies(${it} ${outfile}) - endforeach(it) - endmacro(fc_wrap_cpp) -endif (NOT BUILD_QT5) + endif() + if(MSVC) + find_package(Qt5WinExtras QUIET) + endif() +endif(BUILD_GUI) + +# This is a special version of the built in macro qt5_wrap_cpp +# It is required since moc'ed files are now included instead of being added to projects directly +# It adds a reverse dependency to solve this +# This has the unfortunate side effect that some files are always rebuilt +# There is probably a cleaner solution than this +macro(fc_wrap_cpp outfiles ) + # get include dirs + qt5_get_moc_flags(moc_flags) + set(moc_files ${ARGN}) + + foreach(it ${moc_files}) + get_filename_component(it ${it} ABSOLUTE) + qt5_make_output_file(${it} moc_ cpp outfile) + qt5_create_moc_command(${it} ${outfile} "${moc_flags}" "${moc_options}" "${moc_target}" "${moc_depends}") + set(${outfiles} ${${outfiles}} ${outfile}) + add_file_dependencies(${it} ${outfile}) + endforeach(it) +endmacro(fc_wrap_cpp) diff --git a/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake b/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake index 20bfb5058622..00890e14f78b 100644 --- a/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake +++ b/cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake @@ -1,140 +1,91 @@ macro(SetupShibokenAndPyside) # -------------------------------- Shiboken/PySide ------------------------ - if(BUILD_QT5) - # set(PYTHON_SUFFIX -python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) - # 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_CONFIG_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_CONFIG_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: ") + if(DEFINED MACPORTS_PREFIX) + find_package(Shiboken REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake") + find_package(PySide REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake") + endif(DEFINED MACPORTS_PREFIX) + + # Shiboken2Config.cmake may explicitly set CMAKE_BUILD_TYPE to Release which causes + # CMake to fail to create Makefiles for a debug build. + # So as a workaround we save and restore the value after checking for Shiboken2. + set (SAVE_BUILD_TYPE ${CMAKE_BUILD_TYPE}) + find_package(Shiboken2 QUIET)# REQUIRED + set (CMAKE_BUILD_TYPE ${SAVE_BUILD_TYPE}) + if (Shiboken2_FOUND) + # Shiboken2 config file was found but it may use the wrong Python version + # Try to get the matching config suffix and repeat finding the package + set(SHIBOKEN_PATTERN .cpython-${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}) + + file(GLOB SHIBOKEN_CONFIG "${Shiboken2_DIR}/Shiboken2Config${SHIBOKEN_PATTERN}*.cmake") + if (SHIBOKEN_CONFIG) + get_filename_component(SHIBOKEN_CONFIG_SUFFIX ${SHIBOKEN_CONFIG} NAME) + string(SUBSTRING ${SHIBOKEN_CONFIG_SUFFIX} 15 -1 SHIBOKEN_CONFIG_SUFFIX) + string(REPLACE ".cmake" "" PYTHON_CONFIG_SUFFIX ${SHIBOKEN_CONFIG_SUFFIX}) + message(STATUS "PYTHON_CONFIG_SUFFIX: ${PYTHON_CONFIG_SUFFIX}") + find_package(Shiboken2 QUIET) endif() + endif() - if(DEFINED MACPORTS_PREFIX) - find_package(Shiboken REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake") - find_package(PySide REQUIRED HINTS "${PYTHON_LIBRARY_DIR}/cmake") - endif(DEFINED MACPORTS_PREFIX) - - # Shiboken2Config.cmake may explicitly set CMAKE_BUILD_TYPE to Release which causes - # CMake to fail to create Makefiles for a debug build. - # So as a workaround we save and restore the value after checking for Shiboken2. - set (SAVE_BUILD_TYPE ${CMAKE_BUILD_TYPE}) - find_package(Shiboken2 QUIET)# REQUIRED - set (CMAKE_BUILD_TYPE ${SAVE_BUILD_TYPE}) - if (Shiboken2_FOUND) - # Shiboken2 config file was found but it may use the wrong Python version - # Try to get the matching config suffix and repeat finding the package - if (PYTHON_VERSION_MAJOR LESS 3) - set(SHIBOKEN_PATTERN -python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) - else() - set(SHIBOKEN_PATTERN .cpython-${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}) - endif() - - file(GLOB SHIBOKEN_CONFIG "${Shiboken2_DIR}/Shiboken2Config${SHIBOKEN_PATTERN}*.cmake") - if (SHIBOKEN_CONFIG) - get_filename_component(SHIBOKEN_CONFIG_SUFFIX ${SHIBOKEN_CONFIG} NAME) - string(SUBSTRING ${SHIBOKEN_CONFIG_SUFFIX} 15 -1 SHIBOKEN_CONFIG_SUFFIX) - string(REPLACE ".cmake" "" PYTHON_CONFIG_SUFFIX ${SHIBOKEN_CONFIG_SUFFIX}) - message(STATUS "PYTHON_CONFIG_SUFFIX: ${PYTHON_CONFIG_SUFFIX}") - find_package(Shiboken2 QUIET) - endif() - endif() - - # pyside2 changed its cmake files, this is the dance we have - # to dance to be compatible with the old (<5.12) and the new versions (>=5.12) - if(NOT SHIBOKEN_INCLUDE_DIR AND TARGET Shiboken2::libshiboken) - get_property(SHIBOKEN_INCLUDE_DIR TARGET Shiboken2::libshiboken PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - endif(NOT SHIBOKEN_INCLUDE_DIR AND TARGET Shiboken2::libshiboken) - - if(NOT SHIBOKEN_INCLUDE_DIR) - message("====================\n" - "shiboken2 not found.\n" - "====================\n") - endif(NOT SHIBOKEN_INCLUDE_DIR) - - find_package(PySide2 QUIET)# REQUIRED - - if(NOT PYSIDE_INCLUDE_DIR AND TARGET PySide2::pyside2) - get_property(PYSIDE_INCLUDE_DIR TARGET PySide2::pyside2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES) - endif(NOT PYSIDE_INCLUDE_DIR AND TARGET PySide2::pyside2) - - if(NOT PYSIDE_INCLUDE_DIR) - message("==================\n" - "PySide2 not found.\n" - "==================\n") - endif(NOT PYSIDE_INCLUDE_DIR) - - find_package(PySide2Tools QUIET) #REQUIRED # PySide2 utilities (pyside2-uic & pyside2-rcc) - if(NOT PYSIDE2_TOOLS_FOUND) - message("=======================\n" - "PySide2Tools not found.\n" - "=======================\n") - endif(NOT PYSIDE2_TOOLS_FOUND) - - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Ext/PySide) - file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/__init__.py "# PySide wrapper\n" - "from PySide2 import __version__\n" - "from PySide2 import __version_info__\n") - file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtCore.py "from PySide2.QtCore import *\n\n" - "#QCoreApplication.CodecForTr=0\n" - "#QCoreApplication.UnicodeUTF8=1\n") - file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtGui.py "from PySide2.QtGui import *\n" - "from PySide2.QtWidgets import *\n" - "QHeaderView.setResizeMode = QHeaderView.setSectionResizeMode\n") - file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtSvg.py "from PySide2.QtSvg import *\n") - file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtUiTools.py "from PySide2.QtUiTools import *\n") - - if(APPLE AND NOT BUILD_WITH_CONDA) - install( - DIRECTORY - ${CMAKE_BINARY_DIR}/Ext/PySide - DESTINATION - MacOS - ) - else() - install( - DIRECTORY - ${CMAKE_BINARY_DIR}/Ext/PySide - DESTINATION - Ext - ) - endif() - else(BUILD_QT5) - # set(PYTHON_SUFFIX -python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}) - # 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_CONFIG_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_CONFIG_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") - endif(DEFINED MACPORTS_PREFIX) - - find_package(Shiboken)# REQUIRED - if(NOT SHIBOKEN_INCLUDE_DIR) - message(FATAL_ERROR "===================\n" - "shiboken not found.\n" - "===================\n") - endif(NOT SHIBOKEN_INCLUDE_DIR) - - find_package(PySide)# REQUIRED - if(NOT PYSIDE_INCLUDE_DIR) - message(FATAL_ERROR "=================\n" - "PySide not found.\n" - "=================\n") - endif(NOT PYSIDE_INCLUDE_DIR) - - find_package(PySideTools REQUIRED) # PySide utilities (pyside-uic & pyside-rcc) - endif(BUILD_QT5) + # pyside2 changed its cmake files, this is the dance we have + # to dance to be compatible with the old (<5.12) and the new versions (>=5.12) + if(NOT SHIBOKEN_INCLUDE_DIR AND TARGET Shiboken2::libshiboken) + get_property(SHIBOKEN_INCLUDE_DIR TARGET Shiboken2::libshiboken PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + endif(NOT SHIBOKEN_INCLUDE_DIR AND TARGET Shiboken2::libshiboken) + + if(NOT SHIBOKEN_INCLUDE_DIR) + message("====================\n" + "shiboken2 not found.\n" + "====================\n") + endif(NOT SHIBOKEN_INCLUDE_DIR) + + find_package(PySide2 QUIET)# REQUIRED + + if(NOT PYSIDE_INCLUDE_DIR AND TARGET PySide2::pyside2) + get_property(PYSIDE_INCLUDE_DIR TARGET PySide2::pyside2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES) + endif(NOT PYSIDE_INCLUDE_DIR AND TARGET PySide2::pyside2) + + if(NOT PYSIDE_INCLUDE_DIR) + message("==================\n" + "PySide2 not found.\n" + "==================\n") + endif(NOT PYSIDE_INCLUDE_DIR) + + find_package(PySide2Tools QUIET) #REQUIRED # PySide2 utilities (pyside2-uic & pyside2-rcc) + if(NOT PYSIDE2_TOOLS_FOUND) + message("=======================\n" + "PySide2Tools not found.\n" + "=======================\n") + endif(NOT PYSIDE2_TOOLS_FOUND) + + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Ext/PySide) + file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/__init__.py "# PySide wrapper\n" + "from PySide2 import __version__\n" + "from PySide2 import __version_info__\n") + file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtCore.py "from PySide2.QtCore import *\n\n" + "#QCoreApplication.CodecForTr=0\n" + "#QCoreApplication.UnicodeUTF8=1\n") + file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtGui.py "from PySide2.QtGui import *\n" + "from PySide2.QtWidgets import *\n" + "QHeaderView.setResizeMode = QHeaderView.setSectionResizeMode\n") + file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtSvg.py "from PySide2.QtSvg import *\n") + file(WRITE ${CMAKE_BINARY_DIR}/Ext/PySide/QtUiTools.py "from PySide2.QtUiTools import *\n") + + if(APPLE AND NOT BUILD_WITH_CONDA) + install( + DIRECTORY + ${CMAKE_BINARY_DIR}/Ext/PySide + DESTINATION + MacOS + ) + else() + install( + DIRECTORY + ${CMAKE_BINARY_DIR}/Ext/PySide + DESTINATION + Ext + ) + endif() # If shiboken cannot be found the build option will be set to OFF if(SHIBOKEN_INCLUDE_DIR) @@ -143,19 +94,11 @@ macro(SetupShibokenAndPyside) option(FREECAD_USE_SHIBOKEN "Links to the shiboken library at build time. If OFF its Python module is imported at runtime" OFF) # Now try to import the shiboken Python module and print a warning if it can't be loaded - if(BUILD_QT5) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import shiboken2" - RESULT_VARIABLE FAILURE - OUTPUT_VARIABLE PRINT_OUTPUT - ) - else() - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import shiboken" - RESULT_VARIABLE FAILURE - OUTPUT_VARIABLE PRINT_OUTPUT - ) - endif() + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import shiboken2" + RESULT_VARIABLE FAILURE + OUTPUT_VARIABLE PRINT_OUTPUT + ) if(FAILURE) message("=================================\n" @@ -172,36 +115,19 @@ macro(SetupShibokenAndPyside) endif() # Independent of the build option PySide modules must be loaded at runtime. Print a warning if it fails. - if(BUILD_QT5) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import PySide2;import os;print(os.path.dirname(PySide2.__file__), end='')" - RESULT_VARIABLE FAILURE - OUTPUT_VARIABLE PRINT_OUTPUT - ) - if(FAILURE) - message("================================\n" - "PySide2 Python module not found.\n" - "================================\n") - else() - message(STATUS "===============================================\n" - "PySide2 Python module found at ${PRINT_OUTPUT}.\n" - "===============================================\n") - endif() + execute_process( + COMMAND ${PYTHON_EXECUTABLE} -c "import PySide2;import os;print(os.path.dirname(PySide2.__file__), end='')" + RESULT_VARIABLE FAILURE + OUTPUT_VARIABLE PRINT_OUTPUT + ) + if(FAILURE) + message("================================\n" + "PySide2 Python module not found.\n" + "================================\n") else() - execute_process( - COMMAND ${PYTHON_EXECUTABLE} -c "import PySide;import os;print(os.path.dirname(PySide.__file__))" - RESULT_VARIABLE FAILURE - OUTPUT_VARIABLE PRINT_OUTPUT - ) - if(FAILURE) - message("===============================\n" - "PySide Python module not found.\n" - "===============================\n") - else() - message(STATUS "==============================================\n" - "PySide Python module found at ${PRINT_OUTPUT}.\n" - "==============================================\n") - endif() + message(STATUS "===============================================\n" + "PySide2 Python module found at ${PRINT_OUTPUT}.\n" + "===============================================\n") endif() endmacro(SetupShibokenAndPyside)