Skip to content

Commit a400f1a

Browse files
committed
Update for RavEngine changes
1 parent e98e30a commit a400f1a

File tree

120 files changed

+47036
-12133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+47036
-12133
lines changed

CMakeLists.txt

Lines changed: 73 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ if (RGL_ENABLE_WEBGPU)
3636
set(RGL_WEBGPU_AVAILABLE ON CACHE INTERNAL "RGL WebGPU")
3737
endif()
3838

39-
if (RGL_RUNTIME_COMPILATION)
40-
set(RGL_RUNTIME_COMPILER_LIB "librglc")
41-
endif()
42-
4339
if (CMAKE_VS_PLATFORM_NAME STREQUAL "ARM64")
4440
set(RGL_DISABLE_VK ON CACHE INTERNAL "")
4541
endif()
@@ -66,6 +62,13 @@ else()
6662
set(ST_ENABLE_WGSL OFF CACHE INTERNAL "")
6763
endif()
6864
set(ST_ENABLE_TEST OFF CACHE INTERNAL "")
65+
if((WIN32 AND NOT WINDOWS_STORE) AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/deps/ShaderTranspiler/deps/DirectXShaderCompiler/CMakeLists.txt")
66+
message("Building DXC from source")
67+
set(ST_BUNDLED_DXC ON)
68+
else()
69+
message("Not building DXC from source")
70+
set(ST_BUNDLED_DXC OFF)
71+
endif()
6972
add_subdirectory(deps/ShaderTranspiler EXCLUDE_FROM_ALL)
7073
file(GLOB_RECURSE LIBRGLC_SOURCES "tools/librglc/*.cpp" "tools/librglc/*.hpp")
7174
add_library(librglc ${LIBRGLC_SOURCES})
@@ -95,57 +98,80 @@ if (RGL_ENABLE_RGLC)
9598
)
9699
endif()
97100

98-
find_package(Vulkan)
99-
100-
if(CMAKE_SYSTEM_NAME MATCHES "WindowsStore" OR RGL_DISABLE_VK OR APPLE OR CMAKE_SYSTEM_NAME MATCHES "Emscripten")
101+
if(WINDOWS_STORE OR RGL_DISABLE_VK OR APPLE OR CMAKE_SYSTEM_NAME MATCHES "Emscripten")
101102
set(VK_FORCE_DISABLED ON)
102103
else()
103104
set(VK_FORCE_DISABLED OFF)
104105
endif()
105106

106-
if (NOT VK_FORCE_DISABLED AND Vulkan_FOUND)
107-
108-
109-
set(VK_LIBS ${Vulkan_LIBRARIES} VulkanMemoryAllocator)
107+
if (NOT VK_FORCE_DISABLED)
108+
add_subdirectory(deps/volk EXCLUDE_FROM_ALL)
109+
target_compile_definitions(volk PUBLIC NOMINMAX=1)
110110

111111
# Get our vendored headers
112-
set(VK_INCLUDE deps/VulkanMemoryAllocator/include deps/Vulkan-Headers/include deps/Vulkan-Utility-Libraries/include)
112+
set(VK_INCLUDE deps/Vulkan-Headers/include deps/Vulkan-Utility-Libraries/include)
113+
target_include_directories(volk PUBLIC ${VK_INCLUDE})
114+
if (LINUX)
115+
target_compile_definitions(volk PRIVATE VK_USE_PLATFORM_XLIB_KHR VK_USE_PLATFORM_WAYLAND_KHR)
116+
elseif(ANDROID)
117+
target_compile_definitions(volk PRIVATE VK_USE_PLATFORM_ANDROID_KHR)
118+
elseif(WIN32 OR WINDOWS_STORE)
119+
target_compile_definitions(volk PRIVATE VK_USE_PLATFORM_WIN32_KHR)
120+
endif()
113121

