@@ -107,6 +107,23 @@ 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+
110127# Download a protoc binary from Internet if needed
111128if (NOT ONNX_CUSTOM_PROTOC_EXECUTABLE AND NOT onnxruntime_USE_VCPKG)
112129 # This part of code is only for users' convenience. The code couldn't handle all cases. Users always can manually
@@ -287,7 +304,7 @@ if(NOT TARGET Boost::mp11)
287304 EXCLUDE_FROM_ALL
288305 FIND_PACKAGE_ARGS NAMES Boost
289306 )
290- onnxruntime_fetchcontent_makeavailable(mp11)
307+ onnxruntime_fetchcontent_makeavailable(mp11)
291308 if (NOT TARGET Boost::mp11)
292309 add_library (Boost::mp11 ALIAS Boost::headers)
293310 endif ()
@@ -425,9 +442,6 @@ target_include_directories(safeint_interface INTERFACE ${safeint_SOURCE_DIR})
425442
426443
427444# Flatbuffers
428- if (onnxruntime_USE_VCPKG)
429- find_package (flatbuffers REQUIRED)
430- else ()
431445# We do not need to build flatc for iOS or Android Cross Compile
432446if (CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android" OR CMAKE_SYSTEM_NAME STREQUAL "Emscripten" )
433447 set (FLATBUFFERS_BUILD_FLATC OFF CACHE BOOL "FLATBUFFERS_BUILD_FLATC" FORCE)
@@ -478,7 +492,6 @@ namespace std { using ::getenv; }
478492 endif ()
479493 endif ()
480494endif ()
481- endif ()
482495
483496# ONNX
484497if (NOT onnxruntime_USE_FULL_PROTOBUF)
@@ -659,10 +672,17 @@ if (onnxruntime_USE_WEBGPU)
659672
660673 # disable things we don't use
661674 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)
662680 set (DAWN_USE_X11 OFF CACHE BOOL "" FORCE)
663681
664682 set (TINT_BUILD_TESTS OFF CACHE BOOL "" FORCE)
665683 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)
666686 set (TINT_BUILD_IR_BINARY OFF CACHE BOOL "" FORCE)
667687 set (TINT_BUILD_SPV_READER OFF CACHE BOOL "" FORCE) # don't need. disabling is a large binary size saving
668688 set (TINT_BUILD_WGSL_WRITER ON CACHE BOOL "" FORCE) # needed to create cache key. runtime error if not enabled.
@@ -712,29 +732,7 @@ if (onnxruntime_USE_WEBGPU)
712732 # # if we need to apply patches in the future, we can uncomment the following line.
713733 #
714734 # The dawn.patch contains the following changes:
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- #
735+ # - https://dawn-review.googlesource.com/c/dawn/+/225514
738736 PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore -whitespace -p1 < ${PROJECT_SOURCE_DIR} /patches/dawn/dawn.patch
739737 EXCLUDE_FROM_ALL
740738 )
0 commit comments