@@ -107,23 +107,6 @@ if(onnxruntime_USE_MIMALLOC)
107107 FetchContent_MakeAvailable(mimalloc)
108108endif ()
109109
110- #Protobuf depends on utf8_range
111- onnxruntime_fetchcontent_declare(
112- utf8_range
113- URL ${DEP_URL_utf8_range}
114- URL_HASH SHA1=${DEP_SHA1_utf8_range}
115- EXCLUDE_FROM_ALL
116- FIND_PACKAGE_ARGS NAMES utf8_range
117- )
118-
119- set (utf8_range_ENABLE_TESTS OFF CACHE BOOL "Build test suite" FORCE)
120- set (utf8_range_ENABLE_INSTALL OFF CACHE BOOL "Configure installation" FORCE)
121-
122- # The next line will generate an error message "fatal: not a git repository", but it is ok. It is from flatbuffers
123- onnxruntime_fetchcontent_makeavailable(utf8_range)
124- # protobuf's cmake/utf8_range.cmake has the following line
125- include_directories (${utf8_range_SOURCE_DIR} )
126-
127110# Download a protoc binary from Internet if needed
128111if (NOT ONNX_CUSTOM_PROTOC_EXECUTABLE AND NOT onnxruntime_USE_VCPKG)
129112 # This part of code is only for users' convenience. The code couldn't handle all cases. Users always can manually
@@ -304,7 +287,7 @@ if(NOT TARGET Boost::mp11)
304287 EXCLUDE_FROM_ALL
305288 FIND_PACKAGE_ARGS NAMES Boost
306289 )
307- onnxruntime_fetchcontent_makeavailable(mp11)
290+ onnxruntime_fetchcontent_makeavailable(mp11)
308291 if (NOT TARGET Boost::mp11)
309292 add_library (Boost::mp11 ALIAS Boost::headers)
310293 endif ()
@@ -442,6 +425,9 @@ target_include_directories(safeint_interface INTERFACE ${safeint_SOURCE_DIR})
442425
443426
444427# Flatbuffers
428+ if (onnxruntime_USE_VCPKG)
429+ find_package (flatbuffers REQUIRED)
430+ else ()
445431# We do not need to build flatc for iOS or Android Cross Compile
446432if (CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
447433 set (FLATBUFFERS_BUILD_FLATC OFF CACHE BOOL "FLATBUFFERS_BUILD_FLATC" FORCE)
@@ -492,6 +478,7 @@ namespace std { using ::getenv; }
492478 endif ()
493479 endif ()
494480endif ()
481+ endif ()
495482
496483# ONNX
497484if (NOT onnxruntime_USE_FULL_PROTOBUF)
@@ -672,17 +659,10 @@ if (onnxruntime_USE_WEBGPU)
672659
673660 # disable things we don't use
674661 set (DAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG OFF )
675- set (DAWN_ENABLE_DESKTOP_GL OFF CACHE BOOL "" FORCE)
676- set (DAWN_ENABLE_OPENGLES OFF CACHE BOOL "" FORCE)
677- set (DAWN_SUPPORTS_GLFW_FOR_WINDOWING OFF CACHE BOOL "" FORCE)
678- set (DAWN_USE_GLFW OFF CACHE BOOL "" FORCE)
679- set (DAWN_USE_WINDOWS_UI OFF CACHE BOOL "" FORCE)
680662 set (DAWN_USE_X11 OFF CACHE BOOL "" FORCE)
681663
682664 set (TINT_BUILD_TESTS OFF CACHE BOOL "" FORCE)
683665 set (TINT_BUILD_CMD_TOOLS OFF CACHE BOOL "" FORCE)
684- set (TINT_BUILD_GLSL_WRITER OFF CACHE BOOL "" FORCE)
685- set (TINT_BUILD_GLSL_VALIDATOR OFF CACHE BOOL "" FORCE)
686666 set (TINT_BUILD_IR_BINARY OFF CACHE BOOL "" FORCE)
687667 set (TINT_BUILD_SPV_READER OFF CACHE BOOL "" FORCE) # don't need. disabling is a large binary size saving
688668 set (TINT_BUILD_WGSL_WRITER ON CACHE BOOL "" FORCE) # needed to create cache key. runtime error if not enabled.
@@ -732,7 +712,29 @@ if (onnxruntime_USE_WEBGPU)
732712 # # if we need to apply patches in the future, we can uncomment the following line.
733713 #
734714 # The dawn.patch contains the following changes:
735- # - https://dawn-review.googlesource.com/c/dawn/+/225514
715+ #
716+ # - (public) CMake fix to support Emscripten v4.0.3+
717+ # This change allows Dawn to find the file "gen_struct_info.py" in the correct location.
718+ # https://dawn-review.googlesource.com/c/dawn/+/225514
719+ #
720+ # - (public) Fix emwgpu C++ implementation for buffer destroy
721+ # In native implementation, wgpuBufferRelease will trigger the buffer destroy (if refcount decreased to 0). But
722+ # in emwgpu implementation, the buffer destroy won't happen. This change fixes the bug.
723+ # https://dawn-review.googlesource.com/c/dawn/+/226315
724+ #
725+ # - (private) Allow "external" buffer in emwgpu C++ implementation
726+ # This change allows WGPUBufferImpl to destroy the buffer when the refcount decreased to 0 only for non-external
727+ # buffer.
728+ # "external buffer" means the GPUBuffer instance created in JavaScript and imported to C++ by `importJsBuffer`.
729+ #
730+ # - (private) Remove hard-coded CMAKE_OSX_DEPLOYMENT_TARGET in Dawn's CMake files
731+ # https://github.com/microsoft/onnxruntime/pull/23729
732+ #
733+ # - (private) Fix external ref count for "external" device in emwgpu C++ implementation
734+ # This change fixes the incorrect external ref count for class WGPUDeviceImpl when used with "external" device.
735+ # "external device" means the GPUDevice instance created in JavaScript and imported to C++ by `importJsDevice`.
736+ #
737+ #
736738 PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore -whitespace -p1 < ${PROJECT_SOURCE_DIR} /patches/dawn/dawn.patch
737739 EXCLUDE_FROM_ALL
738740 )
0 commit comments