@@ -637,6 +637,15 @@ endif()
637637
638638
639639if (onnxruntime_USE_WEBGPU)
640+ if (DAWN_USE_AGILITY_SDK)
641+ if (NOT WIN32 )
642+ message (FATAL_ERROR "DAWN_USE_AGILITY_SDK is only supported on Windows." )
643+ endif ()
644+ if (NOT onnxruntime_ENABLE_DAWN_BACKEND_D3D12)
645+ message (FATAL_ERROR "DAWN_USE_AGILITY_SDK requires the Dawn D3D12 backend." )
646+ endif ()
647+ endif ()
648+
640649 # TODO: the following code is used to disable building Dawn using vcpkg temporarily
641650 # until we figure out how to resolve the packaging pipeline failures
642651 #
@@ -832,7 +841,40 @@ if (onnxruntime_USE_WEBGPU)
832841 )
833842 endif ()
834843
844+ if (DAWN_USE_AGILITY_SDK)
845+ # Set Dawn's expected Chromium CIPD layout before configuring Dawn. The SDK
846+ # package is populated below, before any Dawn target is compiled.
847+ if (onnxruntime_CUSTOM_DAWN_SRC_PATH)
848+ set (ONNXRUNTIME_DAWN_SRC_DIR "${onnxruntime_CUSTOM_DAWN_SRC_PATH} " )
849+ else ()
850+ if (FETCHCONTENT_BASE_DIR)
851+ set (ONNXRUNTIME_DAWN_SRC_DIR "${FETCHCONTENT_BASE_DIR} /dawn-src" )
852+ else ()
853+ set (ONNXRUNTIME_DAWN_SRC_DIR "${CMAKE_BINARY_DIR } /_deps/dawn-src" )
854+ endif ()
855+ endif ()
856+ set (DAWN_AGILITY_SDK_DIR "${ONNXRUNTIME_DAWN_SRC_DIR} /third_party/agility-sdk"
857+ CACHE PATH "Directory containing the D3D12 Agility SDK" FORCE )
858+ message (STATUS "Dawn Agility SDK directory: ${DAWN_AGILITY_SDK_DIR} " )
859+ endif ()
860+
835861 onnxruntime_fetchcontent_makeavailable (dawn )
862+
863+ if (DAWN_USE_AGILITY_SDK)
864+ onnxruntime_fetchcontent_declare (
865+ dawn_agility_sdk
866+ URL ${DEP_URL_dawn_agility_sdk}
867+ URL_HASH SHA1=${DEP_SHA1_dawn_agility_sdk}
868+ SOURCE_DIR "${DAWN_AGILITY_SDK_DIR} /src"
869+ EXCLUDE_FROM_ALL
870+ )
871+ onnxruntime_fetchcontent_makeavailable (dawn_agility_sdk )
872+ if (NOT EXISTS "${DAWN_AGILITY_SDK_DIR} /src/build/native/include/d3d12.h" )
873+ message (FATAL_ERROR
874+ "The Agility SDK package does not contain build/native/include/d3d12.h: "
875+ "${DAWN_AGILITY_SDK_DIR} /src" )
876+ endif ()
877+ endif ()
836878 endif ()
837879
838880 if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
0 commit comments