aboutsummaryrefslogtreecommitdiff
path: root/dxg/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'dxg/CMakeLists.txt')
-rw-r--r--dxg/CMakeLists.txt49
1 files changed, 40 insertions, 9 deletions
diff --git a/dxg/CMakeLists.txt b/dxg/CMakeLists.txt
index b7607c0..1040276 100644
--- a/dxg/CMakeLists.txt
+++ b/dxg/CMakeLists.txt
@@ -2,22 +2,53 @@ cmake_minimum_required(VERSION 3.20)
2 2
3project(dxg) 3project(dxg)
4 4
5# Agility SDK.
6# Give AGILITY_SDK_BIN PARENT_SCOPE so that it is accessible from the
7# install_agility_sdk function below.
8set(AGILITY_SDK_DIR "../contrib/microsoft.direct3d.d3d12.1.618.4/build/native")
9set(AGILITY_SDK_BIN "${AGILITY_SDK_DIR}/bin/x64" PARENT_SCOPE)
10
11add_subdirectory(shaders)
12
5add_library(dxg 13add_library(dxg
6 include/dxg/dxcommon.h 14 include/dxg/dxcommon.h
7 src/dxg.c) 15 include/dxg/dxg.h
16 include/dxg/imm.h
17 src/dxcommon.c
18 src/imm.c)
19
20# exe must export these so that D3D12.dll can find and load D3D12Core.dll and
21# other DLLs from the Agility SDK.
22target_compile_definitions(dxg PRIVATE
23 AGILITY_SDK_VERSION=618 # Must match AGILITY_SDK_DIR above.
24 AGILITY_SDK_INSTALL=u8".\\\\D3D12\\\\") # Binaries will be copied to this subdirectory.
8 25
9# target_sources(dxg PUBLIC 26# Use BEFORE so that the D3D headers in the Agility SDK are picked before the
10# FILE_SET cxx_modules TYPE CXX_MODULES FILES 27# ones in the Windows SDK.
11# asset.ixx 28target_include_directories(dxg BEFORE PUBLIC
12# dxcommon.ixx 29 include
13# dxg.ixx 30 ${AGILITY_SDK_DIR}/include)
14# imm.ixx)
15 31
16target_include_directories(dxg PUBLIC 32target_link_directories(dxg BEFORE PUBLIC
17 include) 33 ${AGILITY_SDK_DIR}/bin/x64)
18 34
19target_link_libraries(dxg PUBLIC 35target_link_libraries(dxg PUBLIC
20 DirectX-Headers 36 DirectX-Headers
21 D3D12.lib 37 D3D12.lib
22 DXGI.lib 38 DXGI.lib
23 DXGUID.lib) # For IID_Xyz symbols 39 DXGUID.lib) # For IID_Xyz symbols
40
41target_link_libraries(dxg PRIVATE
42 shaders)
43
44# Function to copy Agility SDK binaries to the D3D12\ directory next to the exe.
45# exe targets must call this function.
46function(install_agility_sdk exe_path)
47 cmake_path(APPEND d3d12_path ${exe_path} "D3D12")
48 if(NOT EXISTS ${d3d12_path})
49 message("D3D12 path = ${d3d12_path}")
50 message("AGILITY_SDK_BIN = ${AGILITY_SDK_BIN}")
51 file(MAKE_DIRECTORY ${d3d12_path})
52 file(COPY ${AGILITY_SDK_BIN}/ DESTINATION ${d3d12_path})
53 endif()
54endfunction()