Skip to content

Commit

Permalink
Update for LibPack3 (FreeCAD#10337)
Browse files Browse the repository at this point in the history
* cMake: Add base support for LibPack3

Minor changes to FreeCAD source code to support compiling with Qt 6.5 on MSVC,
and changes to cMake setup to support the new Libpack.

* NETGENPlugin: Fix compilation with MSVC and OCCT 7.8

* Material: Switch to Wrapped_ParseTupleAndKeywords for /fpermissive- on MSVC

* Base: Prevent accidental definition of MIN and MAX by MSVC

* cMake: Prevent accidentally finding an old LibPack

* Material: Wrap another ParseTuple call

* OCCT: Modify includes for 7.8.x

* Part: Change TNP code to use Wrapped_ParseTupleAndArgs

* Spreadsheet: Workaround for MSVC macro pollution

* Mesh: Workaround for MSVC macro pollution

* Base: Remove extra MSVC flag (moved to CMake)

* Tests: Fix compiling with /permissive-

* FEM: Fix Qt warnings about duplicate element names

* cMake: Ensure major version numbers are set

* Address review comments.

* cMake: Further tweaks for LibPack3

* cMake: Modify specification of compiler flags for MSVC

* Main: Remove QtQuick testing code

* cmake: Find Boost before SMESH (which uses it)

* Fixes for LibPack2

* cMake: Another try at importinhg VTK cleanly
  • Loading branch information
chennes authored Jun 24, 2024
1 parent 44e8f91 commit d01ce32
Show file tree
Hide file tree
Showing 42 changed files with 421 additions and 156 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ FreeCADLibpackChecks()
SetupDoxygen()
SetupLibFmt()
SetupYamlCpp()
if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER OR FREECAD_LIBPACK_CHECKFILE_VERSION)
SetupPython()
SetupPCL()
SetupPybind11()
Expand All @@ -68,8 +68,8 @@ if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
# OPENGL_gl_LIBRARY empty that results into linker errors
SetupOpenGL()
endif(BUILD_GUI)
SetupSalomeSMESH()
SetupBoost()
SetupSalomeSMESH()
if (BUILD_FEM_NETGEN)
find_package(NETGEN)
endif(BUILD_FEM_NETGEN)
Expand All @@ -88,7 +88,7 @@ if(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
SetupShibokenAndPyside()
SetupMatplotlib()
endif(BUILD_GUI)
endif(NOT FREECAD_LIBPACK_USE OR FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
endif()

if(BUILD_VR)
find_package(Rift)
Expand Down
22 changes: 22 additions & 0 deletions cMake/FindPySide6.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# The Qt for Python project officially recommends using pip to install PySide, so we expect to find PySide in the
# site-packages directory. The library will be called "PySide6.abi3.*", and there will be an "include" directory inside
# the site-packages/PySide6. Over time some distros may provide custom versions, so we also support using a more normal
# cMake find_package() call

find_package(PySide6 CONFIG QUIET)
if(NOT PySide6_FOUND)
if(NOT PySide6_INCLUDE_DIR AND TARGET PySide6::pyside6)
get_property(PySide6_INCLUDE_DIR TARGET PySide6::pyside6 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif()

if(NOT PySide6_INCLUDE_DIR)
find_pip_package(PySide6)
if (PySide6_FOUND)
set(PYSIDE_INCLUDE_DIR ${PySide6_INCLUDE_DIRS} CACHE INTERNAL "")
set(PYSIDE_LIBRARY ${PySide6_LIBRARIES} CACHE INTERNAL "")
set(PYSIDE_FOUND TRUE CACHE BOOL OFF)
set(PYSIDE_MAJOR_VERSION 6 CACHE INTERNAL 6)
endif()
endif()

endif()
28 changes: 28 additions & 0 deletions cMake/FindShiboken6.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# The Qt for Python project officially recommends using pip to install Shiboken, so we expect to find Shiboken in the
# site-packages directory. FreeCAD also requires shiboken6_generator, so this find script also locates that package
# and ensures the inclusion of its include directory when using the pip finding mechanism


find_package(Shiboken6 CONFIG QUIET)
if(NOT Shiboken6_FOUND)
if(NOT Shiboken6_INCLUDE_DIR AND TARGET Shiboken6::Shiboken6)
get_property(Shiboken6_INCLUDE_DIR TARGET Shiboken6::Shiboken6 PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
endif()
if(NOT Shiboken6_INCLUDE_DIR)
find_pip_package(Shiboken6)
if (Shiboken6_FOUND)
set(SHIBOKEN_LIBRARY ${Shiboken6_LIBRARIES} CACHE INTERNAL "")
set(SHIBOKEN_MAJOR_VERSION 6 CACHE INTERNAL 6)
set(SHIBOKEN_FOUND ON CACHE BOOL OFF)
endif()
# The include directory we actually want is part of shiboken6-generator
find_pip_package(shiboken6_generator)
if (shiboken6_generator_FOUND)
set(SHIBOKEN_INCLUDE_DIR ${shiboken6_generator_INCLUDE_DIRS} CACHE PATH "")
endif()
endif()
else()
set(SHIBOKEN_INCLUDE_DIR ${Shiboken6_INCLUDE_DIRS} CACHE PATH "")
set(SHIBOKEN_LIBRARY ${Shiboken6_LIBRARIES} CACHE INTERNAL "")
set(SHIBOKEN_FOUND ON CACHE BOOL OFF)
endif()
15 changes: 14 additions & 1 deletion cMake/FreeCAD_Helpers/ChooseQtVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,22 @@ macro(ChooseQtVersion)
endif()

if(FREECAD_LIBPACK_USE)
if (NOT Qt5_DIR OR Qt5_DIR STREQUAL "Qt5_DIR-NOTFOUND")
find_file(FREECAD_LIBPACK_CHECKFILE_VERSION NAMES FREECAD_LIBPACK_VERSION PATHS ${FREECAD_LIBPACK_DIR} NO_DEFAULT_PATH)
if(FREECAD_LIBPACK_CHECKFILE_VERSION)
file(READ ${FREECAD_LIBPACK_CHECKFILE_VERSION} FREECAD_LIBPACK_VERSION)
message(STATUS "LibPack: read version file and got ${FREECAD_LIBPACK_VERSION}")
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
message(STATUS "Using Qt6 directory from LibPack in ${FREECAD_LIBPACK_DIR}/lib/cmake/Qt6")
set(Qt6_DIR ${FREECAD_LIBPACK_DIR}/lib/cmake/Qt6)
set(FREECAD_QT_VERSION 6)
else()
message(ERROR ": Unrecognized LibPack version ${FREECAD_LIBPACK_CHECKFILE_VERSION}")
endif()
else()
if (NOT Qt5_DIR OR Qt5_DIR STREQUAL "Qt5_DIR-NOTFOUND")
message(STATUS "Using Qt5 directory from LibPack in ${FREECAD_LIBPACK_DIR}/lib/cmake/Qt5")
set(Qt5_DIR ${FREECAD_LIBPACK_DIR}/lib/cmake/Qt5)
endif()
endif()
endif()

Expand Down
31 changes: 25 additions & 6 deletions cMake/FreeCAD_Helpers/CopyLibpackDirectories.cmake
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
macro(CopyLibpackDirectories)
# Copy libpack dependency directories to build folder for user as part of overall build process
if(FREECAD_COPY_DEPEND_DIRS_TO_BUILD)
message(STATUS "=======================================\n"
"Copying libpack dependency directories to build directory for Windows MSVC build.\n")
message(STATUS "Copying libpack dependency directories to build directory...")
file(COPY ${FREECAD_LIBPACK_DIR}/bin/assistant.exe DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/bin/qt.conf DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/platforms DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/imageformats DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/iconengines DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/sqldrivers DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/styles DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/printsupport DESTINATION ${CMAKE_BINARY_DIR}/bin)
if(NOT FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/printsupport DESTINATION ${CMAKE_BINARY_DIR}/bin)
endif()
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
file(COPY ${FREECAD_LIBPACK_DIR}/plugins/tls DESTINATION ${CMAKE_BINARY_DIR}/bin)
endif()
file(COPY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR})
message(STATUS "... end copying.\n=======================================\n")
endif()

if(COPY_LIBPACK_BIN_TO_BUILD)
if(FREECAD_COPY_LIBPACK_BIN_TO_BUILD)
message("=======================================\n"
"Copying libpack 'bin' directory to build directory.\n")
message("Copying LibPack 'bin' directory to build 'bin' directory...")
file(COPY ${FREECAD_LIBPACK_DIR}/bin DESTINATION ${CMAKE_BINARY_DIR})
message("... done copying libpack 'bin' directory.\n=======================================\n")
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
message("Copying DLLs from LibPack 'lib' directory to build 'bin' directory...")
file(GLOB DLLS ${FREECAD_LIBPACK_DIR}/lib/*.dll)
file(COPY ${DLLS} DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(GLOB DLLS ${FREECAD_LIBPACK_DIR}/bin/Lib/site-packages/shiboken6/shiboken*.dll)
file(COPY ${DLLS} DESTINATION ${CMAKE_BINARY_DIR}/bin)
file(GLOB DLLS ${FREECAD_LIBPACK_DIR}/bin/Lib/site-packages/PySide6/pyside6*.dll)
file(COPY ${DLLS} DESTINATION ${CMAKE_BINARY_DIR}/bin)
endif()
message(STATUS " ... done.")
endif()
if(FREECAD_COPY_PLUGINS_BIN_TO_BUILD)
message(STATUS "=======================================\n"
Expand All @@ -42,8 +54,15 @@ macro(CopyLibpackDirectories)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/sqldrivers DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/styles DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/printsupport DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
if(NOT FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/printsupport DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endif()
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.0.0")
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/plugins/tls DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endif()
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/bin DESTINATION ${CMAKE_INSTALL_PREFIX})
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/lib DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.dll")
message(STATUS "Created install commands for INSTALL target.\n")
endif()
endmacro()
12 changes: 10 additions & 2 deletions cMake/FreeCAD_Helpers/FreeCADLibpackChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@ macro(FreeCADLibpackChecks)
if(FREECAD_LIBPACK_USE)

# checking for a unique file in LibPack location to make sure the right version of the LibPack is there
find_file(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER MANIFEST.db ${FREECAD_LIBPACK_DIR})
find_file(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER MANIFEST.db PATHS ${FREECAD_LIBPACK_DIR} NO_DEFAULT_PATH NO_CACHE)
find_file(FREECAD_LIBPACK_CHECKFILE_VERSION FREECAD_LIBPACK_VERSION PATHS ${FREECAD_LIBPACK_DIR} NO_DEFAULT_PATH NO_CACHE)

# don't show them in the GUI
set(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER "${FREECAD_LIBPACK_CHECKFILE_CLBUNDLER}" CACHE INTERNAL "Find libpack")
set(FREECAD_LIBPACK_CHECKFILE_VERSION "${FREECAD_LIBPACK_CHECKFILE_VERSION}" CACHE INTERNAL "Find libpack v3+")

if (FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
set(FREECAD_LIBPACK_VERSION "CLbundler" CACHE STRING "Displays if the libpack has been found" FORCE)
message("Found LibPack v2 (CLBundler) via ${FREECAD_LIBPACK_CHECKFILE_CLBUNDLER}")
include(cMake/UseLibPackCLbundler.cmake)
elseif (FREECAD_LIBPACK_CHECKFILE_VERSION)
file(READ ${FREECAD_LIBPACK_CHECKFILE_VERSION} FREECAD_LIBPACK_VERSION)
set(FREECAD_LIBPACK_VERSION "${FREECAD_LIBPACK_VERSION}" CACHE STRING "Version of the LibPack, if found" FORCE)
message("Found LibPack " ${FREECAD_LIBPACK_VERSION})
include(cMake/UseLibPack3.cmake)
else(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
set(FREECAD_LIBPACK_VERSION "NOTFOUND" CACHE STRING "Displays if the libpack has been found" FORCE)
message(SEND_ERROR "Could not find libpack in specified location:" ${FREECAD_LIBPACK_DIR})
message(SEND_ERROR "Could not find LibPack in specified location:" ${FREECAD_LIBPACK_DIR})
endif(FREECAD_LIBPACK_CHECKFILE_CLBUNDLER)
# -------------------------------- PyCXX --------------------------------

Expand Down
1 change: 1 addition & 0 deletions cMake/FreeCAD_Helpers/InitializeFreeCADBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ macro(InitializeFreeCADBuildOptions)
option(FREECAD_COPY_PLUGINS_BIN_TO_BUILD "Copy plugins to the build directory." OFF)
endif()
else()
message(WARNING Could not locate ${FREECAD_LIBPACK_DIR}/plugins/imageformats/qsvg.dll)
message("Libpack NOT found.\nIf you intend to use a Windows libpack, set the FREECAD_LIBPACK_DIR to the libpack directory.")
message(STATUS "Visit: https://github.com/FreeCAD/FreeCAD-Libpack/releases/ for Windows libpack downloads.")
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ macro(SetGlobalCompilerAndLinkerSettings)

if(MSVC)
# set default compiler settings
add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zm150 /bigobj")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFC_DEBUG /Zm150 /bigobj")
add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR -DNOMINMAX)
add_compile_options(/Zm150 /bigobj)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DFC_DEBUG")
# set default libs
set (CMAKE_C_STANDARD_LIBRARIES "kernel32.lib user32.lib gdi32.lib winspool.lib SHFolder.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib winmm.lib comsupp.lib Ws2_32.lib dbghelp.lib ")
set (CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}")
Expand All @@ -50,8 +50,7 @@ macro(SetGlobalCompilerAndLinkerSettings)
string(REGEX REPLACE "/Z[iI]" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REGEX REPLACE "/Z[iI]" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
endif(CCACHE_PROGRAM)

option(FREECAD_USE_MP_COMPILE_FLAG "Add /MP flag to the compiler definitions. Speeds up the compile on multi processor machines" ON)
option(FREECAD_USE_MP_COMPILE_FLAG "Add /MP flag to the compiler definitions. Speeds up the compile on multi processor machines" ON)
if(FREECAD_USE_MP_COMPILE_FLAG)
# set "Build with Multiple Processes"
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
Expand Down
51 changes: 28 additions & 23 deletions cMake/FreeCAD_Helpers/SetupCoin3D.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
macro(SetupCoin3D)
# -------------------------------- Coin3D --------------------------------
# -------------------------------- Coin3D --------------------------------

if (WIN32 AND MINGW)
find_path(COIN3D_INCLUDE_DIRS Inventor/So.h)
Expand All @@ -8,32 +8,37 @@ macro(SetupCoin3D)

# Try MODULE mode
find_package(Coin3D)
if(NOT COIN3D_FOUND)
if (NOT COIN3D_FOUND)
# Try CONFIG mode
find_package(Coin CONFIG REQUIRED)
if (Coin_FOUND)
set (COIN3D_INCLUDE_DIRS ${Coin_INCLUDE_DIR})
set (COIN3D_LIBRARIES ${Coin_LIBRARIES})
else()
message(FATAL_ERROR "=================\n"
"Coin3D not found.\n"
"=================\n")
endif()
endif(NOT COIN3D_FOUND)
set(COIN3D_INCLUDE_DIRS ${Coin_INCLUDE_DIR})
set(COIN3D_LIBRARIES ${Coin_LIBRARIES})
endif ()
ENDIF ()

IF(NOT COIN3D_VERSION)
file(READ "${COIN3D_INCLUDE_DIRS}/Inventor/C/basic.h" _coin3d_basic_h)
string(REGEX MATCH "define[ \t]+COIN_MAJOR_VERSION[ \t]+([0-9?])" _coin3d_major_version_match "${_coin3d_basic_h}")
set(COIN3D_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+COIN_MINOR_VERSION[ \t]+([0-9?])" _coin3d_minor_version_match "${_coin3d_basic_h}")
set(COIN3D_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+COIN_MICRO_VERSION[ \t]+([0-9?])" _coin3d_micro_version_match "${_coin3d_basic_h}")
set(COIN3D_MICRO_VERSION "${CMAKE_MATCH_1}")
set(COIN3D_VERSION "${COIN3D_MAJOR_VERSION}.${COIN3D_MINOR_VERSION}.${COIN3D_MICRO_VERSION}")
ENDIF()
IF (NOT COIN3D_VERSION)
file(READ "${COIN3D_INCLUDE_DIRS}/Inventor/C/basic.h" _coin3d_basic_h)
string(REGEX MATCH "define[ \t]+COIN_MAJOR_VERSION[ \t]+([0-9?])" _coin3d_major_version_match "${_coin3d_basic_h}")
set(COIN3D_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+COIN_MINOR_VERSION[ \t]+([0-9?])" _coin3d_minor_version_match "${_coin3d_basic_h}")
set(COIN3D_MINOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+COIN_MICRO_VERSION[ \t]+([0-9?])" _coin3d_micro_version_match "${_coin3d_basic_h}")
set(COIN3D_MICRO_VERSION "${CMAKE_MATCH_1}")
set(COIN3D_VERSION "${COIN3D_MAJOR_VERSION}.${COIN3D_MINOR_VERSION}.${COIN3D_MICRO_VERSION}")
ENDIF ()

IF(NOT PIVY_VERSION)
execute_process (COMMAND ${Python3_EXECUTABLE} -c "import pivy as p; print(p.__version__,end='')" OUTPUT_VARIABLE PIVY_VERSION)
ENDIF()
IF (NOT PIVY_VERSION)
message(STATUS "Checking Pivy version by importing it in a Python program...")
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "import pivy as p; print(p.__version__,end='')"
OUTPUT_VARIABLE PIVY_VERSION
RESULT_VARIABLE RETURN_CODE)
if (RETURN_CODE EQUAL 0)
message(STATUS "Found Pivy ${PIVY_VERSION}")
else ()
message(FATAL_ERROR "Failed to import Pivy using ${Python3_EXECUTABLE}")
endif ()
ENDIF ()

endmacro(SetupCoin3D)
8 changes: 7 additions & 1 deletion cMake/FreeCAD_Helpers/SetupSalomeSMESH.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ macro(SetupSalomeSMESH)

# check which modules are available
if(UNIX OR WIN32)
find_package(VTK COMPONENTS vtkCommonCore REQUIRED NO_MODULE)
# Module names changed between 8 and 9, so do a QUIET find for 9 and its module name first, and fall back
# to v7 minimum with the old component name if it is not found.
find_package(VTK 9 COMPONENTS CommonCore QUIET NO_MODULE)
if(NOT VTK_FOUND)
message(STATUS "Did not find VTK 9, trying for an older version")
find_package(VTK COMPONENTS vtkCommonCore REQUIRED NO_MODULE)
endif()
if(${VTK_MAJOR_VERSION} LESS 9)
list(APPEND VTK_COMPONENTS vtkIOMPIParallel vtkParallelMPI vtkhdf5 vtkFiltersParallelDIY2 vtkRenderingCore vtkInteractionStyle vtkRenderingFreeType vtkRenderingOpenGL2)
foreach(_module ${VTK_COMPONENTS})
Expand Down
37 changes: 0 additions & 37 deletions cMake/FreeCAD_Helpers/SetupShibokenAndPyside.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -170,43 +170,6 @@ macro(SetupShibokenAndPyside)

endmacro(SetupShibokenAndPyside)

# Locate the include directory for a pip-installed package -- uses pip show to find the base pip
# install directory, and then appends the package name and "/include" to the end
macro(find_pip_package PACKAGE)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -m pip show ${PACKAGE}
RESULT_VARIABLE FAILURE
OUTPUT_VARIABLE PRINT_OUTPUT
)
if(NOT FAILURE)
# Extract Name: and Location: lines and use them to construct the include directory
string(REPLACE "\n" ";" PIP_OUTPUT_LINES ${PRINT_OUTPUT})
foreach(LINE IN LISTS PIP_OUTPUT_LINES)
STRING(FIND "${LINE}" "Name: " NAME_STRING_LOCATION)
STRING(FIND "${LINE}" "Location: " LOCATION_STRING_LOCATION)
if(${NAME_STRING_LOCATION} EQUAL 0)
STRING(SUBSTRING "${LINE}" 6 -1 PIP_PACKAGE_NAME)
elseif(${LOCATION_STRING_LOCATION} EQUAL 0)
STRING(SUBSTRING "${LINE}" 10 -1 PIP_PACKAGE_LOCATION)
endif()
endforeach()
message(STATUS "Found pip-installed ${PACKAGE} in ${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}")
file(TO_NATIVE_PATH "${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}/include" INCLUDE_DIR)
file(TO_NATIVE_PATH "${PIP_PACKAGE_LOCATION}/${PIP_PACKAGE_NAME}/lib" LIBRARY)
if(EXISTS ${INCLUDE_DIR})
set(${PACKAGE}_INCLUDE_DIR ${INCLUDE_DIR})
else()
message(STATUS "${PACKAGE} include directory '${INCLUDE_DIR}' does not exist")
endif()
if(EXISTS ${LIBRARY})
set(${PACKAGE}_LIBRARY ${LIBRARY})
else()
message(STATUS "${PACKAGE} library directory '${LIBRARY}' does not exist")
endif()
set(${PACKAGE}_FOUND TRUE)
endif()
endmacro()


# Macros 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:
Expand Down
Loading

0 comments on commit d01ce32

Please sign in to comment.