ReducedModelOptimization/CMakeLists.txt

93 lines
3.4 KiB
CMake

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)
##matplot++ lib
download_project(PROJ MATPLOTPLUSPLUS
GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus
GIT_TAG master
PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/build/external/
${UPDATE_DISCONNECTED_IF_AVAILABLE}
)
add_subdirectory(${MATPLOTPLUSPLUS_SOURCE_DIR})
#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()
#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)
#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)
##Eigen 3 NOTE: Eigen is required on the system the code is ran
find_package(Eigen3 3.3 REQUIRED)
file(GLOB MYSOURCES ${MYSOURCES_SOURCE_DIR}/*.hpp ${MYSOURCES_SOURCE_DIR}/*.cpp
)
#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} ${MYSOURCES} ${EXT_SOURCES} )
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
target_include_directories(${PROJECT_NAME}
PRIVATE ${vcglib_devel_SOURCE_DIR}
PRIVATE ${MYSOURCES_SOURCE_DIR}
PRIVATE ${MYSOURCES_SOURCE_DIR}/boost_graph
)
link_directories(${MYSOURCES_SOURCE_DIR}/boost_graph/libs)
target_link_libraries(${PROJECT_NAME} polyscope Eigen3::Eigen matplot dlib::dlib)