Skip to content

Commit e34d88f

Browse files
authored
Merge pull request #43 from aidanfnv/main
Update build scripts for emsdk 4.0.11 compatibility, pin that release for CI use
2 parents 2281e20 + ea66c59 commit e34d88f

5 files changed

Lines changed: 34 additions & 28 deletions

File tree

.github/actions/build-wasm-deps/action.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ runs:
1414
run: |
1515
sudo apt-get update
1616
sudo apt-get install -y ninja-build
17-
if [ ! -d "emsdk" ]; then
18-
git clone https://github.com/emscripten-core/emsdk.git
19-
sed -i 's/\r$//' emsdk/emsdk emsdk/emsdk_env.sh
20-
fi
17+
source ./build_scripts/setup-emsdk.sh
2118
2219
- name: get slang head commit
2320
shell: bash
@@ -30,12 +27,7 @@ runs:
3027
- name: get spirv-tool head commit
3128
shell: bash
3229
run: |
33-
if [ ! -d "spirv-tools" ]; then
34-
git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
35-
pushd spirv-tools
36-
git checkout vulkan-sdk-1.3.290.0
37-
popd
38-
fi
30+
source ./build_scripts/setup-spirv-tools.sh
3931
git -C spirv-tools rev-parse HEAD > key-spirv-tool.txt
4032
4133
- name: restore slang-wasm

build_scripts/setup-emsdk.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# Shared script to setup emsdk with pinned version
4+
EMSDK_TAG="4.0.11"
5+
6+
echo "[$(date)] Setup emsdk ..."
7+
if [ ! -d emsdk ]; then
8+
git clone --branch $EMSDK_TAG --depth 1 https://github.com/emscripten-core/emsdk.git
9+
fi

build_scripts/setup-spirv-tools.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Shared script to setup SPIRV Tools with pinned version
4+
SPIRV_TOOLS_TAG="vulkan-sdk-1.3.290.0"
5+
6+
echo "[$(date)] Setup SPIRV Tools ..."
7+
if [ ! -d spirv-tools ]; then
8+
git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
9+
fi
10+
11+
pushd spirv-tools
12+
git checkout $SPIRV_TOOLS_TAG
13+
popd

build_scripts/slang-wasm-build.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ do
1212
fi
1313
done
1414

15-
echo "[$(date)] Sync emsdk repo ..."
16-
if [ ! -d emsdk ]
17-
then
18-
git clone https://github.com/emscripten-core/emsdk.git
19-
fi
15+
# Setup pinned emsdk version using shared script
16+
source ./build_scripts/setup-emsdk.sh
2017

2118
pushd emsdk
2219
sed -i 's/\r$//' emsdk emsdk_env.sh
@@ -46,7 +43,7 @@ sed -i '/^[[:space:]]*target_link_options(/,/^[[:space:]]*)/c\
4643
-sMODULARIZE=1\
4744
-sEXPORT_ES6=0\
4845
-sSINGLE_FILE=1\
49-
-sENVIRONMENT="worker"\
46+
-sENVIRONMENT=worker\
5047
-sEXPORTED_RUNTIME_METHODS=['FS']\
5148
)' "source/slang-wasm/CMakeLists.txt"
5249

@@ -107,7 +104,7 @@ sed -i '/^[[:space:]]*target_link_options(/,/^[[:space:]]*)/c\
107104
-sMODULARIZE=1\
108105
-sEXPORT_ES6=0\
109106
-sSINGLE_FILE=1\
110-
-sENVIRONMENT="node"\
107+
-sENVIRONMENT=node\
111108
-sEXPORTED_RUNTIME_METHODS=['FS']\
112109
)' "source/slang-wasm/CMakeLists.txt"
113110

build_scripts/spirv-tool-wasm-build.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#!/bin/bash
22

3-
if [ ! -d emsdk ]
4-
then
5-
git clone https://github.com/emscripten-core/emsdk.git emsdk
6-
fi
3+
# Setup pinned emsdk version using shared script
4+
source ./build_scripts/setup-emsdk.sh
75

86
pushd emsdk
97
sed -i 's/\r$//' emsdk emsdk_env.sh
@@ -12,19 +10,16 @@ pushd emsdk
1210
source ./emsdk_env.sh
1311
popd
1412

15-
if [ ! -d spirv-tools ]
16-
then
17-
git clone https://github.com/KhronosGroup/SPIRV-Tools.git spirv-tools
18-
fi
13+
# Setup pinned SPIRV Tools version using shared script
14+
source ./build_scripts/setup-spirv-tools.sh
1915

2016
pushd spirv-tools
21-
git checkout vulkan-sdk-1.3.290.0
2217

2318
python3 utils/git-sync-deps
2419

2520
# add an additional option to emcc command
2621
sed -i 's/\r$//' source/wasm/build.sh
27-
sed -i 's/-s MODULARIZE \\/-s MODULARIZE -s SINGLE_FILE -s ENVIRONMENT="worker"\\/' source/wasm/build.sh
22+
sed -i 's/-s MODULARIZE \\/-s MODULARIZE -s SINGLE_FILE -s ENVIRONMENT=worker\\/' source/wasm/build.sh
2823

2924
bash -x source/wasm/build.sh
3025

@@ -37,7 +32,7 @@ cp ../spirv-tools.d.ts ../spirv-tools.worker.d.ts
3732

3833
# --- Build for Node.js ---
3934
# Patch build.sh for Node.js build
40-
sed -i 's/-s ENVIRONMENT="worker"/-s ENVIRONMENT="node"/' source/wasm/build.sh
35+
sed -i 's/-s ENVIRONMENT=worker/-s ENVIRONMENT=node/' source/wasm/build.sh
4136

4237
bash -x source/wasm/build.sh
4338

0 commit comments

Comments
 (0)