Skip to content

Commit ce67db8

Browse files
authored
Switch to renderbag dxc-bin for shader compiler. (hedge-dev#6)
1 parent db602ac commit ce67db8

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

Diff for: .gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
[submodule "thirdparty/fmt"]
1111
path = thirdparty/fmt
1212
url = https://github.com/fmtlib/fmt.git
13+
[submodule "thirdparty/dxc-bin"]
14+
path = thirdparty/dxc-bin
15+
url = https://github.com/renderbag/dxc-bin.git

Diff for: CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cmake_minimum_required(VERSION 3.20)
22

3-
include($ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
43
set(CMAKE_CXX_STANDARD 17)
54

65
project("XenosRecomp-ALL")

Diff for: XenosRecomp/CMakeLists.txt

+13-6
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ add_executable(XenosRecomp
1818
shader_recompiler.h
1919
"${SMOLV_SOURCE_DIR}/smolv.cpp")
2020

21-
find_package(directx-dxc CONFIG REQUIRED)
22-
2321
target_link_libraries(XenosRecomp PRIVATE
2422
Microsoft::DirectXShaderCompiler
25-
Microsoft::DXIL
2623
xxHash::xxhash
2724
libzstd_static
2825
fmt::fmt)
@@ -31,16 +28,26 @@ target_include_directories(XenosRecomp PRIVATE ${SMOLV_SOURCE_DIR})
3128

3229
target_precompile_headers(XenosRecomp PRIVATE pch.h)
3330

34-
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
31+
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
3532
target_compile_options(XenosRecomp PRIVATE -Wno-switch -Wno-unused-variable -Wno-null-arithmetic -fms-extensions)
33+
34+
include(CheckCXXSymbolExists)
35+
check_cxx_symbol_exists(_LIBCPP_VERSION version LIBCPP)
36+
if(LIBCPP)
37+
# Allows using std::execution
38+
target_compile_options(XenosRecomp PRIVATE -fexperimental-library)
39+
endif()
3640
endif()
3741

3842
if (WIN32)
3943
target_compile_definitions(XenosRecomp PRIVATE _CRT_SECURE_NO_WARNINGS)
40-
find_file(DIRECTX_DXIL_LIBRARY "dxil.dll")
41-
file(COPY ${DIRECTX_DXIL_LIBRARY} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
44+
add_custom_command(TARGET XenosRecomp POST_BUILD
45+
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:XenosRecomp> $<TARGET_FILE_DIR:XenosRecomp>
46+
COMMAND_EXPAND_LISTS
47+
)
4248
endif()
4349

4450
if (XENOS_RECOMP_DXIL)
4551
target_compile_definitions(XenosRecomp PRIVATE XENOS_RECOMP_DXIL)
52+
target_link_libraries(XenosRecomp PRIVATE Microsoft::DXIL)
4653
endif()

Diff for: thirdparty/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ endif()
99
if (NOT TARGET libzstd)
1010
add_subdirectory("${XENOS_RECOMP_THIRDPARTY_ROOT}/zstd/build/cmake")
1111
endif()
12+
13+
if (NOT TARGET Microsoft::DirectXShaderCompiler)
14+
add_subdirectory("${XENOS_RECOMP_THIRDPARTY_ROOT}/dxc-bin")
15+
endif()

Diff for: thirdparty/dxc-bin

Submodule dxc-bin added at 737ac9f

Diff for: vcpkg.json

-6
This file was deleted.

0 commit comments

Comments
 (0)