forked from Themaister/Granite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
120 lines (108 loc) · 5.29 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
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "" FORCE)
set(SHADERC_SKIP_INSTALL ON CACHE BOOL "" FORCE)
set(SPIRV_HEADERS_SKIP_EXAMPLES ON CACHE BOOL "" FORCE)
set(SPIRV_HEADERS_SKIP_INSTALL ON CACHE BOOL "" FORCE)
set(ENABLE_HLSL ON CACHE BOOL "" FORCE)
set(ENABLE_OPT OFF CACHE BOOL "" FORCE)
set(ENABLE_GLSLANG_INSTALL OFF CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(SHADERC_THIRD_PARTY_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE STRING "Third party path." FORCE)
set(SPIRV_CHECK_CONTEXT OFF CACHE BOOL "Disable SPIR-V IR context checking." FORCE)
set(SPIRV-Headers_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers" CACHE STRING "SPIRV-Headers path")
set(SHADERC_SKIP_TESTS ON CACHE BOOL "" FORCE)
set(FOSSILIZE_RAPIDJSON_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include" CACHE STRING "Fossilize rapidjson path." FORCE)
set(FOSSILIZE_VULKAN_INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan-headers/include/vulkan" CACHE STRING "Fossilize Vulkan path." FORCE)
set(MUFFT_ENABLE_FFTW OFF CACHE BOOL "Disable FFTW tests." FORCE)
set(SKIP_SPIRV_TOOLS_INSTALL ON CACHE BOOL "" FORCE)
set(SPIRV_CROSS_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
add_subdirectory(spirv-cross EXCLUDE_FROM_ALL)
add_subdirectory(renderdoc EXCLUDE_FROM_ALL)
add_subdirectory(shaderc EXCLUDE_FROM_ALL)
add_subdirectory(stb)
if ((NOT ANDROID) AND GRANITE_ASTC_ENCODER_COMPRESSION)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
message("Enabling SSE 4.1 path for astcenc")
set(ISA_SSE41 ON CACHE BOOL "" FORCE)
else()
set(ISA_NONE ON CACHE BOOL "" FORCE)
endif()
set(DECOMPRESSOR OFF)
set(UNITTEST OFF)
set(CLI_BUILD OFF CACHE BOOL "" FORCE)
add_subdirectory(astc-encoder EXCLUDE_FROM_ALL)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
add_library(astc-encoder ALIAS astcenc-sse4.1-static)
else()
add_library(astc-encoder ALIAS astcenc-none-static)
endif()
endif()
add_subdirectory(meshoptimizer EXCLUDE_FROM_ALL)
add_subdirectory(mikktspace)
add_subdirectory(muFFT EXCLUDE_FROM_ALL)
add_subdirectory(libco EXCLUDE_FROM_ALL)
set(FOSSILIZE_CLI OFF CACHE BOOL "Fossilize CLI." FORCE)
set(FOSSILIZE_TESTS OFF CACHE BOOL "Fossilize tests." FORCE)
add_library(granite-rapidjson INTERFACE)
target_include_directories(granite-rapidjson INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include)
if (GRANITE_VULKAN_FOSSILIZE)
# Some issues with Android build with missing shm_. Compile exactly what we need for now.
add_library(fossilize STATIC
fossilize/fossilize.hpp fossilize/fossilize.cpp
fossilize/fossilize_db.hpp fossilize/fossilize_db.cpp
fossilize/varint.hpp fossilize/varint.cpp
fossilize/fossilize_application_filter.hpp fossilize/fossilize_application_filter.cpp
fossilize/path.hpp fossilize/path.cpp
fossilize/miniz/miniz.h fossilize/miniz/miniz.c
fossilize/cli/fossilize_feature_filter.hpp fossilize/cli/fossilize_feature_filter.cpp)
granite_setup_default_link_libraries(fossilize)
target_include_directories(fossilize
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/fossilize
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/fossilize/miniz
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers/include/spirv/unified1)
target_link_libraries(fossilize PUBLIC granite-volk-headers PRIVATE granite-rapidjson)
if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang"))
target_compile_options(fossilize PRIVATE -fvisibility=hidden)
if (NOT APPLE)
target_compile_definitions(fossilize PRIVATE _LARGEFILE64_SOURCE)
endif()
if (WIN32)
target_compile_definitions(fossilize PRIVATE __USE_MINGW_ANSI_STDIO=1)
endif()
endif()
if (WIN32)
target_include_directories(fossilize PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dirent)
endif()
endif()
add_library(granite-volk-headers INTERFACE)
target_include_directories(granite-volk-headers INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/volk)
target_include_directories(granite-volk-headers INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan-headers/include
${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan-headers/include/vk_video
${CMAKE_CURRENT_SOURCE_DIR}/khronos/vulkan-headers/include/vulkan)
if (GRANITE_FFMPEG_VULKAN_ENCODE)
# Encode is still not ratified.
target_compile_definitions(granite-volk-headers INTERFACE VK_ENABLE_BETA_EXTENSIONS)
endif()
# volk must be STATIC.
add_library(granite-volk STATIC volk/volk.c volk/volk.h)
if (WIN32)
target_compile_definitions(granite-volk PRIVATE VK_USE_PLATFORM_WIN32_KHR)
else()
target_link_libraries(granite-volk PRIVATE dl)
endif()
target_link_libraries(granite-volk PRIVATE granite-volk-headers)
if ((NOT ANDROID) AND (${GRANITE_PLATFORM} MATCHES "GLFW"))
set(GLFW_BUILD_TESTS OFF)
add_subdirectory(glfw EXCLUDE_FROM_ALL)
endif()
if (ANDROID AND GRANITE_AUDIO)
add_subdirectory(oboe EXCLUDE_FROM_ALL)
target_compile_options(oboe PUBLIC -Wno-unused-parameter)
target_compile_features(oboe PRIVATE cxx_std_17)
endif()
if (GRANITE_VULKAN_SYSTEM_HANDLES AND GRANITE_RENDERER)
# Custom integration, bypass all the noise.
add_subdirectory(fsr2/src/ffx-fsr2-api/granite)
endif()