forked from mmozeiko/build-dawn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
53 lines (41 loc) · 1.76 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
cd "$(dirname "$0")"
OS=$1
ARCH=$2
OUT_DIR="out/Release"
# Clone the repo as "dawn"
git clone https://dawn.googlesource.com/dawn dawn && cd dawn
# Fetch dependencies (lose equivalent of gclient sync)
python tools/fetch_dawn_dependencies.py
mkdir -p $OUT_DIR
cd $OUT_DIR
cmake \
-S ../.. \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS=OFF \
-D BUILD_SAMPLES=OFF \
-D DAWN_ENABLE_METAL=ON \
-D DAWN_ENABLE_NULL=OFF \
-D DAWN_ENABLE_DESKTOP_GL=OFF \
-D DAWN_ENABLE_OPENGLES=OFF \
-D DAWN_ENABLE_VULKAN=ON \
-D DAWN_USE_GLFW=OFF \
-D DAWN_ENABLE_SPIRV_VALIDATION=ON \
-D DAWN_BUILD_SAMPLES=OFF \
-D TINT_ENABLE_INSTALL=ON \
-D TINT_BUILD_SPV_READER=ON \
-D TINT_BUILD_WGSL_WRITER=ON \
-D TINT_BUILD_TESTS=OFF \
|| exit 1
#make # -j N for N-way parallel build
cmake --build . --config Release --target webgpu_dawn tint_cmd_tint_cmd || exit 1
# Zip build output
cd ../..
mkdir dawn-$OS-$ARCH
echo $DAWN_COMMIT > dawn-$OS-$ARCH/commit.txt
cp $OUT_DIR/gen/include/dawn/webgpu.h dawn-$OS-$ARCH
cp $OUT_DIR/tint dawn-$OS-$ARCH
cp $OUT_DIR/src/dawn/native/libwebgpu_dawn.dylib dawn-$OS-$ARCH
cp $OUT_DIR/src/tint/libtint_api.a dawn-$OS-$ARCH
rm -f dawn-$OS-$ARCH-$BUILD_DATE.zip
zip -9 -r dawn-$OS-$ARCH-$BUILD_DATE.zip dawn-$OS-$ARCH || echo "could not zip artifacts"
cp -f dawn-$OS-$ARCH-$BUILD_DATE.zip .. || echo "could not copy zip artifacts to root dir"