Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,6 @@ cd packages/webgpu
yarn build-dawn
```

You can also filter the platforms to build, for instance to skip the macOS and visionOS build:
```sh
yarn build-dawn --exclude=xros,xrsimulator,macosx
```

Alternatively if you want to build for a specific platform only, you can use `includeOnly`.
```sh
yarn build-dawn --includeOnly=xros,xrsimulator
```

### Downloading Dawn

There is an alternative way which is to download the prebuilt binaries from GitHub.
Expand Down
43 changes: 5 additions & 38 deletions packages/webgpu/scripts/build/dawn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

import { chdir } from "process";

import yargs from "yargs";
import { hideBin } from "yargs/helpers";

import type { Platform } from "./dawn-configuration";
import { $, mapKeys } from "./util";
import {
Expand All @@ -17,37 +14,6 @@ import {
projectRoot,
} from "./dawn-configuration";

const { argv } = yargs(hideBin(process.argv))
.option("exclude", {
type: "string",
describe: "Comma-separated list of platforms to exclude",
})
.option("includeOnly", {
type: "string",
describe: "Comma-separated list of platforms to include exclusively",
});

// Function to filter platforms based on exclude list
function filterPlatforms<T extends string>(
platforms: T[],
excludeList: string[],
includeOnlyList: string[],
): T[] {
if (includeOnlyList.length > 0) {
return platforms.filter((platform) => includeOnlyList.includes(platform));
} else {
return platforms.filter((platform) => !excludeList.includes(platform));
}
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const args = argv as any;
const excludeList = args.exclude ? args.exclude.split(",") : [];
const includeOnlyList = args.includeOnly ? args.includeOnly.split(",") : [];

const platforms = (plts: string[]) =>
filterPlatforms(plts, excludeList, includeOnlyList) as Platform[];

const commonArgs = {
CMAKE_BUILD_TYPE: "Release",
BUILD_SAMPLES: "OFF",
Expand All @@ -73,7 +39,7 @@ const PLATFORM_MAP: Record<string, string> = {
};

const android = {
platforms: platforms(["arm64-v8a", "armeabi-v7a", "x86", "x86_64"]),
platforms: ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"] as Platform[],
args: {
CMAKE_TOOLCHAIN_FILE: "$ANDROID_NDK/build/cmake/android.toolchain.cmake",
ANDROID_PLATFORM: "android-26",
Expand All @@ -83,9 +49,9 @@ const android = {

const apple = {
matrix: {
arm64: platforms(["iphoneos", "iphonesimulator", "xros", "xrsimulator"]),
x86_64: platforms(["iphonesimulator"]),
universal: platforms(["macosx"]),
arm64: ["iphoneos", "iphonesimulator", "xros", "xrsimulator"],
x86_64: ["iphonesimulator"],
universal: ["macosx"],
},
args: {
CMAKE_TOOLCHAIN_FILE: `${__dirname}/apple.toolchain.cmake`,
Expand All @@ -96,6 +62,7 @@ const apple = {
(async () => {
process.chdir("../..");
process.chdir("externals/dawn");
$("git submodule update --init third_party/abseil-cpp");
$(
"git reset --hard HEAD && cd third_party/abseil-cpp && git reset --hard HEAD && cd ../..",
);
Expand Down