forked from guillaumeblanc/ozz-animation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
136 lines (111 loc) · 4.42 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
cmake_minimum_required(VERSION 3.24)
# Defines the project's name
project(ozz)
# Check if project is top level or a sub project
get_directory_property(is_sub_project PARENT_DIRECTORY)
# Current version
set(OZZ_VERSION_MAJOR 0)
set(OZZ_VERSION_MINOR 14)
set(OZZ_VERSION_PATCH 2)
set(OZZ_VERSION ${OZZ_VERSION_MAJOR}.${OZZ_VERSION_MINOR}.${OZZ_VERSION_PATCH})
# Add project build options
option(BUILD_SHARED_LIBS "Build ozz as shared libraries" OFF)
option(ozz_build_tools "Build tools" ON)
option(ozz_build_fbx "Build Fbx pipeline (Requires Fbx SDK)" ON)
option(ozz_build_gltf "Build glTF importer (Requires c++11)" ON)
option(ozz_build_data "Build data on code change" OFF)
option(ozz_build_samples "Build samples" ON)
option(ozz_build_howtos "Build howtos" ON)
option(ozz_build_tests "Build unit tests" ON)
option(ozz_build_simd_ref "Force SIMD math reference implementation" OFF)
option(ozz_build_postfix "Use per config postfix name" ON)
option(ozz_build_msvc_rt_dll "Select msvc DLL runtime library" OFF)
# Checks DLL flags
if(WIN32 AND BUILD_SHARED_LIBS AND NOT ozz_build_msvc_rt_dll)
message("Forcing ozz_build_msvc_rt_dll to ON as ozz is being built as dll (BUILD_SHARED_LIBS is ON).")
set(ozz_build_msvc_rt_dll ON)
endif()
if(is_sub_project)
set(ozz_build_msvc_rt_dll ${ozz_build_msvc_rt_dll} PARENT_SCOPE)
endif()
# Include ozz cmake parameters and scripts
include(CheckCXXCompilerFlag)
include(${PROJECT_SOURCE_DIR}/build-utils/cmake/compiler_settings.cmake)
include(${PROJECT_SOURCE_DIR}/build-utils/cmake/package_settings.cmake)
include(${PROJECT_SOURCE_DIR}/build-utils/cmake/fuse_target.cmake)
include(${PROJECT_SOURCE_DIR}/build-utils/cmake/clang_format.cmake)
include(${PROJECT_SOURCE_DIR}/build-utils/cmake/shared_library.cmake)
# Add project execution options
option(ozz_run_tests_headless "Run samples without rendering (used for unit tests)" ON)
set(ozz_sample_testing_loops "20" CACHE STRING "Number of loops while running sample tests (used for unit tests)")
# Configure CMake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/build-utils/cmake/modules/")
# Detects Fbx SDK, required to build Fbx pipeline.
if(ozz_build_tools AND ozz_build_fbx)
# Select a msvc runtime compatible with ozz_build_msvc_rt_dll
set(FBX_SHARED ${BUILD_SHARED_LIBS})
set(FBX_MSVC_RT_DLL ${ozz_build_msvc_rt_dll})
# Search for FBX sdk package
find_package(Fbx 2016)
# Disables ozz_build_fbx if Fbx SDK isn't found.
if(NOT FBX_FOUND)
message("Fbx SDK not found, FBX tools libraries and samples will be skipped.")
set(ozz_build_fbx OFF)
endif()
else()
# Disables fbx if tools are disabled
set(ozz_build_fbx OFF)
endif()
if(is_sub_project)
set(ozz_build_fbx ${ozz_build_fbx} PARENT_SCOPE)
endif()
# gltf
if(ozz_build_tools AND ozz_build_gltf)
else()
set(ozz_build_gltf OFF)
endif()
if(is_sub_project)
set(ozz_build_gltf ${ozz_build_gltf} PARENT_SCOPE)
endif()
# Enables unit tests.
if(ozz_build_tests)
enable_testing()
endif()
# Locates media directory.
set(ozz_media_directory "${PROJECT_SOURCE_DIR}/media")
# Creates temporary directory for tests inputs/outputs.
set(ozz_temp_directory ${PROJECT_BINARY_DIR}/temp)
file(MAKE_DIRECTORY ${ozz_temp_directory})
# Outputs selected options (can be modified by the command line)
message("-- ---------------------------------------------------------")
message("-- Selected options:")
message("-- - BUILD_SHARED_LIBS: " ${BUILD_SHARED_LIBS})
message("-- - ozz_build_tools: " ${ozz_build_tools})
message("-- - ozz_build_fbx: " ${ozz_build_fbx})
message("-- - ozz_build_gltf: " ${ozz_build_gltf})
message("-- - ozz_build_data: " ${ozz_build_data})
message("-- - ozz_build_samples: " ${ozz_build_samples})
message("-- - ozz_build_howtos: " ${ozz_build_howtos})
message("-- - ozz_build_tests: " ${ozz_build_tests})
message("-- - ozz_build_simd_ref: " ${ozz_build_simd_ref})
message("-- - ozz_build_msvc_rt_dll: " ${ozz_build_msvc_rt_dll})
message("-- - ozz_build_postfix: " ${ozz_build_postfix})
# Starts building the sources tree
add_subdirectory(src)
# Continues with howtos
if(ozz_build_howtos AND NOT EMSCRIPTEN)
add_subdirectory(howtos)
endif()
# Continues with samples
if(ozz_build_samples)
add_subdirectory(samples)
endif()
# Continues with the tests tree
if(ozz_build_tests AND NOT EMSCRIPTEN)
add_subdirectory(test)
endif()
install(FILES
${PROJECT_SOURCE_DIR}/CHANGES.md
${PROJECT_SOURCE_DIR}/LICENSE.md
${PROJECT_SOURCE_DIR}/README.md
DESTINATION "share/doc/ozz-animation/")