This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 126
/
CMakeLists.txt
251 lines (183 loc) · 5.4 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
cmake_minimum_required(VERSION 3.0)
project(tin-terrain)
option(TNTN_TEST "include test targets in the buildsystem" OFF)
option(TNTN_DOWNLOAD_DEPS "download dependencies during cmake configure" ON)
#option(TNTN_USE_ADDONS "" OFF)
set(CMAKE_CXX_STANDARD 14)
# get the current working branch
execute_process(
COMMAND git describe --all --dirty
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE TNTN_GIT_DESCRIPTION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# last commit hash
execute_process(
COMMAND git log -1 --format=%H
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE TNTN_GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(TIMESTAMP TNTN_TIMESTAMP "%Y%m%dT%H%MZ" UTC)
find_package(GDAL REQUIRED)
if(NOT GDAL_FOUND)
message(FATAL_ERROR "GDAL not found, cannot proceed")
endif()
if(NOT GDAL_CONFIG)
message(FATAL_ERROR "gdal-config command not found (not in PATH?), cannot proceed")
endif()
execute_process(
COMMAND ${GDAL_CONFIG} --version
OUTPUT_VARIABLE SYSTEM_GDAL_VERSION
)
if(SYSTEM_GDAL_VERSION VERSION_LESS "2.2")
message(FATAL_ERROR "GDAL version \"${SYSTEM_GDAL_VERSION}\" is too old, at least 2.2 is required")
endif()
# Boost
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED COMPONENTS
program_options
filesystem
system
)
include("download-deps.cmake")
find_path(TNTN_LIBGLM_SOURCE_DIR NAMES "glm/glm.hpp" HINTS "${CMAKE_SOURCE_DIR}/3rdparty/glm-0.9.9.0/")
find_path(TNTN_LIBFMT_SOURCE_DIR NAMES "include/fmt/format.h" HINTS "${CMAKE_SOURCE_DIR}/3rdparty/fmt-5.1.0/")
find_path(TNTN_CATCH2_SOURCE_DIR NAMES "catch.hpp" HINTS "${CMAKE_SOURCE_DIR}/3rdparty/Catch2-2.3.0/")
if(NOT TNTN_LIBGLM_SOURCE_DIR)
message(SEND_ERROR "GLM math library source dir not found, please download and set TNTN_LIBGLM_SOURCE_DIR")
endif()
if(NOT TNTN_LIBFMT_SOURCE_DIR)
message(SEND_ERROR "libfmt string formatting library source dir not found, please download and set TNTN_LIBFMT_SOURCE_DIR")
endif()
add_subdirectory("${TNTN_LIBFMT_SOURCE_DIR}")
set(TNTN_SOURCE_FILES
src/dem2tintiles_workflow.cpp
include/tntn/dem2tintiles_workflow.h
src/TileMaker.cpp
include/tntn/TileMaker.h
src/MercatorProjection.cpp
include/tntn/MercatorProjection.h
include/tntn/MeshMode.h
include/tntn/Mesh.h
src/Mesh.cpp
include/tntn/QuadEdge.h
src/QuadEdge.cpp
include/tntn/DelaunayMesh.h
src/DelaunayMesh.cpp
include/tntn/DelaunayTriangle.h
src/DelaunayTriangle.cpp
include/tntn/TerraMesh.h
src/TerraMesh.cpp
include/tntn/TerraUtils.h
src/TerraUtils.cpp
include/tntn/terra_meshing.h
src/terra_meshing.cpp
include/tntn/zemlya_meshing.h
src/zemlya_meshing.cpp
include/tntn/MeshIO.h
src/MeshIO.cpp
include/tntn/geometrix.h
src/geometrix.cpp
include/tntn/SurfacePoints.h
src/SurfacePoints.cpp
include/tntn/ZoomRange.h
include/tntn/util.h
src/util.cpp
include/tntn/logging.h
src/logging.cpp
include/tntn/OFFReader.h
src/OFFReader.cpp
include/tntn/Raster.h
include/tntn/RasterIO.h
src/RasterIO.cpp
include/tntn/Mesh2Raster.h
src/Mesh2Raster.cpp
include/tntn/SuperTriangle.h
src/SuperTriangle.cpp
include/tntn/raster_tools.h
src/raster_tools.cpp
include/tntn/FileFormat.h
include/tntn/tntn_assert.h
include/tntn/File.h
src/File.cpp
include/tntn/QuantizedMeshIO.h
src/QuantizedMeshIO.cpp
include/tntn/MeshWriter.h
src/MeshWriter.cpp
include/tntn/ObjPool.h
include/tntn/benchmark_workflow.h
src/benchmark_workflow.cpp
include/tntn/simple_meshing.h
src/simple_meshing.cpp
include/tntn/Points2Mesh.h
src/Points2Mesh.cpp
include/tntn/endianness.h
include/tntn/BinaryIO.h
src/BinaryIO.cpp
include/tntn/version_info.h
src/version_info.cpp.in
"${CMAKE_CURRENT_BINARY_DIR}/version_info.cpp"
include/tntn/RasterOverviews.h
src/RasterOverviews.cpp
include/tntn/gdal_init.h
src/gdal_init.cpp
include/delaunator_cpp/Delaunator.h
src/Delaunator.cpp
include/tntn/println.h
src/println.cpp
include/tntn/ZemlyaMesh.h
src/ZemlyaMesh.cpp
)
if(TNTN_USE_ADDONS)
list(APPEND TNTN_SOURCE_FILES
include/tntn/Raster2Mesh.h
src/Raster2Mesh.cpp
)
endif()
configure_file(src/version_info.cpp.in version_info.cpp)
add_library(tntn STATIC
${TNTN_SOURCE_FILES}
)
target_compile_definitions(tntn PUBLIC $<$<CONFIG:Debug>:TNTN_DEBUG>)
target_compile_definitions(tntn PUBLIC GLM_FORCE_SWIZZLE GLM_ENABLE_EXPERIMENTAL)
if(TNTN_DOWNLOAD_ADDONS)
target_compile_definitions(tntn PUBLIC TNTN_USE_ADDONS=1)
endif()
target_include_directories(tntn
PUBLIC
${TNTN_LIBGLM_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include/
${Boost_INCLUDE_DIRS}
PRIVATE
${GDAL_INCLUDE_DIR}
)
if(TNTN_USE_ADDONS)
target_include_directories(tntn
PUBLIC
3rdparty/addons/include/
)
endif()
target_link_libraries(tntn
PUBLIC
${Boost_LIBRARIES}
fmt
PRIVATE
${GDAL_LIBRARY}
)
add_executable(tin-terrain
src/cmd.cpp
)
target_include_directories(tin-terrain
PRIVATE
${Boost_INCLUDE_DIRS}
)
target_link_libraries(tin-terrain
PRIVATE
${Boost_LIBRARIES}
tntn
)
if(TNTN_TEST)
add_subdirectory(test)
endif()