-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
153 lines (132 loc) · 3.86 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
cmake_minimum_required(VERSION 3.30)
project(PennerOptimization)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-fPIC)
add_compile_options(-Wno-register)
set(DIR_EXT "${CMAKE_CURRENT_SOURCE_DIR}/ext")
# Set options if top level
if (PROJECT_IS_TOP_LEVEL)
# Options to generate python bindings
option(USE_PYBIND "Generate pybindings" ON)
# Alternative library options
option(USE_MULTIPRECISION "Use high precision floating point" OFF)
option(USE_EMBREE "Use Embree for rendering" OFF)
option(USE_SUITESPARSE "Use suite sparse methods for matrix inversion" ON)
option(USE_COMISO "Use Comiso for field generation" ON)
# Visualization options
option(ENABLE_VISUALIZATION "Generate viewers for visualization" ON)
option(RENDER_TEXTURE "Render results" ON)
# Validity check options
option(BUILD_CURVATURE_METRIC_TESTS "Build tests" ON)
option(CHECK_VALIDITY "Check validity pre and post conditions" ON)
# Set default libigl and suitesparse options
option(LIBIGL_PREDICATES "Use Predicates" ON)
set ( SUITESPARSE_ENABLE_PROJECTS "suitesparse_config;cholmod;spqr" )
option ( SUITESPARSE_USE_CUDA OFF )
endif()
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(boost)
include(eigen)
# Optionally get multiprecision libraries
if(USE_MULTIPRECISION)
# Turning this on activates mpfr in the conformal code
option(LIBIGL_COPYLEFT_CGAL "Use CGAL" ON)
add_compile_definitions(WITH_MPFR)
find_package(MPFR REQUIRED QUIET)
include_directories(${MPFR_INCLUDE_DIR})
include_directories(${GMP_INCLUDE_DIR})
link_directories(${MPFR_LIBRARIES_DIR})
endif()
# Optionally get frame field libraries
if (USE_COMISO)
add_compile_definitions(USE_COMISO)
option(LIBIGL_COPYLEFT_COMISO "Use COSIMO" ON)
set(COMISO_LIBS
igl_copyleft::comiso
)
endif()
# Set libigl options for rendering if enabled
if (RENDER_TEXTURE)
option(LIBIGL_OPENGL "Use OpenGL" ON)
option(LIBIGL_GLFW "Use GLFW" ON)
option(LIBIGL_PNG "Use PNG" ON)
endif()
if (USE_EMBREE)
option(LIBIGL_EMBREE "Use EMBREE" ON)
endif()
# Set compile definitions
add_compile_definitions(_USE_MATH_DEFINES)
if(USE_MULTIPRECISION)
add_compile_definitions(MULTIPRECISION)
endif()
if(CHECK_VALIDITY)
add_compile_definitions(CHECK_VALIDITY)
endif()
if (RENDER_TEXTURE)
add_compile_definitions(RENDER_TEXTURE)
endif()
if (USE_EMBREE)
add_compile_definitions(USE_EMBREE)
endif()
if(USE_PYBIND)
add_compile_definitions(PYBIND)
endif()
# WARNING: This compile definition publicly links suitesparse into the
# conformal ideal delaunay library
if(USE_SUITESPARSE)
add_compile_definitions(USE_SUITESPARSE)
set(SUITESPARSE_LIBS
SuiteSparse::SuiteSparseConfig
SuiteSparse::SPQR
SuiteSparse::CHOLMOD
)
endif()
# Get external libraries
include(conformal_ideal_delaunay)
include(libigl)
include(spectra)
include(cli11)
include(json)
include(geometry-central)
# Optionally create rendering library
if(RENDER_TEXTURE)
# Build core rendering library
# TODO: Move somewhere reasonable
add_library(rendering
src/optimization/util/visualization.cc
)
target_include_directories(rendering PUBLIC include/optimization/optimization/util)
target_link_libraries(rendering PUBLIC
igl::core
igl::glfw
igl::png
plot
)
# Link in embree if enabled
if(USE_EMBREE)
target_link_libraries(rendering PUBLIC
igl::embree
)
endif()
# Change rendering libraries from null to singleton
set(RENDER_LIBRARIES
rendering
)
endif()
# Optionally enable polyscope visualization
if(ENABLE_VISUALIZATION)
add_compile_definitions(ENABLE_VISUALIZATION)
include(polyscope)
set(POLYSCOPE_LIBRARIES
polyscope
)
endif()
# Optionally build pybind
if(USE_PYBIND)
include(pybind11)
endif()
# Install executables to bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Make main cpp library
add_subdirectory(src)