forked from wildmeshing/wildmeshing-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·168 lines (137 loc) · 5.01 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
# Detects whether this is a top-level project
get_directory_property(HAS_PARENT PARENT_DIRECTORY)
if(HAS_PARENT)
set(WILDMESHING_TOOLKIT_TOPLEVEL_PROJECT OFF)
else()
set(WILDMESHING_TOOLKIT_TOPLEVEL_PROJECT ON)
endif()
# Check required CMake version
set(REQUIRED_CMAKE_VERSION "3.15.0")
if(WILDMESHING_TOOLKIT_TOPLEVEL_PROJECT)
cmake_minimum_required(VERSION ${REQUIRED_CMAKE_VERSION})
else()
# Don't use cmake_minimum_required here to avoid implicitly overriding parent policies
if(${CMAKE_VERSION} VERSION_LESS ${REQUIRED_CMAKE_VERSION})
message(FATAL_ERROR "CMake required version to build the toolkit is ${REQUIRED_CMAKE_VERSION}")
endif()
endif()
# ###############################################################################
project(WildMeshingToolkit DESCRIPTION "A mesh optimization toolkit")
# ###############################################################################
option(WMTK_BUILD_DOCS "Build doxygen" OFF)
option (BUILD_SHARED_LIBS "Build Shared Libraries" OFF) # we globally want to disable this option due to use of TBB
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/recipes/")
include(sanitizers)
include(wmtk_colors)
include(wmtk_warnings)
include(wmtk_copy_dll)
include(tracy)
include(nlohmann_json)
include(hdf5)
include(high_five)
# Sort projects inside the solution
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Generate position independent code by default
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# ###############################################################################
# WildMeshingToolkit library
# ###############################################################################
# Core library
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS
"src/*.cpp"
"src/*.h"
"src/*.hpp"
)
message(DEBUG "SRC_FILES: ${SRC_FILES}")
add_library(wildmeshing_toolkit "${SRC_FILES}")
add_library(wmtk::toolkit ALIAS wildmeshing_toolkit)
# Include headers
target_include_directories(wildmeshing_toolkit PUBLIC src)
# Compile definitions
target_compile_definitions(wildmeshing_toolkit PUBLIC _USE_MATH_DEFINES)
target_compile_definitions(wildmeshing_toolkit PUBLIC NOMINMAX)
# C++ standard
target_compile_features(wildmeshing_toolkit PUBLIC cxx_std_17)
# Set IDE folders
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" PREFIX "Source Files" FILES ${SRC_FILES})
# Dependencies
if(NOT TARGET igl::core)
option(LIBIGL_WITH_OPENGL "Use OpenGL" ON)
option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON)
include(libigl)
endif()
igl_include(predicates)
igl_include(predicates)
if(NOT TARGET spdlog)
include(spdlog)
endif()
include(geogram)
include(onetbb)
include(mshio)
include(metis)
include(gmp)
include(lagrange)
lagrange_include_modules(bvh)
include(nlohmann_json)
target_link_libraries(wildmeshing_toolkit PRIVATE wmtk::warnings)
target_link_libraries(wildmeshing_toolkit PUBLIC
spdlog::spdlog
igl::core
igl::predicates
geogram
TBB::tbb
mshio::mshio
metis::metis
lagrange::core
Tracy::TracyClient
nlohmann_json::nlohmann_json
HighFive::HighFive
hdf5::hdf5
lagrange::bvh
)
include(finite-diff)
target_link_libraries(wildmeshing_toolkit PUBLIC finitediff::finitediff)
include(stb)
include(tinyexr)
target_link_libraries(wildmeshing_toolkit PUBLIC
miniz # MTAO: I had a build issue with windows not finding miniz at linktime - adding here to make sure it's there?
tinyexr
stb)
include(lean-vtk)
target_link_libraries(wildmeshing_toolkit PUBLIC LeanVTK)
include(nanospline)
target_link_libraries(wildmeshing_toolkit PUBLIC nanospline::nanospline)
include(paraviewo)
target_link_libraries(wildmeshing_toolkit PUBLIC paraviewo::paraviewo)
# ###############################################################################
# Subdirectories
# ###############################################################################
# Compile extras only if this is a top-level project
if(WILDMESHING_TOOLKIT_TOPLEVEL_PROJECT)
# Unit tests
enable_testing()
add_subdirectory(tests)
# Demo apps
add_subdirectory(app)
endif()
if(WMTK_BUILD_DOCS)
# check if Doxygen is installed
find_package(Doxygen)
if(DOXYGEN_FOUND)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
# note the option ALL which allows to build the docs together with the application
add_custom_target(wmtk_doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else(DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
endif(DOXYGEN_FOUND)
endif()