CMake: Allow external libE57Format

This commit is contained in:
Chris Hennes
2025-03-31 23:38:11 -05:00
committed by Benjamin Nauck
parent 5412d0a4eb
commit 62b0e6eb4f
4 changed files with 25 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ macro(InitializeFreeCADBuildOptions)
option(FREECAD_USE_EXTERNAL_KDL "Use system installed orocos-kdl instead of the bundled." OFF) option(FREECAD_USE_EXTERNAL_KDL "Use system installed orocos-kdl instead of the bundled." OFF)
option(FREECAD_USE_EXTERNAL_FMT "Use system installed fmt library if available instead of fetching the source." ON) option(FREECAD_USE_EXTERNAL_FMT "Use system installed fmt library if available instead of fetching the source." ON)
option(FREECAD_USE_EXTERNAL_ONDSELSOLVER "Use system installed OndselSolver instead of git submodule." OFF) option(FREECAD_USE_EXTERNAL_ONDSELSOLVER "Use system installed OndselSolver instead of git submodule." OFF)
option(FREECAD_USE_EXTERNAL_E57FORMAT "Use system installed libE57Format instead of the bundled." OFF)
option(FREECAD_USE_FREETYPE "Builds the features using FreeType libs" ON) option(FREECAD_USE_FREETYPE "Builds the features using FreeType libs" ON)
option(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF) option(FREECAD_BUILD_DEBIAN "Prepare for a build of a Debian package" OFF)
option(FREECAD_CHECK_PIVY "Check for pivy version using Python at build time" ON) option(FREECAD_CHECK_PIVY "Check for pivy version using Python at build time" ON)

View File

@@ -27,6 +27,12 @@ endif()
find_package(XercesC REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/cmake NO_DEFAULT_PATH) find_package(XercesC REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/cmake NO_DEFAULT_PATH)
message(STATUS "Found LibPack 3 XercesC ${XercesC_VERSION}") message(STATUS "Found LibPack 3 XercesC ${XercesC_VERSION}")
if(FREECAD_LIBPACK_VERSION VERSION_GREATER_EQUAL "3.1.1")
set(FREECAD_USE_EXTERNAL_E57FORMAT ON)
find_package(E57Format REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake/e57format NO_DEFAULT_PATH)
message(STATUS "Found LibPack 3 e57format ${e57format_VERSION}")
endif()
find_package(yaml-cpp REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake NO_DEFAULT_PATH) find_package(yaml-cpp REQUIRED PATHS ${FREECAD_LIBPACK_DIR}/lib/cmake NO_DEFAULT_PATH)
message(STATUS "Found LibPack 3 yaml-cpp ${yaml-cpp_VERSION}") message(STATUS "Found LibPack 3 yaml-cpp ${yaml-cpp_VERSION}")

View File

@@ -4,7 +4,10 @@ if (BUILD_SMESH)
endif() endif()
add_subdirectory(lazy_loader) add_subdirectory(lazy_loader)
add_subdirectory(libE57Format)
if(NOT FREECAD_USE_EXTERNAL_E57FORMAT)
add_subdirectory(libE57Format)
endif()
if (BUILD_ASSEMBLY AND NOT FREECAD_USE_EXTERNAL_ONDSELSOLVER) if (BUILD_ASSEMBLY AND NOT FREECAD_USE_EXTERNAL_ONDSELSOLVER)
if( NOT EXISTS "${CMAKE_SOURCE_DIR}/src/3rdParty/OndselSolver/CMakeLists.txt" ) if( NOT EXISTS "${CMAKE_SOURCE_DIR}/src/3rdParty/OndselSolver/CMakeLists.txt" )

View File

@@ -14,10 +14,18 @@ target_include_directories(
SYSTEM SYSTEM
PUBLIC PUBLIC
${EIGEN3_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR}
${CMAKE_BINARY_DIR}/src/3rdParty/libE57Format
${CMAKE_SOURCE_DIR}/src/3rdParty/libE57Format/include
) )
if (NOT FREECAD_USE_EXTERNAL_E57FORMAT)
target_include_directories(
Points
SYSTEM
PUBLIC
${CMAKE_BINARY_DIR}/src/3rdParty/libE57Format
${CMAKE_SOURCE_DIR}/src/3rdParty/libE57Format/include
)
endif()
set(Points_LIBS set(Points_LIBS
FreeCADApp FreeCADApp
) )
@@ -67,7 +75,10 @@ if(FREECAD_USE_PCH)
endif(FREECAD_USE_PCH) endif(FREECAD_USE_PCH)
target_sources(Points PRIVATE ${Points_SRCS} ${Points_Scripts}) target_sources(Points PRIVATE ${Points_SRCS} ${Points_Scripts})
link_directories(${CMAKE_BINARY_DIR}/src/3rdParty/libE57Format)
if (NOT FREECAD_USE_EXTERNAL_E57FORMAT)
link_directories(${CMAKE_BINARY_DIR}/src/3rdParty/libE57Format)
endif()
target_link_libraries(Points E57Format ${Points_LIBS}) target_link_libraries(Points E57Format ${Points_LIBS})
if (FREECAD_WARN_ERROR) if (FREECAD_WARN_ERROR)