73 lines
2.7 KiB
CMake
Executable File
73 lines
2.7 KiB
CMake
Executable File
cmake_minimum_required(VERSION 2.8)
|
|
project(MySources)
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
#Download external dependencies NOTE: If the user has one of these libs it shouldn't be downloaded again.
|
|
include(${CMAKE_CURRENT_LIST_DIR}/cmake/DownloadProject.cmake)
|
|
if (CMAKE_VERSION VERSION_LESS 3.2)
|
|
set(UPDATE_DISCONNECTED_IF_AVAILABLE "")
|
|
else()
|
|
set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1")
|
|
endif()
|
|
|
|
set(EXTERNAL_DEPS_DIR "/home/iason/Coding/build/external dependencies")
|
|
if(NOT EXISTS ${EXTERNAL_DEPS_DIR})
|
|
set(EXTERNAL_DEPS_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
endif()
|
|
##Create directory for the external libraries
|
|
file(MAKE_DIRECTORY ${EXTERNAL_DEPS_DIR})
|
|
|
|
##vcglib devel branch
|
|
download_project(PROJ vcglib_devel
|
|
GIT_REPOSITORY https://github.com/IasonManolas/vcglib.git
|
|
GIT_TAG devel
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
|
${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
)
|
|
|
|
##matplot++ lib
|
|
download_project(PROJ MATPLOTPLUSPLUS
|
|
GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus
|
|
GIT_TAG master
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
|
${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
)
|
|
add_subdirectory(${MATPLOTPLUSPLUS_SOURCE_DIR} ${MATPLOTPLUSPLUS_BINARY_DIR})
|
|
|
|
##threed-beam-fea
|
|
download_project(PROJ threed-beam-fea
|
|
GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git
|
|
GIT_TAG master
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
|
${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)
|
|
|
|
if(MSVC)
|
|
add_compile_definitions(_HAS_STD_BYTE=0)
|
|
endif(MSVC)
|
|
|
|
#link_directories(${CMAKE_CURRENT_LIST_DIR}/boost_graph/libs)
|
|
file(GLOB MySourcesFiles ${CMAKE_CURRENT_LIST_DIR}/*.hpp ${CMAKE_CURRENT_LIST_DIR}/*.cpp)
|
|
add_library(${PROJECT_NAME} ${MySourcesFiles} ${vcglib_devel_SOURCE_DIR}/wrap/ply/plylib.cpp)
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/boost_graph
|
|
PUBLIC ${vcglib_devel_SOURCE_DIR}
|
|
PUBLIC ${threed-beam-fea_SOURCE_DIR}
|
|
PUBLIC ${MySourcesFiles}
|
|
)
|
|
|
|
if(${USE_POLYSCOPE})
|
|
find_package(OpenMP REQUIRED)
|
|
target_link_libraries(${PROJECT_NAME} Eigen3::Eigen matplot polyscope glad ThreedBeamFEA OpenMP::OpenMP_CXX)
|
|
else()
|
|
target_link_libraries(${PROJECT_NAME} -static Eigen3::Eigen matplot ThreedBeamFEA)
|
|
endif()
|
|
target_link_directories(MySources PUBLIC ${CMAKE_CURRENT_LIST_DIR}/boost_graph/libs)
|