-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpulldawn.sh
More file actions
executable file
·92 lines (72 loc) · 3.13 KB
/
pulldawn.sh
File metadata and controls
executable file
·92 lines (72 loc) · 3.13 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
DAWNCOMMIT=`cat dawn.commit`
echo "using dawn commit $DAWNCOMMIT"
OS=`uname -s`
ARCH_FLAGS=""
ARCH_NAME="AMD64"
if [ "$OS" = "Darwin" ];
then
if [ "$1" = "x86_64" ]; then
ARCH="x86_64"
elif [ "$1" = "arm64" ]; then
ARCH="arm64"
ARCH_NAME="ARM64"
else
ARCH=`uname -m | tail -1`
fi
if [ "$ARCH" = "arm64" ]; then
ARCH_NAME="ARM64"
fi
ARCH_FLAGS="-DCMAKE_OSX_ARCHITECTURES=$ARCH"
fi
echo "$OS $ARCH $ARCH_NAME"
cd src/WebGPUNative || exit 1
rm -dfr tmp
mkdir -p tmp
cd tmp || exit 1
# git clone https://github.com/google/dawn.git
mkdir dawn
cd dawn || exit 1
git init
git remote add origin https://github.com/google/dawn.git
git fetch --depth 1 origin $DAWNCOMMIT
git reset --hard FETCH_HEAD
# git checkout $DAWNCOMMIT
python tools/fetch_dawn_dependencies.py --use-test-deps
mkdir -p out/Release
cd out/Release || exit 1
# github action runners run out of memory when using -j, so we limit the threads to 2
MAKEARGS='-j '
if [ "$GITHUB_ACTIONS" = "true" ]; then
MAKEARGS='-j 2'
fi
cmake -S ../.. -B . -G "Unix Makefiles" -DCMAKE_CXX_STANDARD=17 -DDAWN_BUILD_TESTS=OFF -DTINT_BUILD_TESTS=OFF -DTINT_BUILD_CMD_TOOLS=OFF -DCMAKE_BUILD_TYPE=Release $ARCH_FLAGS -DCMAKE_INSTALL_PREFIX=./blabber -DTINT_BUILD_SPV_READER=1 -DTINT_BUILD_WGSL_WRITER=1 || { echo 'cmake failed' ; exit 1; }
make $MAKEARGS webgpu_dawn
# Copy dawn.json
cp ../../src/dawn/dawn.json ../../../../../../
# Copy Libs
if [ "$OS" = "Darwin" ]; then
mkdir -p ../../../../../../libs/Native/WebGPU/mac/$ARCH_NAME/
cp ./src/dawn/native/libwebgpu_dawn.dylib ../../../../../../libs/Native/WebGPU/mac/$ARCH_NAME/ || { echo 'copy failed' ; exit 1; }
echo $DAWNCOMMIT > ../../../../../../libs/Native/WebGPU/mac/$ARCH_NAME/dawn.commit
else
mkdir -p ../../../../../../libs/Native/WebGPU/linux/$ARCH_NAME/
cp ./src/dawn/native/libwebgpu_dawn.so ../../../../../../libs/Native/WebGPU/linux/$ARCH_NAME/ || { echo 'copy failed' ; exit 1; }
echo $DAWNCOMMIT > ../../../../../../libs/Native/WebGPU/linux/$ARCH_NAME/dawn.commit
fi
# Copy Headers
mkdir -p ../../../../../../include/dawn/webgpu
mkdir -p ../../../../../../include/src/tint
mkdir -p ../../../../../../include/src/utils
rsync -ar --include='*/' --include='*.h' --exclude='*' gen/include/dawn/ ../../../../../../include/dawn
rsync -ar --include='*/' --include='*.h' --exclude='*' ../../include/ ../../../../../../include
rsync -a --include='*/' --include='*.h' --exclude='*' ../../src/tint/ ../../../../../../include/src/tint/
rsync -ar --include='*/' --include='*.h' --exclude='*' ../../src/utils/ ../../../../../../include/src/utils/
cp ./gen/include/dawn/webgpu.h ../../../../../../include/dawn/webgpu/webgpu.h
cp ./gen/include/dawn/webgpu_cpp.h ../../../../../../include/dawn/webgpu_cpp.h
cp ./gen/src/emdawnwebgpu/include/webgpu/webgpu_cpp_chained_struct.h ../../../../../../include/dawn/webgpu/webgpu_cpp_chained_struct.h
cp ../../include/webgpu/webgpu_enum_class_bitmasks.h ../../../../../../include/dawn/webgpu/webgpu_enum_class_bitmasks.h
cp ./gen/webgpu-headers/webgpu.h ../../../../../../include/dawn/webgpu.h
cd ../../../../../../
dotnet fsi Generator.fsx
./buildnative.sh $ARCH