2022-05-06 15:12:42 +02:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
2021-03-15 17:57:43 +01:00
|
|
|
project(MySources)
|
2022-01-05 13:10:49 +01:00
|
|
|
|
|
|
|
file(GLOB MySourcesFiles ${CMAKE_CURRENT_LIST_DIR}/*.hpp ${CMAKE_CURRENT_LIST_DIR}/*.cpp)
|
|
|
|
add_library(${PROJECT_NAME} ${MySourcesFiles} )
|
|
|
|
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
|
|
|
|
|
2021-03-15 17:57:43 +01:00
|
|
|
#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()
|
2021-04-08 20:03:23 +02:00
|
|
|
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})
|
2022-01-28 18:59:42 +01:00
|
|
|
|
2022-05-06 15:12:42 +02:00
|
|
|
##dlib
|
|
|
|
#set(DLIB_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}/dlib)
|
|
|
|
#download_project(PROJ DLIB
|
|
|
|
# GIT_REPOSITORY https://github.com/davisking/dlib.git
|
|
|
|
# GIT_TAG master
|
|
|
|
# BINARY_DIR ${DLIB_BIN_DIR}
|
|
|
|
# PREFIX ${EXTERNAL_DEPS_DIR}
|
|
|
|
# ${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
|
|
#)
|
|
|
|
#add_subdirectory(${DLIB_SOURCE_DIR} ${DLIB_BIN_DIR})
|
|
|
|
#if(${MYSOURCES_STATIC_LINK})
|
|
|
|
# target_link_libraries(${PROJECT_NAME} PUBLIC -static dlib::dlib)
|
|
|
|
#else()
|
|
|
|
# target_link_libraries(${PROJECT_NAME} PUBLIC dlib::dlib)
|
|
|
|
#endif()
|
|
|
|
#add_compile_definitions(DLIB_DEFINED)
|
2022-01-28 18:59:42 +01:00
|
|
|
|
2021-11-15 10:08:39 +01:00
|
|
|
if(${USE_POLYSCOPE})
|
2021-12-23 14:51:23 +01:00
|
|
|
set(POLYSCOPE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/polyscope)
|
|
|
|
download_project(PROJ POLYSCOPE
|
|
|
|
GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git
|
|
|
|
GIT_TAG master
|
|
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
|
|
|
BINARY_DIR ${POLYSCOPE_BINARY_DIR}
|
|
|
|
${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
|
|
)
|
|
|
|
add_subdirectory(${POLYSCOPE_SOURCE_DIR} ${POLYSCOPE_BINARY_DIR})
|
|
|
|
add_compile_definitions(POLYSCOPE_DEFINED)
|
2022-01-05 13:10:49 +01:00
|
|
|
target_sources(${PROJECT_NAME} PUBLIC ${POLYSCOPE_SOURCE_DIR}/deps/imgui/imgui/misc/cpp/imgui_stdlib.cpp)
|
2022-05-06 15:12:42 +02:00
|
|
|
if(${USE_POLYSCOPE})
|
|
|
|
message("Using polyscope here")
|
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC polyscope)
|
|
|
|
endif()
|
2021-11-15 10:08:39 +01:00
|
|
|
endif()
|
2021-12-23 14:51:23 +01:00
|
|
|
|
2021-03-15 17:57:43 +01:00
|
|
|
##vcglib devel branch
|
|
|
|
download_project(PROJ vcglib_devel
|
2022-01-05 13:10:49 +01:00
|
|
|
GIT_REPOSITORY https://gitea-s2i2s.isti.cnr.it/manolas/vcglib.git
|
2021-03-15 17:57:43 +01:00
|
|
|
GIT_TAG devel
|
2021-04-08 20:03:23 +02:00
|
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
2021-03-15 17:57:43 +01:00
|
|
|
${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
|
|
)
|
2021-11-15 19:17:14 +01:00
|
|
|
add_subdirectory(${vcglib_devel_SOURCE_DIR} ${vcglib_devel_BINARY_DIR})
|
2022-05-06 15:12:42 +02:00
|
|
|
|
|
|
|
#add_subdirectory("/home/iason/Coding/Libraries/vcglib" ${CMAKE_CURRENT_BINARY_DIR}/vcglib)
|
|
|
|
#target_include_directories(${PROJECT_NAME} PUBLIC "/home/iason/Coding/Libraries/vcglib")
|
2022-01-05 13:10:49 +01:00
|
|
|
target_sources(${PROJECT_NAME} PUBLIC ${vcglib_devel_SOURCE_DIR}/wrap/ply/plylib.cpp)
|
2021-12-23 14:51:23 +01:00
|
|
|
|
2021-12-19 19:15:36 +01:00
|
|
|
##matplot++ lib
|
2021-12-23 14:51:23 +01:00
|
|
|
set(MATPLOTPLUSPLUS_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/matplot)
|
2021-12-19 19:15:36 +01:00
|
|
|
download_project(PROJ MATPLOTPLUSPLUS
|
|
|
|
GIT_REPOSITORY https://github.com/alandefreitas/matplotplusplus
|
|
|
|
GIT_TAG master
|
2021-12-23 14:51:23 +01:00
|
|
|
BINARY_DIR ${MATPLOTPLUSPLUS_BINARY_DIR}
|
2021-12-19 19:15:36 +01:00
|
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
|
|
|
${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
|
|
)
|
|
|
|
add_subdirectory(${MATPLOTPLUSPLUS_SOURCE_DIR} ${MATPLOTPLUSPLUS_BINARY_DIR})
|
2021-12-23 14:51:23 +01:00
|
|
|
|
2021-04-08 20:03:23 +02:00
|
|
|
##threed-beam-fea
|
2021-12-23 14:51:23 +01:00
|
|
|
set(threed-beam-fea_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/threed-beam-fea)
|
2021-04-08 20:03:23 +02:00
|
|
|
download_project(PROJ threed-beam-fea
|
2022-01-28 18:59:42 +01:00
|
|
|
# GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git
|
|
|
|
GIT_REPOSITORY https://gitea-s2i2s.isti.cnr.it/manolas/threed-beam-fea.git
|
2021-04-08 20:03:23 +02:00
|
|
|
GIT_TAG master
|
2021-12-23 14:51:23 +01:00
|
|
|
BINARY_DIR ${threed-beam-fea_BINARY_DIR}
|
2021-04-08 20:03:23 +02:00
|
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
|
|
|
${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
|
|
)
|
|
|
|
add_subdirectory(${threed-beam-fea_SOURCE_DIR} ${threed-beam-fea_BINARY_DIR})
|
2021-12-23 14:51:23 +01:00
|
|
|
|
2021-12-19 19:15:36 +01:00
|
|
|
##TBB
|
2021-12-23 14:51:23 +01:00
|
|
|
set(TBB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/tbb)
|
2021-12-19 19:15:36 +01:00
|
|
|
download_project(PROJ TBB
|
|
|
|
GIT_REPOSITORY https://github.com/wjakob/tbb.git
|
|
|
|
GIT_TAG master
|
|
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
2021-12-23 14:51:23 +01:00
|
|
|
BINARY_DIR ${TBB_BINARY_DIR}
|
2021-12-19 19:15:36 +01:00
|
|
|
${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
|
|
)
|
|
|
|
option(TBB_BUILD_TESTS "Build TBB tests and enable testing infrastructure" OFF)
|
|
|
|
add_subdirectory(${TBB_SOURCE_DIR} ${TBB_BINARY_DIR})
|
|
|
|
link_directories(${TBB_BINARY_DIR})
|
2022-01-28 18:59:42 +01:00
|
|
|
|
2021-03-15 17:57:43 +01:00
|
|
|
###Eigen 3 NOTE: Eigen is required on the system the code is ran
|
|
|
|
find_package(Eigen3 3.3 REQUIRED)
|
2021-05-01 17:44:54 +02:00
|
|
|
if(MSVC)
|
|
|
|
add_compile_definitions(_HAS_STD_BYTE=0)
|
|
|
|
endif(MSVC)
|
2021-03-15 17:57:43 +01:00
|
|
|
#link_directories(${CMAKE_CURRENT_LIST_DIR}/boost_graph/libs)
|
2022-01-05 13:10:49 +01:00
|
|
|
|
2022-05-06 15:12:42 +02:00
|
|
|
#set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
|
2021-12-19 19:15:36 +01:00
|
|
|
if(${MYSOURCES_STATIC_LINK})
|
2022-05-06 15:12:42 +02:00
|
|
|
message("STATIC LINK MY SOURCES:" ${MYSOURCES_STATIC_LINK})
|
|
|
|
endif()
|
|
|
|
if(${MYSOURCES_STATIC_LINK})
|
|
|
|
message("Linking statically here")
|
2022-01-28 18:59:42 +01:00
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC -static Eigen3::Eigen matplot ThreedBeamFEA tbb_static pthread gfortran quadmath)
|
2021-12-19 19:15:36 +01:00
|
|
|
else()
|
2022-01-05 13:10:49 +01:00
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen matplot ThreedBeamFEA tbb pthread)
|
2021-12-15 14:19:21 +01:00
|
|
|
endif()
|
2022-05-06 15:12:42 +02:00
|
|
|
|
2021-12-19 19:15:36 +01:00
|
|
|
target_link_directories(MySources PUBLIC ${CMAKE_CURRENT_LIST_DIR}/boost_graph/libs)
|
2022-01-05 13:10:49 +01:00
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/boost_graph
|
|
|
|
PUBLIC ${vcglib_devel_SOURCE_DIR}
|
2022-01-28 18:59:42 +01:00
|
|
|
PUBLIC ${threed-beam-fea_SOURCE_DIR}
|
2022-05-06 15:12:42 +02:00
|
|
|
PUBLIC ${MATPLOTPLUSPLUS_SOURCE_DIR}/source
|
2022-01-05 13:10:49 +01:00
|
|
|
)
|
2021-12-15 14:19:21 +01:00
|
|
|
|
2022-05-06 15:12:42 +02:00
|
|
|
|
|
|
|
#if(USE_ENSMALLEN)
|
|
|
|
set(ARMADILLO_SOURCE_DIR "/home/iason/Coding/Libraries/armadillo")
|
|
|
|
set(ARMADILLO_BIN_DIR "/home/iason/Coding/Libraries/armadillo/build")
|
|
|
|
add_subdirectory(${ARMADILLO_SOURCE_DIR} ${ARMADILLO_BIN_DIR})
|
|
|
|
target_include_directories(${PROJECT_NAME} PUBLIC ${ARMADILLO_SOURCE_DIR}/include)
|
|
|
|
add_compile_definitions(ARMA_DONT_USE_WRAPPER)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC #[["/home/iason/Coding/Libraries/armadillo/build/libarmadillo.a"]] blas lapack)
|
|
|
|
find_package(Armadillo REQUIRED)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PUBLIC ${ARMADILLO_LIBRARIES})
|
|
|
|
|
|
|
|
##ENSMALLEN
|
|
|
|
set(ENSMALLEN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/ensmallen)
|
|
|
|
download_project(PROJ ENSMALLEN
|
|
|
|
GIT_REPOSITORY https://github.com/mlpack/ensmallen.git
|
|
|
|
GIT_TAG master
|
|
|
|
BINARY_DIR ${ENSMALLEN_BINARY_DIR}
|
|
|
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
|
|
|
${UPDATE_DISCONNECTED_IF_AVAILABLE}
|
|
|
|
)
|
|
|
|
# add_subdirectory(${ENSMALLEN_SOURCE_DIR} ${ENSMALLEN_BINARY_DIR})
|
|
|
|
# target_link_libraries(${PROJECT_NAME} INTERFACE ensmallen)
|
|
|
|
target_include_directories(${PROJECT_NAME}
|
|
|
|
PUBLIC ${ENSMALLEN_SOURCE_DIR}/include)
|
|
|
|
add_compile_definitions(USE_ENSMALLEN)
|
|
|
|
#endif()
|
|
|
|
|
|
|
|
#find_package(OpenMP REQUIRED)
|
|
|
|
#target_link_libraries(${PROJECT_NAME} OpenMP::OpenMP_CXX)
|
|
|
|
#target_include_directories(${PROJECT_NAME} OpenMP::OpenMP_CXX)
|
|
|
|
|
|
|
|
#message(STATUS "OpenMP_C_INCLUDE_DIRS: ${OpenMP_CXX_INCLUDE_DIRS}")
|