-
Notifications
You must be signed in to change notification settings - Fork 2.1k
74 lines (65 loc) · 2.03 KB
/
build-wasm-libs.yml
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
name: Build wasm/asmjs libraryies
on:
workflow_dispatch:
inputs:
environment:
description: "Select a library"
required: true
default: "Spine"
type: choice
options:
- Spine
jobs:
build_spine_wasm_asmjs:
name: "Build spine wasm/asmjs libs"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup emsdk
uses: dumganhar/setup-emsdk@997d2cde2deabda085a11f98e86e842915b0e846
with:
version: 3.1.41
actions-cache-folder: 'emsdk-cache'
- name: Verify
run: |
which emcc
emcc -v
- name: Install ninja
run: |
if ! command -v ninja &> /dev/null; then
echo "Ninja not found, installing..."
# sudo apt update
sudo apt install ninja-build
else
echo "Ninja is already installed."
fi
which ninja
- name: Build Spine WASM
run: |
cd ./native/cocos/editor-support/spine-wasm
mkdir build-wasm
cd build-wasm
emcmake cmake .. -GNinja
ninja
ls -l
- name: Build Spine ASMJS
run: |
cd ./native/cocos/editor-support/spine-wasm
sed -i 's/set(BUILD_WASM 1)/set(BUILD_WASM 0)/g' CMakeLists.txt
mkdir build-asmjs
cd build-asmjs
emcmake cmake .. -GNinja
ninja
ls -l
- name: Copy files to dist directory
run: |
mkdir dist
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.wasm ./dist/
cp ./native/cocos/editor-support/spine-wasm/build-wasm/spine.js ./dist/spine.wasm.js
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js.mem ./dist/
cp ./native/cocos/editor-support/spine-wasm/build-asmjs/spine.js ./dist/spine.asm.js
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: spine-emscripten
path: dist