forked from CesiumGS/cesium-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
473 lines (402 loc) · 18.9 KB
/
CMakeLists.txt
File metadata and controls
473 lines (402 loc) · 18.9 KB
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
cmake_minimum_required(VERSION 3.15)
if (NOT VCPKG_LIBRARY_LINKAGE)
set(VCPKG_LIBRARY_LINKAGE static)
endif()
get_filename_component(toolchainFile "${CMAKE_TOOLCHAIN_FILE}" NAME)
if(toolchainFile STREQUAL "Emscripten.cmake")
set(CESIUM_TARGET_WASM ON)
# Include the toolchain directly as ezvcpkg will overwrite the
# toolchain before it's loaded
include(${CMAKE_TOOLCHAIN_FILE})
endif()
# By default, Use ezvcpkg to install dependencies. But don't use
# ezvcpkg if it appears that this configuration is using vcpkg
# manifest mode already, either by building cesium-native directly,
# or via a higher level project that has added cesium-native as a
# subdirectory and is using vcpkg to statisfy its dependencies.
#In a fresh build, before CMakeCache.txt exists, determine whether to
#use ezvcpkg. After this, CESIUM_USE_EZVCPG will be in the cache.
set(CESIUM_USE_EZVCPKG_DEFAULT ON)
if (VCPKG_MANIFEST_MODE)
set(CESIUM_USE_EZVCPKG_DEFAULT OFF)
elseif (CMAKE_TOOLCHAIN_FILE)
get_filename_component(toolchainFile "${CMAKE_TOOLCHAIN_FILE}" NAME)
if(toolchainFile STREQUAL "vcpkg.cmake")
set(CESIUM_USE_EZVCPKG_DEFAULT OFF)
endif()
endif()
option(CESIUM_USE_EZVCPKG "use ezvcpkg helper" ${CESIUM_USE_EZVCPKG_DEFAULT})
option(CESIUM_DISABLE_CURL "Disable cesium-native's use of libcurl" OFF)
option(CESIUM_DISABLE_LIBJPEG_TURBO "Disable cesium-native's use of libjpeg-turbo. JPEG images will be decoded with STB instead." OFF)
option(CESIUM_WASM64 "Enable 64-bit WebAssembly target" OFF)
if (CESIUM_TARGET_WASM)
# Make sure curl is disabled on wasm builds, as it is not supported.
set(CESIUM_DISABLE_CURL ON)
endif()
if(CESIUM_USE_EZVCPKG)
# Keep vcpkg from running in manifset mode. It will try to because
# this directory contains a vcpkg.json manifest.
set(VCPKG_MANIFEST_MODE OFF CACHE BOOL "vcpkg manifest mode should not be enabled with ezvcpg!")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ezvcpkg/ezvcpkg.cmake)
endif()
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/detect-vcpkg-triplet.cmake)
# Note: VCPKG_TRIPLET is not used by vcpkg! The relevant variables are
# VCPKG_TARGET_TRIPLET and VCPKG_HOST_TRIPLET. ezvcpkg and our custom
# installation code use VCPKG_TRIPLET, so initialize it here.
if (VCPKG_TARGET_TRIPLET)
set(VCPKG_TRIPLET "${VCPKG_TARGET_TRIPLET}")
endif()
if (NOT VCPKG_TRIPLET)
if (DEFINED ENV{VCPKG_TRIPLET})
set(VCPKG_TRIPLET "$ENV{VCPKG_TRIPLET}")
elseif(DETECTED_VCPKG_TRIPLET_ERROR)
message(FATAL_ERROR "${DETECTED_VCPKG_TRIPLET_ERROR}")
elseif(DETECTED_VCPKG_TRIPLET STREQUAL "x64-windows")
# cesium-native requires static linking on Windows
set(VCPKG_TRIPLET "x64-windows-static-md")
elseif(DETECTED_VCPKG_TRIPLET STREQUAL "wasm32-emscripten")
# Use our custom triplet for wasm builds. Most importantly, this
# enables multithreading support. Also switch to 64-bit wasm if
# requested.
if (CESIUM_WASM64)
set(VCPKG_TRIPLET "wasm64-emscripten-cesium")
else()
set(VCPKG_TRIPLET "wasm32-emscripten-cesium")
endif()
else()
set(VCPKG_TRIPLET "${DETECTED_VCPKG_TRIPLET}")
endif()
# If we're using ezvcpkg, ezvcpkg will update CMAKE_TOOLCHAIN_FILE to point to the vcpkg toolchain.
# Which means that when we hit the `project` function call below, cmake will load the vcpkg
# toolchain file. If VCPKG_TARGET_TRIPLET isn't set by that time, vcpkg will set it itself, and
# maybe not to what we want. So set VCPKG_TARGET_TRIPLET explicit here so that we're sure to get
# the right one.
#
# If we're _not_ using ezvcpkg, then we also must set VCPKG_TARGET_TRIPLET, but for a different reason.
# VCPKG_TRIPLET is only an ezvcpkg thing, vcpkg itself only knows about VCPKG_TARGET_TRIPLET.
set(VCPKG_TARGET_TRIPLET "${VCPKG_TRIPLET}")
endif()
message(STATUS "VCPKG_TRIPLET ${VCPKG_TRIPLET}")
message(STATUS "VCPKG_TARGET_TRIPLET ${VCPKG_TARGET_TRIPLET}")
message(STATUS "VCPKG_PLATFORM_TOOLSET_VERSION $ENV{VCPKG_PLATFORM_TOOLSET_VERSION}")
if (NOT VCPKG_OVERLAY_PORTS)
if (DEFINED ENV{VCPKG_OVERLAY_PORTS})
set(VCPKG_OVERLAY_PORTS "$ENV{VCPKG_OVERLAY_PORTS}")
endif()
endif()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/extern/vcpkg/ports")
list(APPEND VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_SOURCE_DIR}/extern/vcpkg/ports")
endif()
message(STATUS "VCPKG_OVERLAY_PORTS ${VCPKG_OVERLAY_PORTS}")
if (NOT VCPKG_OVERLAY_TRIPLETS)
if (DEFINED ENV{VCPKG_OVERLAY_TRIPLETS})
set(VCPKG_OVERLAY_TRIPLETS "$ENV{VCPKG_OVERLAY_TRIPLETS}")
endif()
endif()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/extern/vcpkg/triplets")
list(APPEND VCPKG_OVERLAY_TRIPLETS "${CMAKE_CURRENT_SOURCE_DIR}/extern/vcpkg/triplets")
endif()
message(STATUS "VCPKG_OVERLAY_TRIPLETS ${VCPKG_OVERLAY_TRIPLETS}")
# These packages are used in the public headers of Cesium libraries, so we need to distribute the headers and binaries
# with the installation
# Note that fmt is a public dependency of the vcpkg version of spdlog
# STB is not technically part of the public interface, but it is used by the downstream Cesium for Unreal project
set(PACKAGES_PUBLIC asyncplusplus expected-lite fmt glm rapidjson spdlog stb ada-url)
# These packages are used in the code and produce binaries, but are not part of the public interface. Therefore we need
# to distribute the binaries for linking, but not the headers, as downstream consumers don't need them
# OpenSSL and abseil are both dependencies of s2geometry
set(PACKAGES_PRIVATE
abseil draco ktx[core] modp-base64 meshoptimizer openssl s2geometry
sqlite3 tinyxml2 libwebp zlib-ng picosha2
earcut-hpp libmorton zstd spz zlib
)
# asmjit needed by blend2d on non-iOS platforms (iOS and Wasm don't support JIT)
if(NOT CESIUM_TARGET_WASM AND NOT IOS AND NOT VCPKG_CMAKE_SYSTEM_NAME MATCHES "iOS")
list(APPEND PACKAGES_PRIVATE blend2d asmjit)
else()
# Use [core] feature to disable default jit feature.
list(APPEND PACKAGES_PRIVATE blend2d[core])
endif()
if(NOT CESIUM_DISABLE_CURL)
list(APPEND PACKAGES_PRIVATE curl)
endif()
if(NOT CESIUM_DISABLE_LIBJPEG_TURBO)
list(APPEND PACKAGES_PRIVATE libjpeg-turbo)
endif()
# We use cpp-httplib to host a local web server for OAuth2 authorization. That's not
# going to work at all on the web, and the latest versions of cpp-httplib only support
# 64-bit platforms anyway, so skip it entirely for WebAssembly builds.
if(NOT CESIUM_TARGET_WASM)
list(APPEND PACKAGES_PRIVATE "cpp-httplib[core]")
endif()
# Packages only used for testing
set(PACKAGES_TEST doctest)
if(CESIUM_TARGET_WASM)
# vcpkg will attempt to second-guess our CMAKE_C_COMPILER setting, choosing to go with the value of CC instead.
# While normally this is the correct value to go with, for wasm we need to be using emcc and em++.
# So we set CC and CXX to emcc and em++ here so vcpkg will pick them up properly.
# Does this make sense? No. Does it work? Somehow. ¯\_(ツ)_/¯
set(ENV{CC} ${CMAKE_C_COMPILER})
set(ENV{CXX} ${CMAKE_CXX_COMPILER})
endif()
if(CESIUM_USE_EZVCPKG)
set(PACKAGES_ALL ${PACKAGES_PUBLIC})
list(APPEND PACKAGES_ALL ${PACKAGES_PRIVATE})
list(APPEND PACKAGES_ALL ${PACKAGES_TEST})
ezvcpkg_fetch(
COMMIT afc0a2e01ae104a2474216a2df0e8d78516fd5af
REPO microsoft/vcpkg
PACKAGES ${PACKAGES_ALL}
# Clean the build trees after building, so that we don't use a ton a disk space on the CI cache
CLEAN_BUILDTREES
# Update the cmake toolchain so it can find the above packages
UPDATE_TOOLCHAIN
# Force the installation of each package one at a time, or the Travis CI build will time out waiting for output
SERIALIZE
)
endif()
if (NOT CMAKE_TOOLCHAIN_FILE)
message(FATAL_ERROR "Specify the VCPKG toolchain on the command line as '-DCMAKE_TOOLCHAIN_FILE=<VCPKG_ROOT>/scripts/buildsystems/vcpkg.cmake'")
else()
message(STATUS "CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE}")
endif()
# Set defaults that should be set BEFORE compiler / IDE detection
include("cmake/defaults.cmake")
project(cesium-native
VERSION 0.57.0
LANGUAGES CXX C
)
if(CESIUM_TARGET_WASM)
if(CESIUM_WASM64)
set(CMAKE_SIZEOF_VOID_P 8)
else()
set(CMAKE_SIZEOF_VOID_P 4)
endif()
# Tells emscripten to output an HTML harness for the generated WASM
set(CMAKE_EXECUTABLE_SUFFIX ".html")
endif()
include(GNUInstallDirs)
include(CMakeDependentOption)
set(PACKAGE_BASE_DIR "${EZVCPKG_PACKAGES_DIR}")
set(PACKAGE_BUILD_DIR "${EZVCPKG_DIR}")
if(NOT EZVCPKG_PACKAGES_DIR)
set(PACKAGE_BUILD_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TRIPLET}/")
set(PACKAGE_BASE_DIR "$ENV{VCPKG_ROOT}/packages")
endif()
message(STATUS "PACKAGE_BASE_DIR ${PACKAGE_BASE_DIR}")
message(STATUS "PACKAGE_BUILD_DIR ${PACKAGE_BUILD_DIR}")
option(CESIUM_INSTALL_STATIC_LIBS "Whether to install the static libraries of cesium-native and its dependencies." ON)
option(CESIUM_INSTALL_HEADERS "Whether to install the header files of cesium-native and its public dependencies." ON)
option(CESIUM_ENABLE_CLANG_TIDY "Enable clang-tidy targets for static code analysis." ON)
cmake_dependent_option(
CESIUM_ENABLE_CLANG_TIDY_ON_BUILD
"Run clang-tidy while building. Will slow down the build process. Available only if CESIUM_ENABLE_CLANG_TIDY is ON."
OFF
CESIUM_ENABLE_CLANG_TIDY
OFF
)
set(CESIUM_CLANG_TIDY_USE_THREADS 14 CACHE STRING "Sets the number of threads for run-clang-tidy to use.")
if(CESIUM_INSTALL_STATIC_LIBS OR CESIUM_INSTALL_HEADERS AND EZVCPKG_PACKAGES_DIR)
foreach(PACKAGE ${PACKAGES_PUBLIC})
string(REGEX REPLACE "\\[.*\\]" "" PACKAGE "${PACKAGE}")
set(PACKAGE_DIR "${PACKAGE_BASE_DIR}/${PACKAGE}_${VCPKG_TRIPLET}")
message(DEBUG "PACKAGE_DIR ${PACKAGE_DIR}")
if(CESIUM_INSTALL_HEADERS AND NOT PACKAGE IN_LIST CESIUM_EXCLUDE_INSTALL_HEADERS)
install(
DIRECTORY ${PACKAGE_DIR}/include/
TYPE INCLUDE
)
endif()
if (CESIUM_INSTALL_STATIC_LIBS AND NOT PACKAGE IN_LIST CESIUM_EXCLUDE_INSTALL_STATIC_LIBS AND EXISTS ${PACKAGE_DIR}/lib)
install(
DIRECTORY $<IF:$<CONFIG:Debug>,${PACKAGE_DIR}/debug/lib/,${PACKAGE_DIR}/lib/>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()
endforeach()
endif()
if(CESIUM_INSTALL_STATIC_LIBS AND NOT VCPKG_MANIFEST_MODE)
foreach(PACKAGE ${PACKAGES_PRIVATE})
string(REGEX REPLACE "\\[.*\\]" "" PACKAGE "${PACKAGE}")
set(PACKAGE_DIR "${PACKAGE_BASE_DIR}/${PACKAGE}_${VCPKG_TRIPLET}")
message(DEBUG "PACKAGE_DIR ${PACKAGE_DIR}")
if (NOT PACKAGE IN_LIST CESIUM_EXCLUDE_INSTALL_STATIC_LIBS AND EXISTS ${PACKAGE_DIR}/lib)
install(
DIRECTORY $<IF:$<CONFIG:Debug>,${PACKAGE_DIR}/debug/lib/,${PACKAGE_DIR}/lib/>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()
endforeach()
endif()
if(NOT DEFINED CMAKE_C_COMPILER_LAUNCHER AND NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
find_program(CCACHE_FOUND ccache)
find_program(SCCACHE_FOUND sccache)
if (SCCACHE_FOUND)
message("setting SCCACHE to ${SCCACHE_FOUND}")
set(CMAKE_C_COMPILER_LAUNCHER ${SCCACHE_FOUND})
set(CMAKE_CXX_COMPILER_LAUNCHER ${SCCACHE_FOUND})
elseif(CCACHE_FOUND)
message("setting CCACHE to ${CCACHE_FOUND}")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_FOUND})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_FOUND})
endif()
endif()
# ccache/sccache only works with /Z7, not /Zi, so tweak the Debug and RelWithDebInfo build flags in the presence of a compiler cache
if(MSVC AND (DEFINED CMAKE_C_COMPILER_LAUNCHER))
message(DEBUG "Setting MSVC flags to /Z7 for ccache compatibility. Current flags: ${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
message(DEBUG "New flags: ${CMAKE_CXX_FLAGS_DEBUG}")
endif()
option(CESIUM_TRACING_ENABLED "Whether to enable the Cesium performance tracing framework (CESIUM_TRACE_* macros)." OFF)
option(CESIUM_COVERAGE_ENABLED "Whether to enable code coverage" OFF)
option(CESIUM_TESTS_ENABLED "Whether to enable tests" ON)
option(CESIUM_GLM_STRICT_ENABLED "Whether to force strict GLM compile definitions." ON)
option(CESIUM_DISABLE_DEFAULT_ELLIPSOID "Whether to disable the WGS84 default value for ellipsoid parameters across cesium-native." OFF)
option(CESIUM_MSVC_STATIC_RUNTIME_ENABLED "Whether to enable static linking for MSVC runtimes" OFF)
option(CESIUM_DEBUG_TILE_UNLOADING "Whether to enable tracking of tile _doNotUnloadSubtreeCount modifications for tile unloading debugging." OFF)
option(CESIUM_CLANG_TIME_TRACE "Whether to enable the -ftime-trace compilation option when building with Clang." OFF)
if (CESIUM_MSVC_STATIC_RUNTIME_ENABLED)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
if (CESIUM_TRACING_ENABLED)
add_compile_definitions(CESIUM_TRACING_ENABLED=1)
endif()
# Set defaults that need to be set AFTER compiler / IDE detection
include("cmake/compiler.cmake")
if(CESIUM_ENABLE_CLANG_TIDY)
setup_clang_tidy(
PROJECT_BUILD_DIRECTORY
"${PROJECT_BINARY_DIR}"
PROJECT_SOURCE_DIRECTORIES
"${PROJECT_SOURCE_DIR}"
ENABLE_CLANG_TIDY_ON_BUILD
${CESIUM_ENABLE_CLANG_TIDY_ON_BUILD}
)
endif()
# Add Modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/extern/cmake-modules/")
if (CESIUM_COVERAGE_ENABLED AND NOT MSVC)
include(CodeCoverage)
append_coverage_compiler_flags()
setup_target_for_coverage_gcovr_html(
NAME cesium-native-tests-coverage
EXECUTABLE ctest -j ${PROCESSOR_COUNT}
EXCLUDE "${PROJECT_SOURCE_DIR}/extern/*" "${PROJECT_BINARY_DIR}"
DEPENDENCIES cesium-native-tests
)
endif()
if (NOT DEFINED GLOB_USE_CONFIGURE_DEPENDS)
set(GLOB_USE_CONFIGURE_DEPENDS OFF CACHE BOOL
"Controls if cesium-native targets should use configure_depends or not for globbing their sources"
)
endif()
# On the CI builds, I have to do this explicitly for some reason or it fails to find the vcpkg packages.
# The toolchain is supposed to manage this, but I haven't figured out why it isn't yet.
# One reason the toolchain won't manage this: it's not being run at all. That happens when this CMakeLists.txt
# is invoked from another one via add_subdirectory, and the parent project has already loaded the toolchain
# before ezvcpkg sets it.
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_BUILD_DIR}/share/s2")
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_BUILD_DIR}/share")
list(APPEND CMAKE_PREFIX_PATH "${PACKAGE_BUILD_DIR}")
if(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$")
list(APPEND CMAKE_FIND_ROOT_PATH "${PACKAGE_BUILD_DIR}/debug")
endif()
list(APPEND CMAKE_FIND_ROOT_PATH "${PACKAGE_BUILD_DIR}")
# Find the VCPKG dependnecies
# Note that while we could push these into the extern/CMakeLists.txt as an organization tidy-up, that would require
# us to update the minimum version of CMake to 3.24 and to add the GLOBAL option to the find_package calls, otherwise
# they won't be visible in this scope nor any of the subdirectories for the actual libraries.
#
# However, for some of the vcpkg built libraries where they don't provide a prope cmake config file, we have to declare
# an imported library target ourselves. This is the case for modp_b64::modp_b64, picosha2::picosha2 and earcut. In
# these cases, we *do* have the somewhat ugly and verbose details in the extern/CMakeLists.txt file.
#
# XXX Above comment should be obsoleted by these first calls to
# find_package, which resolve to our own modules that provide
# targets. If needed, they can be installed with CMake config files
# etc.
find_package(modp_b64 REQUIRED)
find_package(ada CONFIG REQUIRED)
find_package(Async++ CONFIG REQUIRED)
find_package(blend2d CONFIG REQUIRED)
find_package(doctest CONFIG REQUIRED)
find_package(draco CONFIG REQUIRED)
find_package(expected-lite CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(Ktx CONFIG REQUIRED)
find_package(libmorton CONFIG REQUIRED)
find_package(meshoptimizer CONFIG REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(s2 CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(spz CONFIG REQUIRED)
find_package(tinyxml2 CONFIG REQUIRED)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
find_package(WebP CONFIG REQUIRED)
find_package(zlib-ng CONFIG REQUIRED)
# asmjit should not be included with iOS or Wasm builds as they don't support JIT compilation.
if(NOT CESIUM_TARGET_WASM AND NOT IOS AND NOT VCPKG_CMAKE_SYSTEM_NAME MATCHES "iOS")
find_package(asmjit CONFIG REQUIRED)
endif()
if(NOT CESIUM_DISABLE_CURL)
find_package(CURL REQUIRED)
endif()
if(NOT CESIUM_DISABLE_LIBJPEG_TURBO)
find_package(libjpeg-turbo CONFIG REQUIRED)
endif()
if(NOT CESIUM_TARGET_WASM)
find_package(httplib CONFIG REQUIRED)
endif()
# Private Library (s2geometry)
add_subdirectory(extern EXCLUDE_FROM_ALL)
# Public Targets
add_subdirectory(CesiumUtility)
add_subdirectory(CesiumGltf)
add_subdirectory(CesiumGeometry)
add_subdirectory(CesiumGeospatial)
add_subdirectory(CesiumJsonReader)
add_subdirectory(CesiumJsonWriter)
add_subdirectory(CesiumGltfContent)
add_subdirectory(CesiumGltfReader)
add_subdirectory(CesiumGltfWriter)
add_subdirectory(CesiumAsync)
add_subdirectory(Cesium3DTiles)
add_subdirectory(Cesium3DTilesReader)
add_subdirectory(Cesium3DTilesWriter)
add_subdirectory(Cesium3DTilesContent)
add_subdirectory(CesiumRasterOverlays)
add_subdirectory(Cesium3DTilesSelection)
add_subdirectory(CesiumClientCommon)
add_subdirectory(CesiumIonClient)
add_subdirectory(CesiumITwinClient)
add_subdirectory(CesiumQuantizedMeshTerrain)
add_subdirectory(CesiumVectorData)
if(NOT CESIUM_DISABLE_CURL)
add_subdirectory(CesiumCurl)
endif()
# Private Targets
if (CESIUM_TESTS_ENABLED)
# enable_testing() MUST be called before add_subdirectory or no tests
# will be found by ctest
enable_testing()
add_subdirectory(CesiumNativeTests)
endif()
add_subdirectory(doc)
include(CMakePackageConfigHelpers)
if(CESIUM_INSTALL_STATIC_LIBS AND CESIUM_INSTALL_HEADERS)
install(EXPORT CesiumExports
FILE cesium-nativeTargets.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake)
install(FILES
"${CMAKE_CURRENT_LIST_DIR}/cmake/modules/Findmodp_b64.cmake"
DESTINATION ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/config/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/cesium-nativeConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cesium-nativeConfig.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/cesium-native/cmake)
endif()