Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
58bfe95
Add Windows Emscripten build of xeus-cpp to ci
mcbarton Jun 26, 2025
208e494
Update emscripten.yml
mcbarton Aug 3, 2025
97a4a56
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Aug 3, 2025
02f9278
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Aug 9, 2025
876d7f0
Add Windows Emscripten xeus-cpp tests
mcbarton Aug 10, 2025
3d51787
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Sep 9, 2025
e88a75a
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Sep 16, 2025
af429a9
Add Windows Emscripten build of xeus-cpp to docs
mcbarton Sep 16, 2025
365138a
Fix Windowx Emscripten build of xeus-cpp docs
mcbarton Sep 16, 2025
c347e0d
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Sep 16, 2025
3ae1dc6
Update Emscripten-build-instructions.md to fix markdown linter
mcbarton Sep 16, 2025
19f7f13
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Sep 17, 2025
665b447
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Sep 24, 2025
6f38505
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Sep 25, 2025
c8b23cc
Increase timeout for Windows browser tests to 90 seconds for xeus cpp…
mcbarton Sep 25, 2025
9980ec5
Revert "Increase timeout for Windows browser tests to 90 seconds for …
mcbarton Oct 2, 2025
91408c6
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Oct 2, 2025
7332e4c
Merge branch 'main' into Add-Windows-Emscripten-build-of-xeus-cpp-to-ci
mcbarton Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 71 additions & 3 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,13 @@ jobs:
.\emsdk\emsdk_env.ps1
$env:PWD_DIR= $PWD.Path
$env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot"
$env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
echo "SYSROOT_PATH=$env:SYSROOT_PATH"
echo "SYSROOT_PATH=$env:SYSROOT_PATH" >> $env:GITHUB_ENV

$env:PREFIX="$env:MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm"
echo "PREFIX=$env:PREFIX"
echo "PREFIX=$env:PREFIX" >> $env:GITHUB_ENV

$env:CMAKE_PREFIX_PATH=$env:PREFIX
$env:CMAKE_SYSTEM_PREFIX_PATH=$env:PREFIX

Expand Down Expand Up @@ -888,6 +894,11 @@ jobs:
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
cd ..\..
Error-OnFailure { emmake make -j ${{ env.ncpus }} install }
echo "SYSROOT_PATH=$env:SYSROOT_PATH" >> $GITHUB_ENV
echo "CPPINTEROP_DIR=$env:CPPINTEROP_DIR" >> $GITHUB_ENV
echo "LLVM_BUILD_DIR=$env:LLVM_BUILD_DIR" >> $GITHUB_ENV
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
echo "PREFIX=$env:PREFIX" >> $GITHUB_ENV

- name: Build and Test/Install CppInterOp on Windows systems (static library)
if: ${{ runner.os == 'windows' }}
Expand Down Expand Up @@ -990,7 +1001,7 @@ jobs:
echo "Running DynamicLibraryManagerTests in Chromium"
Error-OnFailure{ emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }

- name: Build xeus-cpp
- name: Build xeus-cpp on Unix Systems
if: ${{ runner.os != 'windows' }}
shell: bash -l {0}
run: |
Expand All @@ -1014,7 +1025,31 @@ jobs:
..
emmake make -j ${{ env.ncpus }} install

- name: Test xeus-cpp C++ Emscripten
- name: Build xeus-cpp on Windows systems
if: ${{ runner.os == 'windows' }}
shell: powershell
run: |
.\emsdk\emsdk activate ${{matrix.emsdk_ver}}
.\emsdk\emsdk_env.ps1
micromamba activate CppInterOp-wasm
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
cd .\xeus-cpp
mkdir build
pushd build
$env:CMAKE_PREFIX_PATH="${{ env.PREFIX }}"
$env:CMAKE_SYSTEM_PREFIX_PATH="${{ env.PREFIX }}"
emcmake cmake `
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} `
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} `
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON `
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
-DXEUS_CPP_RESOURCE_DIR=${{ env.LLVM_BUILD_DIR }}\lib\clang\${{ matrix.clang-runtime }} `
-DSYSROOT_PATH=${{ env.SYSROOT_PATH }} `
..
emmake make -j ${{ env.ncpus }} install

- name: Test xeus-cpp C++ Emscripten on Unix Systems
if: ${{ runner.os != 'windows' }}
shell: bash -l {0}
run: |
Expand All @@ -1023,6 +1058,30 @@ jobs:
cd ./xeus-cpp/build/test
node test_xeus_cpp.js

- name: Test xeus-cpp C++ Emscripten on Windows Systems
if: ${{ runner.os == 'windows' }}
shell: powershell
run: |
function Error-OnFailure {
param (
[Parameter(Mandatory)]
[ScriptBlock]$Command
)

& $Command

if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
micromamba activate CppInterOp-wasm
cd .\xeus-cpp\build\test
node test_xeus_cpp.js
echo "Running test_xeus_cpp in Firefox"
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" test_xeus_cpp.html }
echo "Running test_xeus_cpp in Chromium"
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.html }

