This repository was archived by the owner on Feb 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (117 loc) · 4.24 KB
/
emscripten.yml
File metadata and controls
135 lines (117 loc) · 4.24 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Emscripten
on:
push:
branches: [ "main" ]
paths:
- 'src/**'
- 'include/**'
- 'application/**'
- 'CMakeLists.txt'
- 'conanfile.py'
- 'cmake/**'
- '.github/workflows/emscripten.yml'
pull_request:
branches: [ "main" ]
paths:
- 'src/**'
- 'include/**'
- 'application/**'
- 'CMakeLists.txt'
- 'conanfile.py'
- 'cmake/**'
- '.github/workflows/emscripten.yml'
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/.cpm_modules
BUILD_TYPE: Release
EMSDK_VERSION: '3.1.45'
EM_CACHE: ${{ github.workspace }}/.emscripten_cache
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Emscripten
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSDK_VERSION }}
actions-cache-folder: 'emsdk-cache'
- name: Verify Emscripten installation
run: |
source $EMSDK/emsdk_env.sh
export EM_CACHE=${{ env.EM_CACHE }}
emcc --version
em++ --version
- name: install conan to system
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
pip3 install conan
- name: create CPM cache
id: cache-cpm
uses: actions/cache@v4
with:
path: ${{env.CPM_SOURCE_CACHE}}
key: ${{ runner.os }}-emscripten-cpm-${{ hashFiles('cmake/CPM.cmake') }}
- name: create Conan cache
id: cache-conan
uses: actions/cache@v4
with:
path: /home/runner/.conan2
key: ${{ runner.os }}-emscripten-conan-${{ hashFiles('conanfile.py') }}
- if: ${{ steps.cache-conan.outputs.cache-hit != 'true' }}
name: Conan profile detect --force
run: conan profile detect --force
- name: Conan profile show
run: conan profile show
- name: install Conan dependencies for Emscripten
run: |
source $EMSDK/emsdk_env.sh
export EM_CACHE=${{ env.EM_CACHE }}
conan install . \
-s build_type=${{env.BUILD_TYPE}} \
-s compiler.cppstd=20 \
-of=${{github.workspace}}/build/application/emscripten/debug \
-pr default -b=missing \
-c tools.system.package_manager:mode=install \
-c tools.system.package_manager:sudo=true
- name: Cache Emscripten ports
uses: actions/cache@v4
with:
path: ${{ env.EM_CACHE }}
key: ${{ runner.os }}-emsdk-cache-${{ env.EMSDK_VERSION }}
- name: Pre-build Emscripten ports
run: |
source $EMSDK/emsdk_env.sh
export EM_CACHE=${{ env.EM_CACHE }}
export EMSDK_QUIET=1
# Create a dummy C file for port compilation
echo 'int main() { return 0; }' > /tmp/dummy.c
# Pre-compile SDL2, Freetype, Harfbuzz, SDL2_ttf ports
emcc /tmp/dummy.c -sUSE_SDL=2 -sUSE_SDL_TTF=2 -sUSE_FREETYPE=1 -sUSE_HARFBUZZ=1 -o /tmp/dummy.html || true
rm -f /tmp/dummy.*
- name: CMake configure for Emscripten
run: |
source $EMSDK/emsdk_env.sh
export EM_CACHE=${{ env.EM_CACHE }}
export EMSDK_QUIET=1
cmake -B ${{github.workspace}}/build/application/emscripten/debug \
-DCMAKE_TOOLCHAIN_FILE=$EMSDK/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DBUILD_LIBRARY=ON \
-DBUILD_APPLICATION=ON
- name: CMake build for Emscripten
run: |
source $EMSDK/emsdk_env.sh
export EM_CACHE=${{ env.EM_CACHE }}
export EMSDK_QUIET=1
export EMCC_DEBUG=0
cmake --build ${{github.workspace}}/build/application/emscripten/debug --config ${{env.BUILD_TYPE}} -j1
- name: Upload Emscripten artifacts
uses: actions/upload-artifact@v4
with:
name: emscripten-build
path: |
${{github.workspace}}/build/application/emscripten/debug/*.html
${{github.workspace}}/build/application/emscripten/debug/*.js
${{github.workspace}}/build/application/emscripten/debug/*.wasm
${{github.workspace}}/build/application/emscripten/debug/*.data