114-
target_compile_definitions(${PROJECT_NAME} PUBLIC RGL_VK_AVAILABLE=1)
122+
target_compile_definitions(${PROJECT_NAME} PUBLIC RGL_VK_AVAILABLE=1 )
115123
set(RGL_VK_AVAILABLE ON CACHE INTERNAL "RGL Vulkan")
116-
set(VMA_STATIC_VULKAN_FUNCTIONS ON)
117124
add_subdirectory(deps/VulkanMemoryAllocator EXCLUDE_FROM_ALL)
118-
target_include_directories(VulkanMemoryAllocator PUBLIC ${Vulkan_INCLUDE_DIRS})
119-
target_include_directories(${PROJECT_NAME} PUBLIC ${Vulkan_INCLUDE_DIRS}) # so that library users get the vk paths if applicable
120-
target_compile_features(VulkanMemoryAllocator PUBLIC cxx_std_20)
125+
target_compile_definitions(VulkanMemoryAllocator INTERFACE VMA_STATIC_VULKAN_FUNCTIONS=0 VMA_DYNAMIC_VULKAN_FUNCTIONS=0)
126+
127+
target_link_libraries(${PROJECT_NAME}
128+
PUBLIC
129+
volk
130+
PRIVATE
131+
GPUOpen::VulkanMemoryAllocator
132+
)
133+
134+
set_target_properties(VulkanMemoryAllocator volk PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries")
135+
if (TARGET loader-opt)
136+
set_target_properties(loader-opt loader-unknown-chain PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries")
137+
endif()
138+
if(RGL_USE_MINIVKSDK)
139+
set_target_properties(vulkan vvl VkLayer_utils loader_asm_gen_files PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries")
140+
endif()
121141
else()
122142
target_compile_definitions(${PROJECT_NAME} PUBLIC RGL_VK_AVAILABLE=0)
123143
set(RGL_VK_AVAILABLE OFF CACHE INTERNAL "RGL Vulkan")
124144
endif()
125145

126146
if(MSVC AND NOT RGL_DISABLE_DX)
127147
add_subdirectory(deps/DirectX-Headers EXCLUDE_FROM_ALL)
128-
set(DX12_LIBRARIES "d3d12.lib" "DirectX-Headers" "DirectX-Guids" "dxgi.lib" "d3dcompiler.lib" "D3D12MemoryAllocator" "DirectXTK12")
129148
target_compile_definitions(${PROJECT_NAME} PUBLIC RGL_DX12_AVAILABLE=1)
130149

131150
set(RGL_DX12_AVAILABLE ON CACHE INTERNAL "RGL DX12")
132151
add_subdirectory("deps/D3D12MemoryAllocator" EXCLUDE_FROM_ALL)
133152
set(BUILD_XAUDIO_WIN10 OFF CACHE INTERNAL "")
134153
add_subdirectory("deps/DirectXTK12" EXCLUDE_FROM_ALL)
135154

136-
set_target_properties("DirectX-Guids" "DirectXTK12" PROPERTIES
137-
FOLDER "${RGL_IDE_ROOT}/Libraries"
138-
)
139155
target_include_directories(${PROJECT_NAME} PUBLIC "deps/DirectXTK12/Inc")
140156

141157
# PIX stuff
142-
143158
add_subdirectory(deps/PixEvents-cmake)
144-
set(PIXLIB $<$<NOT:$<CONFIG:release>>:WinPixEventRuntime>)
145159

146-
set_target_properties("WinPixEventRuntime" "WinPixEventRuntime_ETW" "PixDecoder" PROPERTIES
147-
FOLDER "${RGL_IDE_ROOT}/Libraries/"
148-
)
160+
set_target_properties("WinPixEventRuntime" "WinPixEventRuntime_ETW" "PixDecoder" "DirectX-Guids" "DirectXTK12" DirectX-Headers PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries/")
161+
162+
target_link_libraries(${PROJECT_NAME}
163+
PRIVATE
164+
d3d12.lib
165+
DirectX-Headers
166+
DirectX-Guids
167+
dxgi.lib
168+
d3dcompiler.lib
169+
D3D12MemoryAllocator
170+
DirectXTK12
171+
$<$<NOT:$<CONFIG:release>>:WinPixEventRuntime>
172+
)
173+
174+
set_target_properties(D3D12MemoryAllocator PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries")
149175
else()
150176
target_compile_definitions(${PROJECT_NAME} PUBLIC RGL_DX12_AVAILABLE=0)
151177
set(RGL_DX12_AVAILABLE OFF CACHE INTERNAL "RGL DX12")
@@ -158,6 +184,13 @@ if(APPLE)
158184
find_library(METAL_LIB Metal REQUIRED)
159185
find_library(QZC_LIB QuartzCore REQUIRED)
160186
set(RGL_MTL_AVAILABLE ON CACHE INTERNAL "RGL Metal")
187+
188+
target_link_libraries(${PROJECT_NAME}
189+
PRIVATE
190+
${FOUNDATION_LIB}
191+
${METAL_LIB}
192+
${QZC_LIB}
193+
)
161194
else()
162195
target_compile_definitions(${PROJECT_NAME} PUBLIC RGL_MTL_AVAILABLE=0)
163196
set(RGL_MTL_AVAILABLE OFF CACHE INTERNAL "RGL Metal")
@@ -169,23 +202,17 @@ else()
169202
target_compile_definitions(${PROJECT_NAME} PUBLIC RGL_WEBGPU_AVAILABLE=0)
170203
endif()
171204

172-
target_link_libraries(${PROJECT_NAME} PRIVATE
173-
${VK_LIBS}
174-
${DX12_LIBRARIES}
175-
${FOUNDATION_LIB}
176-
${METAL_LIB}
177-
${QZC_LIB}
178-
${X11_LIBRARIES}
179-
${RGL_RUNTIME_COMPILER_LIB}
180-
${PIXLIB}
181-
SPIRV-Reflect
182-
)
183-
184-
if (APPLE)
185-
target_include_directories(${PROJECT_NAME} PRIVATE "tools/librglc/include/")
186205
if (RGL_RUNTIME_COMPILATION)
187-
target_compile_definitions(${PROJECT_NAME} PRIVATE "RGL_CAN_RUNTIME_COMPILE")
206+
target_link_libraries(${PROJECT_NAME} PRIVATE librglc)
188207
endif()
208+
209+
target_link_libraries(${PROJECT_NAME} PRIVATE SPIRV-Reflect ${X11_LIBRARIES})
210+
211+
if (APPLE)
212+
target_include_directories(${PROJECT_NAME} PRIVATE "tools/librglc/include/")
213+
if (RGL_RUNTIME_COMPILATION)
214+
target_compile_definitions(${PROJECT_NAME} PRIVATE "RGL_CAN_RUNTIME_COMPILE")
215+
endif()
189216
endif()
190217

191218
set(AFTERMATH_DIR "AftermathSDK")
@@ -211,6 +238,8 @@ target_include_directories(${PROJECT_NAME}
211238
"include"
212239
)
213240

241+
target_compile_definitions(${PROJECT_NAME} PUBLIC NOMINMAX=1)
242+
214243
set_target_properties("RGL" ${rglc_exe} "librglc" PROPERTIES
215244
FOLDER "${RGL_IDE_ROOT}"
216245
XCODE_GENERATE_SCHEME ON
@@ -224,7 +253,7 @@ set_target_properties("libtint" "tint_diagnostic_utils" PROPERTIES
224253
)
225254
endif()
226255

227-
set_target_properties("GenericCodeGen" "glslang" "MachineIndependent" "OGLCompiler" "OSDependent" "SPIRV" "SPVRemapper" "glslang-default-resource-limits" PROPERTIES
256+
set_target_properties("GenericCodeGen" "glslang" "OGLCompiler" "MachineIndependent" "OSDependent" "SPIRV" "SPVRemapper" "glslang-default-resource-limits" PROPERTIES
228257
FOLDER "${RGL_IDE_ROOT}/Libraries/glslang"
229258
)
230259

@@ -237,12 +266,12 @@ set_target_properties(
237266

238267
set_target_properties(
239268
"spirv-cross-core"
240-
"spirv-cross-glsl" "spirv-cross-hlsl" "spirv-cross-msl" "spirv-cross-reflect" "spirv-cross-cpp" "spirv-cross-util" "HLSL"
269+
"spirv-cross-glsl" "spirv-cross-hlsl" "spirv-cross-msl" "spirv-cross-reflect" "spirv-cross-cpp" "spirv-cross-util"
241270
PROPERTIES
242271
FOLDER "${RGL_IDE_ROOT}/Libraries/SPIRV-Cross"
243272
)
244273

245-
if(ST_BUNDLED_DXC)
274+
if(ST_BUNDLED_DXC AND NOT WINDOWS_STORE)
246275
function(dxc_set_for_dir DIR)
247276
get_property(TGTS DIRECTORY "${DIR}" PROPERTY BUILDSYSTEM_TARGETS)
248277
set_target_properties(
@@ -259,20 +288,6 @@ if(ST_BUNDLED_DXC)
259288
dxc_set_for_dir("${CMAKE_CURRENT_LIST_DIR}/deps/ShaderTranspiler/deps/DirectXShaderCompiler")
260289
endif()
261290

262-
if (RGL_VK_AVAILABLE)
263-
set_target_properties(VulkanMemoryAllocator PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries")
264-
if (TARGET loader-opt)
265-
set_target_properties(loader-opt loader-unknown-chain PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries")
266-
endif()
267-
if(RGL_USE_MINIVKSDK)
268-
set_target_properties(vulkan vvl VkLayer_utils loader_asm_gen_files PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries")
269-
endif()
270-
endif()
271-
if (RGL_DX12_AVAILABLE)
272-
set_target_properties(D3D12MemoryAllocator PROPERTIES FOLDER "${RGL_IDE_ROOT}/Libraries")
273-
endif()
274-
275-
276291
if (NOT RGL_SKIP_BACKEND_CHECK)
277292
if (RGL_VK_AVAILABLE OR RGL_DX12_AVAILABLE OR RGL_MTL_AVAILABLE OR RGL_WEBGPU_AVAILABLE)
278293
else()

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ RavEngine Graphics Library - a thin RHI for Vulkan, DirectX12, and Metal
2424
- Windows 10+ (Arm64 + x86_64)
2525
- Windows 10+ UWP (Arm64 + x86_64)
2626
- Linux
27-
- Android (x86, x86_64, arm, arm64)
2827
- WebAssembly (WIP)
2928

3029
### Getting Started

deps/DirectX-Headers/Android.bp

Lines changed: 0 additions & 14 deletions
This file was deleted.

deps/DirectX-Headers/CMakeLists.txt

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
cmake_minimum_required(VERSION 3.10.2)
44
project(DirectX-Headers
55
LANGUAGES CXX
6-
VERSION 1.606.4
6+
VERSION 1.613.1
77
)
8-
8+
include(CTest)
99
set(CMAKE_CXX_STANDARD 14)
1010
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1111
set(CMAKE_CXX_EXTENSIONS OFF)
12+
enable_testing()
1213

1314
# It's useful to know if you are a top level project or not, if your project is
1415
# being consumed via add_subdirectory
@@ -32,19 +33,12 @@ include(GNUInstallDirs)
3233
# Enables consumers to add this library as a link target to automatically add
3334
# these include directories, regardless of whether this is referenced via subdirectory
3435
# or from an installed location
35-
add_library(DirectX-Headers INTERFACE)
36-
target_include_directories(DirectX-Headers SYSTEM INTERFACE
36+
add_library(DirectX-Headers STATIC src/d3dx12_property_format_table.cpp)
37+
target_include_directories(DirectX-Headers SYSTEM PUBLIC
3738
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
3839
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
3940
)
40-
41-
# For non-Windows targets, also add the WSL stubs to the include path
42-
if (NOT WIN32)
43-
target_include_directories(DirectX-Headers SYSTEM INTERFACE
44-
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/wsl/stubs>"
45-
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/wsl/stubs>"
46-
)
47-
endif()
41+
target_include_directories(DirectX-Headers PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/directx)
4842

4943
add_library(Microsoft::DirectX-Headers ALIAS DirectX-Headers)
5044

@@ -53,6 +47,20 @@ target_link_libraries(DirectX-Guids PRIVATE DirectX-Headers)
5347

5448
add_library(Microsoft::DirectX-Guids ALIAS DirectX-Guids)
5549

50+
# For non-Windows targets, also add the WSL stubs to the include path
51+
if (NOT WIN32)
52+
target_include_directories(DirectX-Headers SYSTEM PUBLIC
53+
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/wsl/stubs>"
54+
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/wsl/stubs>"
55+
)
56+
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
57+
# MinGW has RPC headers which define old versions, and complain if D3D
58+
# headers are included before the RPC headers, since D3D headers were
59+
# generated with new MIDL and "require" new RPC headers.
60+
target_compile_options(DirectX-Headers PRIVATE "-D__REQUIRED_RPCNDR_H_VERSION__=475")
61+
target_compile_options(DirectX-Guids PRIVATE "-D__REQUIRED_RPCNDR_H_VERSION__=475")
62+
endif()
63+
5664
if (DXHEADERS_INSTALL)
5765
# Install the targets
5866
install(TARGETS DirectX-Headers DirectX-Guids
@@ -81,12 +89,30 @@ if (DXHEADERS_INSTALL)
8189
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/directx-headers-config.cmake"
8290
"${CMAKE_CURRENT_BINARY_DIR}/directx-headers-config-version.cmake"
8391
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/directx-headers/cmake)
84-
endif()
92+
93+
# Create pkg-config file
94+
include(cmake/JoinPaths.cmake)
95+
# from: https://github.com/jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files
96+
join_paths(DIRECTX_INCLUDEDIR_FOR_PKG_CONFIG "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
97+
join_paths(DIRECTX_LIBDIR_FOR_PKG_CONFIG "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
98+
configure_file(
99+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/DirectX-Headers.pc.in"
100+
"${CMAKE_CURRENT_BINARY_DIR}/DirectX-Headers.pc" @ONLY)
101+
102+
# Install the pkg-config file
103+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DirectX-Headers.pc"
104+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
85105

86-
if (DXHEADERS_BUILD_TEST)
87-
add_subdirectory(test)
88106
endif()
89107

90-
if (DXHEADERS_BUILD_GOOGLE_TEST)
91-
add_subdirectory(googletest)
108+
if (BUILD_TESTING)
109+
if (DXHEADERS_BUILD_TEST)
110+
add_subdirectory(test)
111+
endif()
112+
113+
if (DXHEADERS_BUILD_GOOGLE_TEST)
114+
# We do not want to install GoogleTest when packaging DirectX-Headers.
115+
set(INSTALL_GTEST OFF)
116+
add_subdirectory(googletest)
117+
endif()
92118
endif()

0 commit comments

Comments
 (0)