-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
217 lines (193 loc) · 6.28 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
cmake_minimum_required(VERSION 3.3)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
################################################################################
################################################################################
# Options
################################################################################
# tetshell
option(TETSHELL_LIBONLY "Use TetShell as a library, without executables" OFF)
# tetwild
option(TETWILD_WITH_HUNTER "Use Hunter to download and configure Boost" OFF)
option(TETWILD_WITH_ISPC "Use ISPC" OFF)
option(TETWILD_WITH_ASAN "Use ASAN" OFF)
# libigl library
option(LIBIGL_USE_STATIC_LIBRARY "Use libigl as static library" OFF)
option(LIBIGL_WITH_CGAL "Use CGAL" ON)
if (NOT TETSHELL_LIBONLY)
option(LIBIGL_WITH_TETGEN "Use Tetgen" ON)
endif()
# gui
option(LIBIGL_WITH_EMBREE "Use Embree" OFF)
option(LIBIGL_WITH_NANOGUI "Use Nanogui menu" OFF)
option(LIBIGL_WITH_OPENGL "Use OpenGL" OFF)
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" OFF)
option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" OFF)
if(TETWILD_WITH_HUNTER)
# Needs to be set before the main project... argh =/
include(HunterGate)
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.25.tar.gz"
SHA1 "cb75cce9a3a8d552e70e7118f3203eb4ac05c201"
)
endif()
################################################################################
# Project name
################################################################################
project(ConformingTetShell)
################################################################################
# Settings
################################################################################
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
set(TETWILD_EXTERNAL "${CMAKE_CURRENT_SOURCE_DIR}/extern")
# Color output
include(UseColors)
# Use folder in Visual Studio
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Extra warnings
include(Warnings)
# Export compile flags (used for autocompletion of the C++ code)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
# Generate position independent code
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
################################################################################
# 3rd party libraries
################################################################################
include(TetWildDependencies)
################################################################################
# TetWild
################################################################################
# Build static library for executable
add_library(libTetShell
include/tetwild/Args.h
include/tetwild/Exception.h
include/tetwild/Logger.h
include/tetwild/tetwild.h
src/tetwild/BSPSubdivision.cpp
src/tetwild/BSPSubdivision.h
src/tetwild/CGALTypes.h
src/tetwild/Common.cpp
src/tetwild/Common.h
src/tetwild/DelaunayTetrahedralization.cpp
src/tetwild/DelaunayTetrahedralization.h
src/tetwild/DistanceQuery.cpp
src/tetwild/DistanceQuery.h
src/tetwild/EdgeCollapser.cpp
src/tetwild/EdgeCollapser.h
src/tetwild/EdgeRemover.cpp
src/tetwild/EdgeRemover.h
src/tetwild/EdgeSplitter.cpp
src/tetwild/EdgeSplitter.h
src/tetwild/ForwardDecls.h
src/tetwild/InoutFiltering.cpp
src/tetwild/InoutFiltering.h
src/tetwild/LocalOperations.cpp
src/tetwild/LocalOperations.h
src/tetwild/Logger.cpp
src/tetwild/MeshConformer.cpp
src/tetwild/MeshConformer.h
src/tetwild/MeshRefinement.cpp
src/tetwild/MeshRefinement.h
src/tetwild/Preprocess.cpp
src/tetwild/Preprocess.h
src/tetwild/SimpleTetrahedralization.cpp
src/tetwild/SimpleTetrahedralization.h
src/tetwild/State.cpp
src/tetwild/State.h
src/tetwild/TetmeshElements.cpp
src/tetwild/TetmeshElements.h
src/tetwild/tetwild.cpp
src/tetwild/VertexSmoother.cpp
src/tetwild/VertexSmoother.h
src/tetwild/geogram/mesh_AABB.cpp
src/tetwild/geogram/mesh_AABB.h
src/shell/common.hpp
src/shell/Label.cpp
src/shell/Label.h
src/shell/Shell.cpp
src/shell/Shell.h
src/shell/Utils.cpp
src/shell/Utils.h
src/shell/ShellCheck.cpp
src/shell/ShellCheck.h
src/shell/TetMeshCheck.cpp
src/shell/TetMeshCheck.h
src/shell/OptimalEnergy.cpp
src/shell/OptimalEnergy.h
)
target_include_directories(libTetShell
PUBLIC
src
include
)
target_link_libraries(libTetShell
PUBLIC
geogram
igl::core
pymesh::pymesh
spdlog::spdlog
fmt::fmt
highfive
PRIVATE
igl::cgal
warnings::all
)
set_target_properties(libTetShell PROPERTIES OUTPUT_NAME "tetwild")
# ispc
if (TETWILD_WITH_ISPC)
message(STATUS "Compiling energy with ISPC")
add_subdirectory(src/ispc)
ispc_add_energy(libTetShell)
endif()
# ASAN
if (TETWILD_WITH_ASAN)
message(STATUS "Compiling with ASAN")
target_compile_options(libTetShell PUBLIC "-fsanitize=address")
target_link_options(libTetShell PUBLIC "-fsanitize=address")
endif()
# Building executable test
if (NOT TETSHELL_LIBONLY)
add_executable(TetShellTest EXCLUDE_FROM_ALL src/test/main_test.cpp)
target_link_libraries(TetShellTest
libTetShell
CLI11::CLI11
igl::cgal
warnings::all
)
target_include_directories(TetShellTest PRIVATE src)
igl_copy_cgal_dll(TetShellTest)
# Building executable tetgen
if (TETSHELL_TEST_TETGEN)
add_executable(TetGen EXCLUDE_FROM_ALL src/test/main_tetgen.cpp)
target_link_libraries(TetGen
libTetShell
igl::core
igl::tetgen
warnings::all
)
target_include_directories(TetGen PRIVATE src)
endif()
# Building main executable
add_executable(TetShell src/main.cpp)
target_link_libraries(TetShell
libTetShell
CLI11::CLI11
igl::cgal
warnings::all
)
target_include_directories(TetShell PRIVATE src)
igl_copy_cgal_dll(TetShell)
# Install
install(TARGETS TetShell RUNTIME DESTINATION bin)
endif()
################################################################################
# Folders for Visual Studio/XCode IDEs
################################################################################
# geogram
set_target_properties(geogram PROPERTIES FOLDER extern/geogram)
set_target_properties(geogram_third_party PROPERTIES FOLDER extern/geogram)
set_target_properties(uninstall PROPERTIES FOLDER extern/geogram)
# pymesh
set_target_properties(pymesh_tiny PROPERTIES FOLDER extern/pymesh)