# The name of our project is "IBREP". CMakeLists files in this project can # refer to the root source directory of the project as ${HELLO_SOURCE_DIR} and # to the root binary directory of the project as ${HELLO_BINARY_DIR}. cmake_minimum_required (VERSION 3.10 FATAL_ERROR) project(IBrep) 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) option(IBREP_ENABLE_GNURBS_INTERFACE "Enable Gnurbs Interface" OFF) option(IBREP_ENABLE_OCC_INTERFACE "Enable OpenCascade" OFF) option(IBREP_ENABLE_MESH "Enable Mesh" OFF) option(IBREP_ENABLE_GMSH_GMODEL_EXPORT "Enable Gmsh GModel" OFF) option(IBREP_ENABLE_ANN "ANN library for IBREP" ON) #needed for opencascade set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") if(IBREP_ENABLE_ANN) find_library(ANN_LIB ann PATH_SUFFIXES lib) find_path(ANN_INC "ANN.h" PATH_SUFFIXES src include ANN) if(ANN_LIB AND ANN_INC) list(APPEND EXTERNAL_LIBRARIES ${ANN_LIB}) list(APPEND EXTERNAL_INCLUDES ${ANN_INC}) add_definitions( -DIBREP_HAS_ANN) message(STATUS "Found System ANN") else(ANN_LIB AND ANN_INC) message(STATUS "System ANN not found") endif(ANN_LIB AND ANN_INC) endif(IBREP_ENABLE_ANN) set (IBREP_LINK_LIBRARIES ${EXTERNAL_LIBRARIES} ) IF(IBREP_ENABLE_GNURBS_INTERFACE OR IBREP_ENABLE_MESH OR IBREP_ENABLE_OCC_INTERFACE) IF(NOT TARGET nutil-dynamic AND NOT INSIDE_CADXFEM_TREE) add_subdirectory(nutil) endif() include_directories(. ${NUTIL_INCLUDE_DIRECTORIES} ${NUTIL_EXTERNAL_INCLUDES}) link_directories(${NUTIL_EXTERNAL_LIBRARY_DIRS}) add_definitions( -DHAS_NUTIL) list (APPEND IBREP_LINK_LIBRARIES nutil-dynamic) endif() if(IBREP_ENABLE_GNURBS_INTERFACE) IF(NOT TARGET gnurbs-dynamic AND NOT INSIDE_CADXFEM_TREE) add_subdirectory(gnurbs) endif() include_directories(. ${GNURBS_SOURCE_DIR}/api) endif(IBREP_ENABLE_GNURBS_INTERFACE) if(IBREP_ENABLE_GMSH_GMODEL_EXPORT) add_definitions( -DIBREP_ENABLE_GMSH_GMODEL_EXPORT) endif(IBREP_ENABLE_GMSH_GMODEL_EXPORT) IF (NOT DEFINED Boost_FOUND) FIND_PACKAGE(Boost) IF (Boost_FOUND) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR}) ADD_DEFINITIONS( "-DHAS_BOOST" ) ENDIF(Boost_FOUND) ENDIF(NOT DEFINED Boost_FOUND) file(GLOB SRC src/*.c*) set(IBREP_SOURCE ${SRC}) include_directories(src ${EXTERNAL_INCLUDES}) include_directories(.) if (IBREP_ENABLE_GMSH_GMODEL_EXPORT) if(NOT DEFINED GMSH_PATH) set(GMSH_PATH "./gmsh" CACHE STRING "Gmsh Path") add_subdirectory(${GMSH_PATH} "${CMAKE_CURRENT_BINARY_DIR}/gmsh") list(APPEND EXTERNAL_LIBRARIES -lgsl) include_directories(${GMSH_PATH}/Common ${GMSH_PATH}/Numeric ${GMSH_PATH}/Geo ${GMSH_PATH}/Mesh ${GMSH_PATH}/Solver ${GMSH_PATH}/Post ${GMSH_PATH}/Plugin ${GMSH_PATH}/Graphics ${GMSH_PATH}/contrib/DiscreteIntegration ${GMSH_EXTERNAL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/gmsh/Common ${EXTERNAL_INCLUDES} ${GMSH_PATH}/contrib/gmm ${GMSH_PATH}/contrib/MathEx ) endif(NOT DEFINED GMSH_PATH) if(IBREP_ENABLE_GNURBS_INTERFACE OR IBREP_ENABLE_MESH OR IBREP_ENABLE_OCC_INTERFACE) list (APPEND IBREP_LINK_LIBRARIES shared nutil-dynamic ${GMSH_EXTERNAL_LIBRARIES} ) else(BREP_ENABLE_GNURBS_INTERFACE OR IBREP_ENABLE_MESH OR IBREP_ENABLE_OCC_INTERFACE) list (APPEND IBREP_LINK_LIBRARIES shared ${GMSH_EXTERNAL_LIBRARIES} ${ANN_LIB}) endif(IBREP_ENABLE_GNURBS_INTERFACE OR IBREP_ENABLE_MESH OR IBREP_ENABLE_OCC_INTERFACE) file(GLOB SRCG gmodel/*.c*) set(IBREP_SOURCE ${IBREP_SOURCE} ${SRCG}) include_directories(gmodel) add_library(ibrep-dynamic SHARED ${IBREP_SOURCE} ) add_library(ibrep-static EXCLUDE_FROM_ALL ${IBREP_SOURCE} ) SET_TARGET_PROPERTIES(ibrep-static PROPERTIES OUTPUT_NAME "ibrep") SET_TARGET_PROPERTIES(ibrep-dynamic PROPERTIES OUTPUT_NAME "ibrep") target_link_libraries(ibrep-dynamic ${IBREP_LINK_LIBRARIES}) target_link_libraries(ibrep-static ${IBREP_LINK_LIBRARIES}) else(IBREP_ENABLE_GMSH_GMODEL_EXPORT) add_library(ibrep-dynamic SHARED ${IBREP_SOURCE} ) add_library(ibrep-static EXCLUDE_FROM_ALL ${IBREP_SOURCE} ) SET_TARGET_PROPERTIES(ibrep-static PROPERTIES OUTPUT_NAME "ibrep") SET_TARGET_PROPERTIES(ibrep-dynamic PROPERTIES OUTPUT_NAME "ibrep") target_link_libraries(ibrep-dynamic ${IBREP_LINK_LIBRARIES}) target_link_libraries(ibrep-static ${IBREP_LINK_LIBRARIES}) endif(IBREP_ENABLE_GMSH_GMODEL_EXPORT) add_executable(ibrep2msh ${IBREP_SOURCE} gmodel/ibrep2msh.cc ) target_link_libraries(ibrep2msh ${IBREP_LINK_LIBRARIES} ) add_subdirectory(test) if (IBREP_ENABLE_MESH) add_subdirectory(mesh) if(IBREP_ENABLE_GNURBS_INTERFACE) add_subdirectory(gnurbs_interface) if(IBREP_ENABLE_OCC_INTERFACE) add_subdirectory(occ) endif(IBREP_ENABLE_OCC_INTERFACE) endif(IBREP_ENABLE_GNURBS_INTERFACE) endif(IBREP_ENABLE_MESH)