- name: Jupyter Lite integration
if: ${{ runner.os != 'windows' }}
shell: bash -l {0}
Expand All @@ -1031,3 +1090,12 @@ jobs:
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
micromamba activate xeus-lite-host
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/smallpt.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist

- name: Jupyter Lite integration
if: ${{ runner.os == 'windows' }}
shell: powershell
run: |
cd .\xeus-cpp\
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
micromamba activate xeus-lite-host
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/smallpt.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist
42 changes: 39 additions & 3 deletions Emscripten-build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
and

```powershell
$env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
$env:PREFIX="$env:MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm"
$env:CMAKE_PREFIX_PATH=$env:PREFIX
$env:CMAKE_SYSTEM_PREFIX_PATH=$env:PREFIX
```
Expand Down Expand Up @@ -337,7 +337,7 @@ emmake make -j $(nproc --all) install
## Xeus-cpp-lite Wasm Build Instructions

A project which makes use of the wasm build of CppInterOp is xeus-cpp. xeus-cpp is a C++ Jupyter kernel. Assuming you are in
the CppInterOp build folder, you can build the wasm version of xeus-cpp by executing (replace LLVM_VERSION with the version
the CppInterOp build folder, you can build the wasm version of xeus-cpp on Linux/MacOS by executing (replace LLVM_VERSION with the version
of llvm you are building against)

```bash
Expand All @@ -359,7 +359,28 @@ emcmake cmake \
emmake make -j $(nproc --all) install
```

To build and test Jupyter Lite with this kernel locally you can execute the following
and on Windows by executing

```powershell
cd ..\..
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
$env:LLVM_VERSION=20
cd .\xeus-cpp
mkdir build
cd build
emcmake cmake `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_PREFIX_PATH="$env:PREFIX" `
-DCMAKE_INSTALL_PREFIX="$env:PREFIX" `
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON `
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
-DXEUS_CPP_RESOURCE_DIR="$env:LLVM_BUILD_DIR/lib/clang/$env:LLVM_VERSION" `
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
..
emmake make -j $(nproc --all) install
```

To build and test Jupyter Lite with this kernel locally on Linux/MacOS you can execute the following

```bash
cd ../..
Expand All @@ -373,3 +394,18 @@ jupyter lite serve --XeusAddon.prefix=$PREFIX \
--XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
--XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d"
```

and on Windows execute

```powershell
cd ..\..
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
micromamba activate xeus-lite-host
jupyter lite serve --XeusAddon.prefix="$env:PREFIX" `
--contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb `
--contents xeus-cpp/notebooks/smallpt.ipynb `
--contents xeus-cpp/notebooks/images/marie.png `
--contents xeus-cpp/notebooks/audio/audio.wav `
--XeusAddon.mounts="$env:PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" `
--XeusAddon.mounts="$env:PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d"
```
44 changes: 40 additions & 4 deletions docs/Emscripten-build-instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ and

.. code:: powershell

$env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
$env:PREFIX="$env:MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm"
$env:CMAKE_PREFIX_PATH=$env:PREFIX
$env:CMAKE_SYSTEM_PREFIX_PATH=$env:PREFIX

Expand Down Expand Up @@ -358,8 +358,8 @@ Assuming it passes all test you can install by executing the following.

A project which makes use of the wasm build of CppInterOp is xeus-cpp.
xeus-cpp is a C++ Jupyter kernel. Assuming you are in the CppInterOp
build folder, you can build the wasm version of xeus-cpp by executing
(replace LLVM_VERSION with the version of llvm you are building against)
build folder, you can build the wasm version of xeus-cpp on Linux/MacOS
by executing (replace LLVM_VERSION with the version of llvm you are building against)

.. code:: bash

Expand All @@ -380,7 +380,28 @@ build folder, you can build the wasm version of xeus-cpp by executing
..
emmake make -j $(nproc --all) install

To build and test Jupyter Lite with this kernel locally you can execute the following
and on Windows by executing

.. code:: powershell

cd ..\..
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
$env:LLVM_VERSION=20
cd .\xeus-cpp
mkdir build
cd build
emcmake cmake `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_PREFIX_PATH="$env:PREFIX" `
-DCMAKE_INSTALL_PREFIX="$env:PREFIX" `
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON `
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
-DXEUS_CPP_RESOURCE_DIR="$env:LLVM_BUILD_DIR/lib/clang/$env:LLVM_VERSION" `
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
..
emmake make -j $(nproc --all) install

To build and test Jupyter Lite with this kernel locally on Linux/MacOS you can execute the following

.. code:: bash

Expand All @@ -394,3 +415,18 @@ To build and test Jupyter Lite with this kernel locally you can execute the foll
--contents xeus-cpp/notebooks/audio/audio.wav \
--XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
--XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d"

and on Windows execute

.. code:: powershell

cd ..\..
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
micromamba activate xeus-lite-host
jupyter lite serve --XeusAddon.prefix="$env:PREFIX" `
--contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb `
--contents xeus-cpp/notebooks/smallpt.ipynb `
--contents xeus-cpp/notebooks/images/marie.png `
--contents xeus-cpp/notebooks/audio/audio.wav `
--XeusAddon.mounts="$env:PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" `
--XeusAddon.mounts="$env:PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d"
Loading