mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-04 04:07:22 +00:00
allow specify a custom local source path for Dawn (#22999)
### Description Allows to build ONNX Runtime with a custom local path of Dawn's source code. Usage: ```sh build --use_webgpu --cmake_extra_defines "onnxruntime_CUSTOM_DAWN_SRC_PATH=C:/src/dawn" ```
This commit is contained in:
parent
4497c97d54
commit
e84b8e7bd5
2 changed files with 18 additions and 6 deletions
|
|
@ -148,6 +148,7 @@ option(onnxruntime_USE_XNNPACK "Build with XNNPACK support. Provides an alternat
|
|||
option(onnxruntime_USE_WEBNN "Build with WebNN support. Enable hardware acceleration in web browsers." OFF)
|
||||
option(onnxruntime_USE_WEBGPU "Build with WebGPU support. Enable WebGPU via C/C++ interface." OFF)
|
||||
option(onnxruntime_USE_EXTERNAL_DAWN "Build with treating Dawn as external dependency. Will not link Dawn at build time." OFF)
|
||||
option(onnxruntime_CUSTOM_DAWN_SRC_PATH "Path to custom Dawn src dir.")
|
||||
|
||||
# Options related to reducing the binary size produced by the build
|
||||
# XNNPACK EP requires the internal NHWC contrib ops to be available, so this option must be OFF when onnxruntime_USE_XNNPACK is ON
|
||||
|
|
|
|||
23
cmake/external/onnxruntime_external_deps.cmake
vendored
23
cmake/external/onnxruntime_external_deps.cmake
vendored
|
|
@ -615,12 +615,23 @@ if (onnxruntime_USE_COREML)
|
|||
endif()
|
||||
|
||||
if (onnxruntime_USE_WEBGPU)
|
||||
FetchContent_Declare(
|
||||
dawn
|
||||
URL ${DEP_URL_dawn}
|
||||
URL_HASH SHA1=${DEP_SHA1_dawn}
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn.patch
|
||||
)
|
||||
if (onnxruntime_CUSTOM_DAWN_SRC_PATH)
|
||||
# use the custom dawn source path if provided
|
||||
#
|
||||
# specified as:
|
||||
# build.py --use_webgpu --cmake_extra_defines "onnxruntime_CUSTOM_DAWN_SRC_PATH=<PATH_TO_DAWN_SRC_ROOT>"
|
||||
FetchContent_Declare(
|
||||
dawn
|
||||
SOURCE_DIR ${onnxruntime_CUSTOM_DAWN_SRC_PATH}
|
||||
)
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
dawn
|
||||
URL ${DEP_URL_dawn}
|
||||
URL_HASH SHA1=${DEP_SHA1_dawn}
|
||||
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn.patch
|
||||
)
|
||||
endif()
|
||||
|
||||
# use dawn::dawn_native and dawn::dawn_proc instead of the monolithic dawn::webgpu_dawn to minimize binary size
|
||||
set(DAWN_BUILD_MONOLITHIC_LIBRARY OFF CACHE BOOL "" FORCE)
|
||||
|
|
|
|||
Loading…
Reference in a new issue