-
Notifications
You must be signed in to change notification settings - Fork 101
/
CMakeLists.txt
74 lines (63 loc) · 2.44 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
cmake_minimum_required(VERSION 3.5)
project (GLTFSDK)
option(ENABLE_UNIT_TESTS "ENABLE_UNIT_TESTS" ON)
if(ENABLE_UNIT_TESTS)
enable_testing()
endif()
# Disable the samples on macOS, iOS, and Android since the experimental features they use
# do not yet build with XCode or clang on these platforms.
if(APPLE OR ANDROID_OS_PLATFORM)
option(ENABLE_SAMPLES "ENABLE_SAMPLES" OFF)
else()
option(ENABLE_SAMPLES "ENABLE_SAMPLES" ON)
endif()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -D_DEBUG -DFEATURE_ASSERTS_ENABLED")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11)
if (WIN32)
# Define _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING to disable the warnings in the current version of Google Test (1.8.0)
# TODO: Newer versions shouldn't have this problem. Re-evaluate this when upgrading.
add_compile_definitions(
_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING
)
# Multithreaded Build
add_compile_options(
/MP
)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Build/CMake/Modules")
if(NOT IOS)
# This variable is set by ios.toolchain.cmake.
# Notice that External/RapidJSON uses `find_package` for external project is ready.
# We have to prevent modification of RapidJSON_XXX variables in cache at this moment
find_package(RapidJSON CONFIG)
endif()
if(NOT RapidJSON_FOUND)
add_subdirectory(External/RapidJSON)
endif()
find_package(GTest CONFIG)
if(NOT GTest_FOUND)
# import and alias just like it is already installed via VcPkg
add_subdirectory(External/googletest)
add_library(GTest::gtest_main ALIAS gtest_main)
endif()
add_subdirectory(GLTFSDK)
if(RapidJSON_FOUND)
target_include_directories(GLTFSDK
PUBLIC $<BUILD_INTERFACE:${RapidJSON_INCLUDE_DIRS}>
)
elseif(TARGET RapidJSON)
get_target_property(RapidJSON_INCLUDE_DIRS RapidJSON INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(GLTFSDK
PUBLIC $<BUILD_INTERFACE:${RapidJSON_INCLUDE_DIRS}>
)
endif()
if(ENABLE_UNIT_TESTS AND (NOT DEFINED EMSCRIPTEN))
add_subdirectory(GLTFSDK.TestUtils)
add_subdirectory(GLTFSDK.Test)
endif()
if(ENABLE_SAMPLES AND (NOT DEFINED EMSCRIPTEN))
add_subdirectory(GLTFSDK.Samples)
endif()
INSTALL(DIRECTORY ${RapidJSON_INCLUDE_DIRS} DESTINATION ${CMAKE_SOURCE_DIR}/Built/Out/RapidJSON/ FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp")