CMake: Decouple internal SMESH build from Fem build - fixes #18287

This commit is contained in:
marioalexis
2024-12-05 17:01:47 -03:00
committed by Chris Hennes
parent be8b2de07d
commit a6b36f6e57
8 changed files with 22 additions and 16 deletions

View File

@@ -25,7 +25,7 @@ macro(CheckInterModuleDependencies)
REQUIRES_MODS(BUILD_IMPORT BUILD_PART)
REQUIRES_MODS(BUILD_INSPECTION BUILD_MESH BUILD_POINTS BUILD_PART)
REQUIRES_MODS(BUILD_JTREADER BUILD_MESH)
REQUIRES_MODS(BUILD_MESH_PART BUILD_PART BUILD_MESH BUILD_SMESH)
REQUIRES_MODS(BUILD_MESH_PART BUILD_PART BUILD_MESH)
REQUIRES_MODS(BUILD_FLAT_MESH BUILD_MESH_PART)
REQUIRES_MODS(BUILD_OPENSCAD BUILD_MESH_PART BUILD_DRAFT)
REQUIRES_MODS(BUILD_PART BUILD_MATERIAL)

View File

@@ -183,8 +183,16 @@ macro(InitializeFreeCADBuildOptions)
#set(FREECAD_USE_EXTERNAL_SMESH ON )
endif (FREECAD_BUILD_DEBIAN)
if(BUILD_FEM)
set(BUILD_SMESH ON )
if(BUILD_FEM OR BUILD_MESH_PART)
set(FREECAD_USE_SMESH ON)
if(FREECAD_USE_EXTERNAL_SMESH)
set(BUILD_SMESH OFF)
else()
set(BUILD_SMESH ON)
endif()
else()
set(FREECAD_USE_SMESH OFF)
set(BUILD_SMESH OFF)
endif()
# force build directory to be different to source directory

View File

@@ -142,7 +142,7 @@ macro(PrintFinalReport)
simple(ZLIB "${ZLIB_VERSION_STRING}")
simple(OCC "${OCC_VERSION_STRING} [${OCC_LIBRARY_DIR}] [${OCC_INCLUDE_DIR}]")
simple(OCC_Libs "[${OCC_LIBRARIES}]")
if(BUILD_SMESH)
if(FREECAD_USE_SMESH)
if(FREECAD_USE_EXTERNAL_SMESH)
simple(SMESH "${SMESH_VERSION_MAJOR}.${SMESH_VERSION_MINOR}.${SMESH_VERSION_PATCH}.${SMESH_VERSION_TWEAK}")
else()
@@ -152,7 +152,7 @@ macro(PrintFinalReport)
simple(VTK ${VTK_VERSION})
endif()
else()
simple(SMESH "do not build")
simple(SMESH "not enabled")
endif()
conditional(NETGEN NETGEN_FOUND
"not enabled"

View File

@@ -1,8 +1,8 @@
macro(SetupSalomeSMESH)
# -------------------------------- Salome SMESH --------------------------
# Salome SMESH sources are under src/3rdParty now
if(BUILD_SMESH)
if(FREECAD_USE_SMESH)
# set the internal smesh version:
# see src/3rdParty/salomonemesh/CMakeLists.txt and commit https://github.com/FreeCAD/FreeCAD/commit/666a3e5 and https://forum.freecad.org/viewtopic.php?f=10&t=30838
set(SMESH_VERSION_MAJOR 7)
@@ -145,6 +145,6 @@ macro(SetupSalomeSMESH)
set(SMESH_FOUND TRUE)
configure_file(${CMAKE_SOURCE_DIR}/src/SMESH_Version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/SMESH_Version.h)
endif(BUILD_SMESH)
endif(FREECAD_USE_SMESH)
endmacro(SetupSalomeSMESH)

View File

@@ -1,5 +1,5 @@
# Build SalomeMesh for all Platforms since heavily patched
if (BUILD_SMESH AND NOT FREECAD_USE_EXTERNAL_SMESH)
if (BUILD_SMESH)
add_subdirectory(salomesmesh)
endif()
@@ -12,4 +12,4 @@ if (BUILD_ASSEMBLY AND NOT FREECAD_USE_EXTERNAL_ONDSELSOLVER)
git submodule update --init" )
endif()
add_subdirectory(OndselSolver)
endif()
endif()

View File

@@ -1,9 +1,9 @@
if (BUILD_SMESH)
if (SMESH_FOUND)
add_definitions(-DHAVE_SMESH)
if(SMESH_VERSION_MAJOR LESS_EQUAL 9 AND SMESH_VERSION_MINOR LESS 10 )
add_definitions(-DHAVE_MEFISTO)
endif()
endif(BUILD_SMESH)
endif(SMESH_FOUND)
if(BUILD_FEM_NETGEN)
add_definitions(-DHAVE_NETGEN)

View File

@@ -1,9 +1,9 @@
if (BUILD_SMESH)
if (SMESH_FOUND)
add_definitions(-DHAVE_SMESH)
if(SMESH_VERSION_MAJOR LESS_EQUAL 9 AND SMESH_VERSION_MINOR LESS 10 )
add_definitions(-DHAVE_MEFISTO)
endif()
endif(BUILD_SMESH)
endif(SMESH_FOUND)
if(BUILD_FEM_NETGEN)
add_definitions(-DHAVE_NETGEN)

View File

@@ -3,8 +3,6 @@ target_include_directories(Measure_tests_run PUBLIC
${EIGEN3_INCLUDE_DIR}
${OCC_INCLUDE_DIR}
${Python3_INCLUDE_DIRS}
${SMESH_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${XercesC_INCLUDE_DIRS}
)
target_link_directories(Measure_tests_run PUBLIC ${OCC_LIBRARY_DIR})