blob: 10402763c4dccf8800f0e706b00f6ad3f30de08a (
plain)
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
|
cmake_minimum_required(VERSION 3.20)
project(dxg)
# Agility SDK.
# Give AGILITY_SDK_BIN PARENT_SCOPE so that it is accessible from the
# install_agility_sdk function below.
set(AGILITY_SDK_DIR "../contrib/microsoft.direct3d.d3d12.1.618.4/build/native")
set(AGILITY_SDK_BIN "${AGILITY_SDK_DIR}/bin/x64" PARENT_SCOPE)
add_subdirectory(shaders)
add_library(dxg
include/dxg/dxcommon.h
include/dxg/dxg.h
include/dxg/imm.h
src/dxcommon.c
src/imm.c)
# exe must export these so that D3D12.dll can find and load D3D12Core.dll and
# other DLLs from the Agility SDK.
target_compile_definitions(dxg PRIVATE
AGILITY_SDK_VERSION=618 # Must match AGILITY_SDK_DIR above.
AGILITY_SDK_INSTALL=u8".\\\\D3D12\\\\") # Binaries will be copied to this subdirectory.
# Use BEFORE so that the D3D headers in the Agility SDK are picked before the
# ones in the Windows SDK.
target_include_directories(dxg BEFORE PUBLIC
include
${AGILITY_SDK_DIR}/include)
target_link_directories(dxg BEFORE PUBLIC
${AGILITY_SDK_DIR}/bin/x64)
target_link_libraries(dxg PUBLIC
DirectX-Headers
D3D12.lib
DXGI.lib
DXGUID.lib) # For IID_Xyz symbols
target_link_libraries(dxg PRIVATE
shaders)
# Function to copy Agility SDK binaries to the D3D12\ directory next to the exe.
# exe targets must call this function.
function(install_agility_sdk exe_path)
cmake_path(APPEND d3d12_path ${exe_path} "D3D12")
if(NOT EXISTS ${d3d12_path})
message("D3D12 path = ${d3d12_path}")
message("AGILITY_SDK_BIN = ${AGILITY_SDK_BIN}")
file(MAKE_DIRECTORY ${d3d12_path})
file(COPY ${AGILITY_SDK_BIN}/ DESTINATION ${d3d12_path})
endif()
endfunction()
|