Skip to content

Commit 70bec27

Browse files
committed
Use patched emsdk 3.1.73 out of emscripten-forge
1 parent b797dbb commit 70bec27

6 files changed

+75
-126
lines changed

.github/workflows/deploy-pages.yml

+18-24
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
include:
24-
- name: osx15-arm-clang-clang-repl-19-emscripten_wasm
25-
os: macos-15
26-
compiler: clang
24+
- name: ubu24-x86-gcc12-clang-repl-19-emscripten
25+
os: ubuntu-24.04
26+
compiler: gcc-12
2727
clang-runtime: '19'
2828
cling: Off
2929
micromamba_shell_init: bash
30-
emsdk_ver: "3.1.73"
3130

3231
steps:
3332
- uses: actions/checkout@v4
@@ -70,15 +69,9 @@ jobs:
7069
- name: install mamba
7170
uses: mamba-org/setup-micromamba@main
7271
with:
73-
init-shell: >-
74-
${{ matrix.micromamba_shell_init }}
75-
76-
- name: Setup emsdk
77-
shell: bash -l {0}
78-
run: |
79-
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
80-
cd emsdk
81-
./emsdk install ${{ matrix.emsdk_ver }}
72+
environment-file: environment-wasm-build.yml
73+
init-shell: bash
74+
environment-name: CppInterOp-wasm-build
8275

8376
- name: Restore Cache LLVM/Clang runtime build directory
8477
uses: actions/cache/restore@v4
@@ -93,11 +86,10 @@ jobs:
9386
if: ${{ runner.os != 'windows' }}
9487
shell: bash -l {0}
9588
run: |
96-
./emsdk/emsdk activate ${{matrix.emsdk_ver}}
97-
source ./emsdk/emsdk_env.sh
98-
micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
89+
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
9990
10091
export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm
92+
export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build
10193
export CMAKE_PREFIX_PATH=$PREFIX
10294
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
10395
@@ -154,20 +146,16 @@ jobs:
154146
echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV
155147
echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
156148
echo "PREFIX=$PREFIX" >> $GITHUB_ENV
149+
echo "BUILD_PREFIX=$BUILD_PREFIX" >> $GITHUB_ENV
157150
158151
- name: Build xeus-cpp
159152
shell: bash -l {0}
160153
run: |
161-
./emsdk/emsdk activate ${{matrix.emsdk_ver}}
162-
source ./emsdk/emsdk_env.sh
163-
export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot
164-
micromamba activate CppInterOp-wasm
154+
export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot
165155
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
166156
cd ./xeus-cpp
167157
mkdir build
168158
pushd build
169-
export CMAKE_PREFIX_PATH=${{ env.PREFIX }}
170-
export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }}
171159
emcmake cmake \
172160
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
173161
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \
@@ -186,7 +174,13 @@ jobs:
186174
micromamba create -n xeus-lite-host jupyterlite-core -c conda-forge
187175
micromamba activate xeus-lite-host
188176
python -m pip install jupyterlite-xeus jupyterlite-core jupyterlab notebook libarchive-c
189-
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist
177+
jupyter lite build \
178+
--XeusAddon.prefix=${{ env.PREFIX }} \
179+
--contents README.md \
180+
--contents notebooks/xeus-cpp-lite-demo.ipynb \
181+
--contents notebooks/images/marie.png \
182+
--contents notebooks/audio/audio.wav \
183+
--output-dir dist
190184
191185
- name: Upload artifact
192186
uses: actions/upload-pages-artifact@v3
@@ -201,7 +195,7 @@ jobs:
201195
environment:
202196
name: github-pages
203197
url: ${{ steps.deployment.outputs.page_url }}
204-
runs-on: ubuntu-22.04
198+
runs-on: ubuntu-24.04
205199
steps:
206200
- name: Deploy to GitHub Pages
207201
id: deployment

.github/workflows/emscripten.yml

+22-54
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,20 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
include:
24-
- name: ubu24-arm-gcc12-clang-repl-19-emscripten
25-
os: ubuntu-24.04-arm
26-
compiler: gcc-12
27-
clang-runtime: '19'
28-
cling: Off
29-
llvm_enable_projects: "clang;lld"
30-
llvm_targets_to_build: "WebAssembly"
31-
emsdk_ver: "3.1.73"
3224
- name: osx15-arm-clang-clang-repl-19-emscripten
3325
os: macos-15
3426
compiler: clang
3527
clang-runtime: '19'
3628
cling: Off
3729
llvm_enable_projects: "clang;lld"
38-
llvm_targets_to_build: "WebAssembly"
39-
emsdk_ver: "3.1.73"
30+
llvm_targets_to_build: "WebAssembly"
4031
- name: ubu24-x86-gcc12-clang-repl-19-emscripten
4132
os: ubuntu-24.04
4233
compiler: gcc-12
4334
clang-runtime: '19'
4435
cling: Off
4536
llvm_enable_projects: "clang;lld"
4637
llvm_targets_to_build: "WebAssembly"
47-
emsdk_ver: "3.1.73"
4838

