aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/ryml/ext/c4core/cmake/FindD3D12.cmake
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-11-07 14:49:13 +0100
committerGitHub Enterprise <[email protected]>2025-11-07 14:49:13 +0100
commit24e43a913f29ac3b314354e8ce5175f135bcc64f (patch)
treeca442937ceeb63461012b33a4576e9835099f106 /thirdparty/ryml/ext/c4core/cmake/FindD3D12.cmake
parentget oplog attachments (#622) (diff)
downloadzen-24e43a913f29ac3b314354e8ce5175f135bcc64f.tar.xz
zen-24e43a913f29ac3b314354e8ce5175f135bcc64f.zip
switch to xmake for package management (#611)
This change removes our dependency on vcpkg for package management, in favour of bringing some code in-tree in the `thirdparty` folder as well as using the xmake build-in package management feature. For the latter, all the package definitions are maintained in the zen repo itself, in the `repo` folder. It should now also be easier to build the project as it will no longer depend on having the right version of vcpkg installed, which has been a common problem for new people coming in to the codebase. Now you should only need xmake to build. * Bumps xmake requirement on github runners to 2.9.9 to resolve an issue where xmake on Windows invokes cmake with `v144` toolchain which does not exist * BLAKE3 is now in-tree at `thirdparty/blake3` * cpr is now in-tree at `thirdparty/cpr` * cxxopts is now in-tree at `thirdparty/cxxopts` * fmt is now in-tree at `thirdparty/fmt` * robin-map is now in-tree at `thirdparty/robin-map` * ryml is now in-tree at `thirdparty/ryml` * sol2 is now in-tree at `thirdparty/sol2` * spdlog is now in-tree at `thirdparty/spdlog` * utfcpp is now in-tree at `thirdparty/utfcpp` * xmake package repo definitions is in `repo` * implemented support for sanitizers. ASAN is supported on windows, TSAN, UBSAN, MSAN etc are supported on Linux/MacOS though I have not yet tested it extensively on MacOS * the zencore encryption implementation also now supports using mbedTLS which is used on MacOS, though for now we still use openssl on Linux * crashpad * bumps libcurl to 8.11.0 (from 8.8.0) which should address a rare build upload bug
Diffstat (limited to 'thirdparty/ryml/ext/c4core/cmake/FindD3D12.cmake')
-rw-r--r--thirdparty/ryml/ext/c4core/cmake/FindD3D12.cmake75
1 files changed, 75 insertions, 0 deletions
diff --git a/thirdparty/ryml/ext/c4core/cmake/FindD3D12.cmake b/thirdparty/ryml/ext/c4core/cmake/FindD3D12.cmake
new file mode 100644
index 000000000..01e7a3ae9
--- /dev/null
+++ b/thirdparty/ryml/ext/c4core/cmake/FindD3D12.cmake
@@ -0,0 +1,75 @@
+# Find the win10 SDK path.
+if ("$ENV{WIN10_SDK_PATH}$ENV{WIN10_SDK_VERSION}" STREQUAL "" )
+ get_filename_component(WIN10_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]" ABSOLUTE CACHE)
+ get_filename_component(TEMP_WIN10_SDK_VERSION "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;ProductVersion]" ABSOLUTE CACHE)
+ get_filename_component(WIN10_SDK_VERSION ${TEMP_WIN10_SDK_VERSION} NAME)
+elseif(TRUE)
+ set (WIN10_SDK_PATH $ENV{WIN10_SDK_PATH})
+ set (WIN10_SDK_VERSION $ENV{WIN10_SDK_VERSION})
+endif ("$ENV{WIN10_SDK_PATH}$ENV{WIN10_SDK_VERSION}" STREQUAL "" )
+
+# WIN10_SDK_PATH will be something like C:\Program Files (x86)\Windows Kits\10
+# WIN10_SDK_VERSION will be something like 10.0.14393 or 10.0.14393.0; we need the
+# one that matches the directory name.
+
+if (IS_DIRECTORY "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}.0")
+ set(WIN10_SDK_VERSION "${WIN10_SDK_VERSION}.0")
+endif (IS_DIRECTORY "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}.0")
+
+
+# Find the d3d12 and dxgi include path, it will typically look something like this.
+# C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\um\d3d12.h
+# C:\Program Files (x86)\Windows Kits\10\Include\10.0.10586.0\shared\dxgi1_4.h
+find_path(D3D12_INCLUDE_DIR # Set variable D3D12_INCLUDE_DIR
+ d3d12.h # Find a path with d3d12.h
+ HINTS "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}/um"
+ DOC "path to WIN10 SDK header files"
+ HINTS
+ )
+
+find_path(DXGI_INCLUDE_DIR # Set variable DXGI_INCLUDE_DIR
+ dxgi1_4.h # Find a path with dxgi1_4.h
+ HINTS "${WIN10_SDK_PATH}/Include/${WIN10_SDK_VERSION}/shared"
+ DOC "path to WIN10 SDK header files"
+ HINTS
+ )
+
+if ("${DXC_BUILD_ARCH}" STREQUAL "x64" )
+ find_library(D3D12_LIBRARY NAMES d3d12.lib
+ HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x64 )
+elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM")
+ find_library(D3D12_LIBRARY NAMES d3d12.lib
+ HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm )
+elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM64")
+ find_library(D3D12_LIBRARY NAMES d3d12.lib
+ HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm64 )
+elseif ("${DXC_BUILD_ARCH}" STREQUAL "Win32" )
+ find_library(D3D12_LIBRARY NAMES d3d12.lib
+ HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x86 )
+endif ("${DXC_BUILD_ARCH}" STREQUAL "x64" )
+
+if ("${DXC_BUILD_ARCH}" STREQUAL "x64" )
+ find_library(DXGI_LIBRARY NAMES dxgi.lib
+ HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x64 )
+elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM")
+ find_library(DXGI_LIBRARY NAMES dxgi.lib
+ HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm )
+elseif (CMAKE_GENERATOR MATCHES "Visual Studio.*ARM64" OR "${DXC_BUILD_ARCH}" STREQUAL "ARM64")
+ find_library(DXGI_LIBRARY NAMES dxgi.lib
+ HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/arm64 )
+elseif ("${DXC_BUILD_ARCH}" STREQUAL "Win32" )
+ find_library(DXGI_LIBRARY NAMES dxgi.lib
+ HINTS ${WIN10_SDK_PATH}/Lib/${WIN10_SDK_VERSION}/um/x86 )
+endif ("${DXC_BUILD_ARCH}" STREQUAL "x64" )
+
+set(D3D12_LIBRARIES ${D3D12_LIBRARY} ${DXGI_LIBRARY})
+set(D3D12_INCLUDE_DIRS ${D3D12_INCLUDE_DIR} ${DXGI_INCLUDE_DIR})
+
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set D3D12_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args(D3D12 DEFAULT_MSG
+ D3D12_INCLUDE_DIRS D3D12_LIBRARIES)
+
+mark_as_advanced(D3D12_INCLUDE_DIRS D3D12_LIBRARIES)