Skip to content

Commit 7d2b148

Browse files
committed
FIx archive handling in CI
1 parent 02d9158 commit 7d2b148

File tree

4 files changed

+58
-6
lines changed

4 files changed

+58
-6
lines changed

.github/workflows/dawn.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ jobs:
155155
- name: Download all build artifacts
156156
uses: actions/download-artifact@v5
157157
with:
158+
pattern: dawn-build-*
158159
path: Dawn/builds/
160+
merge-multiple: true
159161

160162
- name: Download Dawn version
161163
uses: actions/download-artifact@v5
@@ -187,7 +189,7 @@ jobs:
187189
- name: Download bundle artifact
188190
uses: actions/download-artifact@v5
189191
with:
190-
pattern: dawn-build-*
192+
name: dawn-webgpu-bundle
191193
path: dawn-bundle/
192194
merge-multiple: true
193195

Dawn/dawn_builder.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
class BuildDawnError(Exception): pass
2828
class SDKPathNotFoundError(BuildDawnError): pass
2929
class CMakeError(BuildDawnError): pass
30+
class CMakeBuildError(BuildDawnError): pass
3031
class UploadArchiverError(BuildDawnError): pass
3132
# fmt: on
3233

@@ -59,6 +60,15 @@ def is_apple(self) -> bool:
5960
"""
6061
return self in [OS.MACOS, OS.IPHONE, OS.IPADOS]
6162

63+
def is_windows(self) -> bool:
64+
"""
65+
Check if this OS is Windows.
66+
67+
Returns:
68+
True if this is a Windows OS
69+
"""
70+
return self == OS.WINDOWS
71+
6272

6373
def get_current_os() -> OS:
6474
"""
@@ -90,6 +100,7 @@ class TargetConfig:
90100
sdk: Optional[str] = None
91101
deployment_target: Optional[str] = None
92102
debug: bool = False
103+
build_tool: str = "Ninja"
93104

94105
def __str__(self) -> str:
95106
"""
@@ -259,10 +270,10 @@ def build_dawn(
259270

260271
cmake_exec = shutil.which("cmake", path=os.environ.get("PATH"))
261272

262-
# Run cmake command
273+
# Run cmake command to create the build files
263274
try:
264275
subprocess.run(
265-
[cmake_exec, "-GNinja", *flags, str(dawn_path)],
276+
[cmake_exec, f"-G{target_config.build_tool}", *flags, str(dawn_path)],
266277
env=os.environ,
267278
cwd=build_dir,
268279
capture_output=True,
@@ -273,9 +284,22 @@ def build_dawn(
273284
_subprocess_exception_message(e)
274285
raise CMakeError
275286

276-
# Run ninja command
277-
ninja_exec = shutil.which("ninja", path=os.environ.get("PATH"))
278-
subprocess.run([ninja_exec], cwd=build_dir, check=True)
287+
# Run the cmake build command
288+
try:
289+
subprocess.run(
290+
[
291+
cmake_exec,
292+
"--build",
293+
".",
294+
"--config",
295+
"Debug" if target_config.debug else "Release",
296+
],
297+
cwd=build_dir,
298+
check=True,
299+
)
300+
except subprocess.CalledProcessError as e:
301+
_subprocess_exception_message(e)
302+
raise CMakeBuildError
279303

280304
# Install the library and headers
281305
try:

Dawn/dawn_source.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/cmake/DawnLibrary.cmake b/src/cmake/DawnLibrary.cmake
2+
index a5352433f0..fbdcb260db 100644
3+
--- a/src/cmake/DawnLibrary.cmake
4+
+++ b/src/cmake/DawnLibrary.cmake
5+
@@ -182,7 +182,7 @@ function(dawn_install_target name)
6+
# When building in debug mode with MSVC, install PDB files together with binaries
7+
if (MSVC)
8+
get_target_property(target_type "${name}" TYPE)
9+
- if ((target_type STREQUAL "STATIC_LIBRARY") OR (target_type STREQUAL "SHARED_LIBRARY") OR (target_type STREQUAL "EXECUTABLE"))
10+
+ if ((target_type STREQUAL "SHARED_LIBRARY") OR (target_type STREQUAL "EXECUTABLE"))
11+
install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
12+
endif()
13+
endif (MSVC)

Dawn/dawn_source.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,19 @@ def fetch_dawn_source(hash: str) -> None:
155155
except subprocess.CalledProcessError as e:
156156
raise GitOperationError(f"Failed to checkout Dawn repository: {e.stderr}")
157157

158+
# Apply the patch to the Dawn source
159+
print("Applying patch to Dawn source...")
160+
try:
161+
subprocess.run(
162+
["git", "apply", "../dawn_source.patch"],
163+
cwd=str(get_dawn_path()),
164+
check=True,
165+
capture_output=True,
166+
text=True,
167+
)
168+
except subprocess.CalledProcessError as e:
169+
raise GitOperationError(f"Failed to apply patch to Dawn repository: {e.stderr}")
170+
158171
# Verify Dawn tools directory and fetch dawn dependencies
159172
dawn_source_tools = dest_dir / "tools" / "fetch_dawn_dependencies.py"
160173
if not dawn_source_tools.exists():

0 commit comments

Comments
 (0)