# GenFem - A high-level finite element library # Copyright (C) 2010-2026 Eric Bechet # # See the LICENSE file for contributions and license information. # Please report all bugs and problems to . # cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # if CMAKE_BUILD_TYPE is specified use it; otherwise set the default # build type to "RelWithDebInfo" ("-O2 -g" with gcc) prior to calling # project() if(DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type") else(DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose build type") endif(DEFINED CMAKE_BUILD_TYPE) project(genFem CXX) option(GENFEM_ENABLE_SHARED "Enable the compilation of the genfem shared library" ON) option(GENFEM_ENABLE_STATIC "Enable the compilation of the genfem static library" ON) option(GENFEM_ENABLE_CUTMESH "Enable the use of CutMesh (needs both libraries)" OFF) option(GENFEM_ENABLE_TESTING "Enable genFem testing targets (needs static lib)" ON) option(GENFEM_ENABLE_FTENSOR "Enable the use of FTensor (experimental)" OFF) option(GENFEM_ENABLE_APPLI "Enable the compilation of applications (needs both libraries)" ON) include_directories(. genTensors autodiff) if(GENFEM_ENABLE_FTENSOR) set(FTENSOR_PATH "./FTensor" CACHE STRING "FTensor Path") include_directories(${FTENSOR_PATH} ${FTENSOR_PATH}/src ${FTENSOR_PATH}/src/FTensor) add_definitions( -Drestrict= -ftemplate-depth-100 -DUSE_FTENSOR) endif(GENFEM_ENABLE_FTENSOR) if(NOT INSIDE_CADXFEM_TREE) if(NOT DEFINED GMSH_PATH) set(GMSH_PATH "./gmsh" CACHE STRING "Gmsh Path") endif(NOT DEFINED GMSH_PATH) add_subdirectory(${GMSH_PATH} "${CMAKE_CURRENT_BINARY_DIR}/gmsh") include_directories(${GMSH_PATH}/Common ${GMSH_PATH}/Geo ${GMSH_PATH}/Graphics ${GMSH_PATH}/Mesh ${GMSH_PATH}/Solver ${GMSH_PATH}/Numeric ${GMSH_PATH}/Parser ${GMSH_PATH}/Plugin ${GMSH_PATH}/Post ${GMSH_PATH}/Qt ${GMSH_PATH}/Fltk ${CMAKE_CURRENT_BINARY_DIR}/gmsh/Common ${GMSH_EXTERNAL_INCLUDE_DIRS} ${EXTERNAL_INCLUDES} ${GMSH_PATH}/contrib/gmm ${GMSH_PATH}/contrib/MathEx ${GMSH_PATH}/contrib/DiscreteIntegration ${GMSH_PATH}/contrib/ANN ${GMSH_PATH}/contrib/taucs) INCLUDE(CTest) ENABLE_TESTING() set_target_properties(gmsh PROPERTIES EXCLUDE_FROM_ALL TRUE) endif(NOT INSIDE_CADXFEM_TREE) set(SRC genGroupOfElements.cpp genMiscTerms.cpp genDataIO.cpp genDataIONG.cpp genFilters.cpp genTensors/genTensors.cpp autodiff/dfloat.cpp) set(LINK_LIBRARIES shared ${GMSH_EXTERNAL_LIBRARIES}) if(GENFEM_ENABLE_SHARED) add_library(genFem_shared SHARED ${SRC}) target_link_libraries(genFem_shared ${LINK_LIBRARIES}) endif(GENFEM_ENABLE_SHARED) if(GENFEM_ENABLE_STATIC) add_library(genFem STATIC ${SRC}) target_link_libraries(genFem ${LINK_LIBRARIES}) endif(GENFEM_ENABLE_STATIC) if(GENFEM_ENABLE_CUTMESH) if(GENFEM_ENABLE_STATIC) if(GENFEM_ENABLE_SHARED) add_definitions( -DUSE_CUTMESH) include_directories(cutmesh) include_directories(genLevelSet) add_subdirectory(cutmesh) add_subdirectory(genLevelSet) endif(GENFEM_ENABLE_SHARED) endif(GENFEM_ENABLE_STATIC) endif(GENFEM_ENABLE_CUTMESH) if(GENFEM_ENABLE_TESTING) if(GENFEM_ENABLE_STATIC) add_subdirectory(test) endif(GENFEM_ENABLE_STATIC) endif(GENFEM_ENABLE_TESTING) if(GENFEM_ENABLE_APPLI) if(GENFEM_ENABLE_STATIC) if(GENFEM_ENABLE_SHARED) add_subdirectory(applications) endif(GENFEM_ENABLE_SHARED) endif(GENFEM_ENABLE_STATIC) endif(GENFEM_ENABLE_APPLI)