Skip to content

Commit f04b718

Browse files
committed
Update WebGPU build script
1 parent 9f852fa commit f04b718

3 files changed

Lines changed: 32 additions & 4 deletions

File tree

packages/webgpu/scripts/build/apple.toolchain.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,9 @@ elseif(PLATFORM_INT STREQUAL "MAC_UNIVERSAL")
585585
if(NOT ARCHS)
586586
set(ARCHS "x86_64;arm64")
587587
endif()
588-
string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}")
589-
set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET})
588+
# For universal builds, don't set target triple - let CMake handle it
589+
# string(REPLACE ";" "-" ARCHS_SPLIT "${ARCHS}")
590+
# set(APPLE_TARGET_TRIPLE_INT ${ARCHS_SPLIT}-apple-macosx${DEPLOYMENT_TARGET})
590591
elseif(PLATFORM_INT STREQUAL "MAC_CATALYST_UNIVERSAL")
591592
set(SDK_NAME macosx)
592593
if(NOT ARCHS)

packages/webgpu/scripts/build/dawn.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ const apple = {
9696
(async () => {
9797
process.chdir("../..");
9898
process.chdir("externals/dawn");
99-
$("git reset --hard HEAD");
99+
$(
100+
"git reset --hard HEAD && git submodule foreach --recursive git reset --hard HEAD && git submodule update --init --recursive",
101+
);
100102
$(`git apply ${__dirname}/static_build.patch`);
101103
process.chdir("../..");
102104
console.log("Copy headers");

packages/webgpu/scripts/build/static_build.patch

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/src/cmake/BundleLibraries.cmake b/src/cmake/BundleLibraries.cmake
2-
index 046a6af10d..5a63ac3d6d 100644
2+
index 046a6af10d..ee272710fd 100644
33
--- a/src/cmake/BundleLibraries.cmake
44
+++ b/src/cmake/BundleLibraries.cmake
55
@@ -66,8 +66,11 @@ function(bundle_libraries output_target)
@@ -16,3 +16,28 @@ index 046a6af10d..5a63ac3d6d 100644
1616
add_dependencies(${output_target} ${ARGN})
1717

1818
endfunction()
19+
Submodule third_party/abseil-cpp contains modified content
20+
diff --git a/third_party/abseil-cpp/absl/copts/AbseilConfigureCopts.cmake b/third_party/abseil-cpp/absl/copts/AbseilConfigureCopts.cmake
21+
index 3f737c8..9b8bb4b 100644
22+
--- a/third_party/abseil-cpp/absl/copts/AbseilConfigureCopts.cmake
23+
+++ b/third_party/abseil-cpp/absl/copts/AbseilConfigureCopts.cmake
24+
@@ -11,6 +11,11 @@ else()
25+
endif()
26+
27+
if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES [[Clang]])
28+
+ # Fix for iOS/visionOS ARM64 builds - skip x86_64 flags when building for ARM64 only
29+
+ if((CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "visionOS") AND CMAKE_OSX_ARCHITECTURES MATCHES "arm64" AND NOT CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
30+
+ set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_ARM64_FLAGS}")
31+
+ list(APPEND ABSL_RANDOM_RANDEN_COPTS "-Wno-unused-command-line-argument")
32+
+ else()
33+
# Some CMake targets (not known at the moment of processing) could be set to
34+
# compile for multiple architectures as specified by the OSX_ARCHITECTURES
35+
# property, which is target-specific. We should neither inspect nor rely on
36+
@@ -52,6 +57,7 @@ if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES [[Clang]])
37+
if(ABSL_RANDOM_RANDEN_COPTS AND NOT ABSL_RANDOM_RANDEN_COPTS_WARNING)
38+
list(APPEND ABSL_RANDOM_RANDEN_COPTS "-Wno-unused-command-line-argument")
39+
endif()
40+
+ endif() # End iOS ARM64 fix
41+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
42+
if (MSVC)
43+
set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_MSVC_X64_FLAGS}")

0 commit comments

Comments
 (0)