Files
create/cMake/FreeCAD_Helpers/SetupCoin3D.cmake
Chris Hennes d01ce32a1f Update for LibPack3 (#10337)
* 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
2024-06-24 18:25:05 +02:00

45 lines
1.8 KiB
CMake

macro(SetupCoin3D)
# -------------------------------- Coin3D --------------------------------
if (WIN32 AND MINGW)
find_path(COIN3D_INCLUDE_DIRS Inventor/So.h)
find_library(COIN3D_LIBRARIES Coin)
endif ()
# Try MODULE mode
find_package(Coin3D)
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})
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 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)