-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathCMakeLists.txt
66 lines (57 loc) · 1.97 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
cmake_minimum_required(VERSION 3.24)
project(FlyCube)
if (CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS")
set(IOS_OR_TVOS TRUE)
endif()
include(CMakeDependentOption)
option(STATIC_MOLTEN_VK "Link with MoltenVK.xcframework on macOS/iOS/tvOS" OFF)
option(VULKAN_SUPPORT "Vulkan support" ON)
cmake_dependent_option(DIRECTX_SUPPORT "DirectX 12 support" ON "WIN32" OFF)
option(AGILITY_SDK_REQUIRED "Use Agility SDK" OFF)
cmake_dependent_option(METAL_SUPPORT "Metal support" ON "APPLE" OFF)
cmake_dependent_option(BUILD_SAMPLES "Build samples" ON "NOT ANDROID" OFF)
cmake_dependent_option(BUILD_TESTING "Build unit tests" ON "NOT IOS_OR_TVOS" OFF)
set(project_root "${CMAKE_CURRENT_SOURCE_DIR}")
set(assets_path "${project_root}/assets/")
add_library(FlyCubeAssets INTERFACE)
target_compile_definitions(FlyCubeAssets INTERFACE ASSETS_PATH="${assets_path}")
list(PREPEND CMAKE_MODULE_PATH "${project_root}/cmake")
include(codesign_settings_apple OPTIONAL)
include(cmake_settings)
include(compiler_settings)
include(3rdparty/glfw)
include(3rdparty/glm)
include(3rdparty/gli)
include(3rdparty/mvkpixelformats)
include(3rdparty/nowide)
include(3rdparty/catch2)
include(3rdparty/dxc)
include(3rdparty/directx)
include(3rdparty/vulkan)
include(3rdparty/spirv-cross)
if (VULKAN_SUPPORT)
add_definitions(-DVULKAN_SUPPORT)
endif()
if (DIRECTX_SUPPORT)
add_definitions(-DDIRECTX_SUPPORT)
endif()
if (AGILITY_SDK_REQUIRED)
add_definitions(-DAGILITY_SDK_REQUIRED)
endif()
if (METAL_SUPPORT)
add_definitions(-DMETAL_SUPPORT)
endif()
if (BUILD_TESTING)
enable_testing()
endif()
add_subdirectory(src)
if (CMAKE_CROSSCOMPILING AND IOS_OR_TVOS AND BUILD_SAMPLES)
execute_process(
COMMAND "${CMAKE_COMMAND}" "${CMAKE_CURRENT_SOURCE_DIR}" -BmacOS
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
execute_process(
COMMAND "${CMAKE_COMMAND}" --build macOS --config Release --target ShaderCompilerCLI -j 16
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endif()