-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
92 lines (71 loc) · 3.37 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
cmake_minimum_required(VERSION 3.15.0)
project(Iso_TLC_SEA LANGUAGES CXX C)
set(CMAKE_CXX_STANDARD 14)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Do not use shared lib.")
include(FetchContent)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
include(Eigen3)
include(cli11)
include(nlohmann-json)
include(nlopt)
include(filesystem)
aux_source_directory(${PROJECT_SOURCE_DIR}/src SRC_LIST)
add_library(injectiveEnergy STATIC ${SRC_LIST})
target_include_directories(injectiveEnergy PUBLIC ${PROJECT_SOURCE_DIR}/src)
target_link_libraries(injectiveEnergy PUBLIC Eigen3::Eigen nlohmann_json::nlohmann_json)
# OpenMP
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(injectiveEnergy PUBLIC OpenMP::OpenMP_CXX)
endif()
# solver_test
add_executable(solver_test apps/solver_test.cpp)
target_link_libraries(solver_test PUBLIC injectiveEnergy nlopt::nlopt)
# TLC (2D)
add_executable(TLC_2D apps/TLC_2D.cpp)
target_link_libraries(TLC_2D PUBLIC injectiveEnergy CLI11::CLI11 nlopt::nlopt ghc::filesystem)
# IsoTLC (2D)
add_executable(IsoTLC_2D apps/IsoTLC_2D.cpp)
target_link_libraries(IsoTLC_2D PUBLIC injectiveEnergy CLI11::CLI11 nlopt::nlopt ghc::filesystem)
# TLC (3D)
# IsoTLC (3D)
# SEA (2D)
# SEA (3D)
# distortion energies (2D)
add_executable(distortion_2D apps/distortion_2D_solver.cpp)
target_link_libraries(distortion_2D PUBLIC injectiveEnergy CLI11::CLI11 nlopt::nlopt ghc::filesystem)
# distortion energies (3D)
add_executable(distortion_3D apps/distortion_3D_solver.cpp)
target_link_libraries(distortion_3D PUBLIC injectiveEnergy CLI11::CLI11 nlopt::nlopt ghc::filesystem)
# suitesparse
set(SUITESPARSE_INCLUDE_DIR /usr/local/include CACHE PATH "suitesparse include directory")
target_include_directories(TLC_2D PUBLIC "${SUITESPARSE_INCLUDE_DIR}")
target_include_directories(IsoTLC_2D PUBLIC "${SUITESPARSE_INCLUDE_DIR}")
target_include_directories(solver_test PUBLIC "${SUITESPARSE_INCLUDE_DIR}")
target_include_directories(distortion_2D PUBLIC "${SUITESPARSE_INCLUDE_DIR}")
target_include_directories(distortion_3D PUBLIC "${SUITESPARSE_INCLUDE_DIR}")
if (WIN32)
# ------------------------------------------------------------------
# Detect SuiteSparse libraries:
# If not found automatically, set SuiteSparse_DIR in CMake to the
# directory where SuiteSparse-config.cmake was installed.
# ------------------------------------------------------------------
find_package(SuiteSparse CONFIG REQUIRED)
target_link_libraries(TLC_2D PRIVATE SuiteSparse::CHOLMOD)
target_link_libraries(IsoTLC_2D PRIVATE SuiteSparse::CHOLMOD)
target_link_libraries(solver_test PRIVATE SuiteSparse::CHOLMOD)
target_link_libraries(distortion_2D PRIVATE SuiteSparse::CHOLMOD)
target_link_libraries(distortion_3D PRIVATE SuiteSparse::CHOLMOD)
else()
set(SUITESPARSE_LIB_DIR /usr/local/lib CACHE PATH "suitesparse library directory")
target_link_libraries(TLC_2D PRIVATE -L"${SUITESPARSE_LIB_DIR}" cholmod)
target_link_libraries(IsoTLC_2D PRIVATE -L"${SUITESPARSE_LIB_DIR}" cholmod)
target_link_libraries(solver_test PRIVATE -L"${SUITESPARSE_LIB_DIR}" cholmod)
target_link_libraries(distortion_2D PRIVATE -L"${SUITESPARSE_LIB_DIR}" cholmod)
target_link_libraries(distortion_3D PRIVATE -L"${SUITESPARSE_LIB_DIR}" cholmod)
endif()
# Math library
find_library(MATH_LIBRARY m)
if(MATH_LIBRARY)
target_link_libraries(injectiveEnergy PUBLIC ${MATH_LIBRARY})
endif()