4939
steps:
5040
- uses: actions/checkout@v4
@@ -115,13 +105,6 @@ jobs:
115105
key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-emscripten
116106
lookup-only: true
117107

118-
- name: Setup emsdk
119-
if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
120-
run: |
121-
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
122-
cd emsdk
123-
./emsdk install ${{ matrix.emsdk_ver }}
124-
125108
- name: Setup default Build Type on *nux
126109
if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
127110
run: |
@@ -262,11 +245,17 @@ jobs:
262245
sudo apt-get autoremove
263246
sudo apt-get clean
264247
248+
- name: install mamba
249+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
250+
uses: mamba-org/setup-micromamba@main
251+
with:
252+
environment-file: environment-wasm-build.yml
253+
init-shell: bash
254+
environment-name: CppInterOp-wasm-build
255+
265256
- name: Build LLVM/Cling on Unix systems if the cache is invalid (emscripten)
266257
if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }}
267258
run: |
268-
./emsdk/emsdk activate ${{matrix.emsdk_ver}}
269-
source ./emsdk/emsdk_env.sh
270259
cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]')
271260
if [[ "${cling_on}" == "ON" ]]; then
272261
git clone https://github.com/root-project/cling.git
@@ -465,21 +454,12 @@ jobs:
465454
clang-runtime: '19'
466455
cling: Off
467456
micromamba_shell_init: bash
468-
emsdk_ver: "3.1.73"
469457
- name: osx15-arm-clang-clang-repl-19-emscripten_wasm
470458
os: macos-15
471459
compiler: clang
472460
clang-runtime: '19'
473461
cling: Off
474462
micromamba_shell_init: bash
475-
emsdk_ver: "3.1.73"
476-
- name: ubu24-arm-gcc12-clang-repl-19-emscripten_wasm
477-
os: ubuntu-24.04-arm
478-
compiler: gcc-12
479-
clang-runtime: '19'
480-
cling: Off
481-
micromamba_shell_init: bash
482-
emsdk_ver: "3.1.73"
483463

484464
steps:
485465
- uses: actions/checkout@v4
@@ -524,19 +504,6 @@ jobs:
524504
echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
525505
fi
526506
527-
- name: install mamba
528-
uses: mamba-org/setup-micromamba@main
529-
with:
530-
init-shell: >-
531-
${{ matrix.micromamba_shell_init }}
532-
533-
- name: Setup emsdk
534-
shell: bash -l {0}
535-
run: |
536-
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
537-
cd emsdk
538-
./emsdk install ${{ matrix.emsdk_ver }}
539-
540507
- name: Restore Cache LLVM/Clang runtime build directory
541508
uses: actions/cache/restore@v4
542509
id: cache
@@ -545,16 +512,22 @@ jobs:
545512
llvm-project
546513
${{ matrix.cling=='On' && 'cling' || '' }}
547514
key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-emscripten
515+
516+
- name: install mamba
517+
uses: mamba-org/setup-micromamba@main
518+
with:
519+
environment-file: environment-wasm-build.yml
520+
init-shell: bash
521+
environment-name: CppInterOp-wasm-build
548522

549523
- name: Emscripten build of CppInterOp on Unix systems
550524
if: ${{ runner.os != 'windows' }}
551525
shell: bash -l {0}
552526
run: |
553-
./emsdk/emsdk activate ${{matrix.emsdk_ver}}
554-
source ./emsdk/emsdk_env.sh
555-
micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
527+
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
556528
557-
export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm
529+
export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-host
530+
export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build
558531
export CMAKE_PREFIX_PATH=$PREFIX
559532
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
560533
@@ -597,7 +570,6 @@ jobs:
597570
-DBUILD_SHARED_LIBS=ON \
598571
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
599572
-DCMAKE_INSTALL_PREFIX=$PREFIX \
600-
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
601573
-DLLVM_ENABLE_WERROR=On \
602574
../
603575
fi
@@ -612,26 +584,22 @@ jobs:
612584
echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV
613585
echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
614586
echo "PREFIX=$PREFIX" >> $GITHUB_ENV
587+
echo "BUILD_PREFIX=$BUILD_PREFIX" >> $GITHUB_ENV
615588
616589
- name: Build xeus-cpp
617590
shell: bash -l {0}
618591
run: |
619-
./emsdk/emsdk activate ${{matrix.emsdk_ver}}
620-
source ./emsdk/emsdk_env.sh
621-
export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot
622-
micromamba activate CppInterOp-wasm
592+
export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot
623593
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
624594
cd ./xeus-cpp
625595
mkdir build
626596
pushd build
627-
export CMAKE_PREFIX_PATH=${{ env.PREFIX }}
628-
export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }}
629597
emcmake cmake \
630598
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
631599
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \
632600
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \
633601
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
634-
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
602+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
635603
-DCppInterOp_DIR="${{ env.CPPINTEROP_BUILD_DIR }}/lib/cmake/CppInterOp" \
636604
-DSYSROOT_PATH=$SYSROOT_PATH \
637605
..

