cmake_minimum_required(VERSION 2.8) project(ReducedModelOptimization) #Add the project cmake scripts to the module path list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) #Download external dependencies NOTE: If the user has one of these libs it shouldn't be downloaded again. include(${CMAKE_MODULE_PATH}/DownloadProject.cmake) if (CMAKE_VERSION VERSION_LESS 3.2) set(UPDATE_DISCONNECTED_IF_AVAILABLE "") else() set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1") endif() ##Create directory for the external libraries file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/build/external) #find_package(OpenMP REQUIRED) ##Polyscope set(USE_POLYSCOPE FALSE) if(${USE_POLYSCOPE}) download_project(PROJ POLYSCOPE GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git GIT_TAG master PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/ ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) add_subdirectory(${POLYSCOPE_SOURCE_DIR}) add_compile_definitions(POLYSCOPE_DEFINED) endif() set(MYSOURCES_SOURCE_DIR "/home/iason/Coding/Libraries/MySources") if (EXISTS ${MYSOURCES_SOURCE_DIR}) else() ##MySources download_project(PROJ MYSOURCES GIT_REPOSITORY https://gitea-s2i2s.isti.cnr.it/manolas/MySources.git GIT_TAG master PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/ ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) endif() add_subdirectory(${MYSOURCES_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/MySourcesBinDir) ##dlib download_project(PROJ DLIB GIT_REPOSITORY https://github.com/davisking/dlib.git GIT_TAG master PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/ ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) add_subdirectory(${DLIB_SOURCE_DIR}) ##vcglib devel branch download_project(PROJ vcglib_devel GIT_REPOSITORY https://github.com/IasonManolas/vcglib.git GIT_TAG devel PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/ ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) file(GLOB EXT_SOURCES ${vcglib_devel_SOURCE_DIR}/wrap/ply/plylib.cpp) ##threed-beam-fea download_project(PROJ threed-beam-fea GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git GIT_TAG master PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/ ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) add_subdirectory(${threed-beam-fea_SOURCE_DIR} ${threed-beam-fea_BINARY_DIR}) ##Eigen 3 NOTE: Eigen is required on the system the code is ran find_package(Eigen3 3.3 REQUIRED) #find_package(OpenMP REQUIRED) #Add the project sources file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hpp ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) if(MSVC) add_compile_definitions(_HAS_STD_BYTE=0) endif(MSVC) add_executable(${PROJECT_NAME} ${SOURCES} ${EXT_SOURCES}) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) target_include_directories(${PROJECT_NAME} PUBLIC ${vcglib_devel_SOURCE_DIR} PUBLIC ${threed-beam-fea_SOURCE_DIR}/include PUBLIC ${MYSOURCES_SOURCE_DIR} PUBLIC ${MYSOURCES_SOURCE_DIR}/boost_graph ) target_link_directories(${PROJECT_NAME} PRIVATE ${MYSOURCES_SOURCE_DIR}/boost_graph/libs/) if(${USE_POLYSCOPE}) target_link_libraries(${PROJECT_NAME} polyscope Eigen3::Eigen matplot dlib::dlib ThreedBeamFEA MySources) else() target_link_libraries(${PROJECT_NAME} -static Eigen3::Eigen matplot dlib::dlib ThreedBeamFEA MySources) endif()