Emscripten-build-instructions.md

+12-21
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,15 @@ Now move into this directory using the following command
1818
cd ./CppInterOp-wasm
1919
```
2020

21-
To create a wasm build of CppInterOp we make use of the emsdk toolchain. This can be installed by executing (we only currently
22-
support version 3.1.73)
21+
You shall now want to make sure you are using the same emsdk (3.1.73) as the rest of our dependencies. This can be achieved by executing
22+
the following
2323
```bash
24-
git clone https://github.com/emscripten-core/emsdk.git
25-
./emsdk/emsdk install 3.1.73
24+
micromamba create -f environment-wasm-build.yml -y
25+
micromamba activate CppInterOp-wasm-build
2626
```
2727

28-
and activate the emsdk environment
29-
30-
```bash
31-
./emsdk/emsdk activate 3.1.73
32-
source ./emsdk/emsdk_env.sh
33-
```
34-
35-
Now clone the 19.x release of the LLVM project repository and CppInterOp (the building of the emscripten version of llvm can be
36-
avoided by executing micromamba install llvm -c <https://repo.mamba.pm/emscripten-forge> and setting the LLVM_BUILD_DIR appropriately)
37-
28+
Now clone the 19.x release of the LLVM project repository and CppInterOp. The building of the emscripten version of llvm can be
29+
avoided by executing micromamba install llvm -c <https://repo.prefix.dev/emscripten-forge-dev> and setting the LLVM_BUILD_DIR appropriately.
3830

3931
```bash
4032
git clone --depth=1 --branch release/19.x https://github.com/llvm/llvm-project.git
@@ -85,14 +77,14 @@ by executing (assumes you have micromamba installed and that your shell is initi
8577

8678
```bash
8779
cd ../../CppInterOp/
88-
micromamba create -f environment-wasm.yml --platform=emscripten-wasm32
89-
micromamba activate CppInterOp-wasm
80+
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
9081
```
9182

9283
You will also want to set a few environment variables
9384

9485
```bash
95-
export PREFIX=$CONDA_PREFIX
86+
export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build
87+
export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-host
9688
export CMAKE_PREFIX_PATH=$PREFIX
9789
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
9890
```
@@ -103,11 +95,11 @@ Now to build CppInterOp execute the following
10395
mkdir build
10496
cd ./build/
10597
emcmake cmake -DCMAKE_BUILD_TYPE=Release \
98+
-DCMAKE_PREFIX_PATH=$PREFIX \
10699
-DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
107100
-DLLD_DIR=$LLVM_BUILD_DIR/lib/cmake/lld \
108101
-DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
109102
-DBUILD_SHARED_LIBS=ON \
110-
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
111103
-DCMAKE_INSTALL_PREFIX=$PREFIX \
112104
../
113105
emmake make -j $(nproc --all) install
@@ -126,17 +118,16 @@ the CppInterOp build folder, you can build the wasm version of xeus-cpp by execu
126118

127119
```bash
128120
cd ../..
129-
export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot
121+
export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot
130122
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
131123
cd ./xeus-cpp
132124
mkdir build
133125
cd build
134126
emcmake cmake \
135127
-DCMAKE_BUILD_TYPE=Release \
136-
-DCMAKE_PREFIX_PATH=$PREFIX \
137128
-DCMAKE_INSTALL_PREFIX=$PREFIX \
138129
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
139-
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
130+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=$PREFIX \
140131
-DCppInterOp_DIR="$CPPINTEROP_BUILD_DIR/lib/cmake/CppInterOp" \
141132
-DSYSROOT_PATH=$SYSROOT_PATH \
142133
..

0 commit comments

Comments
 (0)