Skip to content

Commit 6b20f06

Browse files
authored
Merge branch 'main' into Update-to-emsdk-3.1.73
2 parents 079e193 + ef9d57d commit 6b20f06

File tree

9 files changed

+559
-412
lines changed

9 files changed

+559
-412
lines changed

.github/workflows/deploy-github-page.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ name: Build and Deploy
22

33
on:
44
workflow_dispatch:
5+
pull_request:
56
push:
67
branches:
78
- main
8-
9+
910
permissions:
1011
contents: read
1112
pages: write
1213
id-token: write
13-
14+
1415
jobs:
1516
build:
1617
runs-on: ${{ matrix.os }}
@@ -20,44 +21,36 @@ jobs:
2021
matrix:
2122
include:
2223
- name: Github-page
23-
os: macos-15
24-
emsdk_ver: "3.1.73"
24+
os: ubuntu-24.04
2525
steps:
2626
- uses: actions/checkout@v4
2727
with:
2828
fetch-depth: 0
29-
29+
3030
- name: install mamba
3131
uses: mamba-org/setup-micromamba@main
3232
with:
33+
environment-file: environment-wasm-build.yml
3334
init-shell: bash
35+
environment-name: xeus-cpp-wasm-build
3436

3537
- name: Setup default Build Type on *nux
3638
if: ${{ runner.os != 'windows' }}
3739
run: |
3840
echo "ncpus=$(nproc --all)" >> $GITHUB_ENV
39-
40-
- name: Setup emsdk
41-
shell: bash -l {0}
42-
run: |
43-
cd $HOME
44-
git clone --depth=1 https://github.com/emscripten-core/emsdk.git
45-
cd emsdk
46-
./emsdk install ${{ matrix.emsdk_ver }}
4741
4842
- name: Build xeus-cpp
4943
shell: bash -l {0}
5044
run: |
51-
$HOME/emsdk/emsdk activate ${{matrix.emsdk_ver}}
52-
source $HOME/emsdk/emsdk_env.sh
5345
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
54-
46+
5547
mkdir build
5648
pushd build
5749
50+
export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-build
5851
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
5952
echo "PREFIX=$PREFIX" >> $GITHUB_ENV
60-
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
53+
export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot
6154
6255
emcmake cmake \
6356
-DCMAKE_BUILD_TYPE=Release \
@@ -66,9 +59,9 @@ jobs:
6659
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
6760
-DSYSROOT_PATH=$SYSROOT_PATH \
6861
..
69-
emmake make -j ${{ env.ncpus }} install
62+
emmake make -j ${{ env.ncpus }} install
7063
71-
- name: Jupyter Lite integration
64+
- name: Jupyter Lite integration
7265
shell: bash -l {0}
7366
run: |
7467
micromamba create -n xeus-lite-host jupyterlite-core jupyter_server
@@ -78,6 +71,8 @@ jobs:
7871
--XeusAddon.prefix=${{ env.PREFIX }} \
7972
--contents README.md \
8073
--contents notebooks/xeus-cpp-lite-demo.ipynb \
74+
--contents notebooks/images/marie.png \
75+
--contents notebooks/audio/audio.wav \
8176
--output-dir dist
8277
8378
- name: Upload artifact
@@ -87,12 +82,15 @@ jobs:
8782

8883
deploy:
8984
needs: build
85+
if: github.ref == 'refs/heads/main'
9086
permissions:
9187
pages: write
9288
id-token: write
89+
9390
environment:
9491
name: github-pages
9592
url: ${{ steps.deployment.outputs.page_url }}
93+
9694
runs-on: ubuntu-24.04
9795
steps:
9896
- name: Deploy to GitHub Pages

.github/workflows/main.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,25 +191,10 @@ jobs:
191191
matrix:
192192
include:
193193
- name: ubu24
194-
os: ubuntu-24.04
195-
emsdk_ver: "3.1.73"
196-
micromamba_shell_init: bash
197-
- name: ubu22
198-
os: ubuntu-22.04
199-
emsdk_ver: "3.1.73"
200-
micromamba_shell_init: bash
201-
- name: osx13-x86
202-
os: macos-13
203-
emsdk_ver: "3.1.73"
204-
micromamba_shell_init: bash
205-
- name: osx14-arm
206-
os: macos-14
207-
emsdk_ver: "3.1.73"
194+
os: ubuntu-24.04-arm
208195
micromamba_shell_init: bash
209196
- name: osx15-arm
210197
os: macos-15
211-
emsdk_ver: "3.1.73"
212-
micromamba_shell_init: bash
213198

214199
steps:
215200
- uses: actions/checkout@v4

CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,16 @@ set(XCPP_HEADERS
389389
add_library(xeus-cpp-headers INTERFACE)
390390
set_target_properties(xeus-cpp-headers PROPERTIES PUBLIC_HEADER "${XCPP_HEADERS}")
391391

392-
install(TARGETS xeus-cpp-headers PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/xcpp)
392+
if (EMSCRIPTEN)
393+
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SYSROOT_PATH}/include/xcpp)
394+
395+
message(STATUS "Moving headers to ${SYSROOT_PATH}/include/xcpp")
396+
foreach(header ${XCPP_HEADERS})
397+
file(COPY ${header} DESTINATION ${SYSROOT_PATH}/include/xcpp)
398+
endforeach()
399+
else ()
400+
install(TARGETS xeus-cpp-headers PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/xcpp)
401+
endif()
393402

394403
# xeus-cpp
395404
# ========

CONTRIBUTING.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,54 @@ and the python tests by executing
5757
cd ../../test
5858
pytest -sv test_xcpp_kernel.py
5959
```
60+
61+
## Setting up a development environment (wasm instructions)
62+
63+
First, you need to fork the project. After you have done this clone your forked repo. You can do this by
64+
executing the folowing
65+
66+
```bash
67+
git clone https://github.com/<your-github-username>/xeus-cpp.git
68+
cd ./xeus-cpp
69+
```
70+
71+
You'll now want to make sure you're using emsdk version "3.1.45" and activate it. You can get this by executing the following
72+
```bash
73+
cd $HOME
74+
git clone https://github.com/emscripten-core/emsdk.git
75+
cd emsdk
76+
./emsdk install 3.1.45
77+
./emsdk activate 3.1.45
78+
source $HOME/emsdk/emsdk_env.sh
79+
```
80+
81+
You are now in a position to build the xeus-cpp kernel. You build it by executing the following
82+
```bash
83+
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
84+
mkdir build
85+
pushd build
86+
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
87+
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
88+
89+
emcmake cmake \
90+
-DCMAKE_BUILD_TYPE=Release \
91+
-DCMAKE_INSTALL_PREFIX=$PREFIX \
92+
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
93+
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
94+
-DSYSROOT_PATH=$SYSROOT_PATH \
95+
..
96+
emmake make install
97+
```
98+
99+
To build Jupyter Lite with this kernel without creating a website you can execute the following
100+
```bash
101+
micromamba create -n xeus-lite-host jupyterlite-core
102+
micromamba activate xeus-lite-host
103+
python -m pip install jupyterlite-xeus
104+
jupyter lite build --XeusAddon.prefix=$PREFIX
105+
```
106+
107+
Once the Jupyter Lite site has built you can test the website locally by executing
108+
```bash
109+
jupyter lite serve --XeusAddon.prefix=$PREFIX
110+
```

docs/source/InstallationAndUsage.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,17 @@ Installation within a mamba environment (wasm build instructions)
4646
========================
4747

4848
These instructions will assume you have cmake installed on your system. First clone the repository, and move into that directory
49+
4950
.. code-block:: bash
51+
5052
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
5153
cd ./xeus-cpp
5254
5355
5456
You'll now want to make sure you're using emsdk version "3.1.73" and activate it. You can get this by executing the following
5557

5658
.. code-block:: bash
59+
5760
cd $HOME
5861
git clone https://github.com/emscripten-core/emsdk.git
5962
cd emsdk
@@ -65,6 +68,7 @@ You'll now want to make sure you're using emsdk version "3.1.73" and activate it
6568
You are now in a position to build the xeus-cpp kernel. You build it by executing the following
6669

6770
.. code-block:: bash
71+
6872
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
6973
mkdir build
7074
pushd build
@@ -83,22 +87,16 @@ You are now in a position to build the xeus-cpp kernel. You build it by executin
8387
To build Jupyter Lite with this kernel without creating a website you can execute the following
8488

8589
.. code-block:: bash
90+
8691
micromamba create -n xeus-lite-host jupyterlite-core
8792
micromamba activate xeus-lite-host
8893
python -m pip install jupyterlite-xeus
8994
jupyter lite build --XeusAddon.prefix=$PREFIX
9095
91-
We now need to shift necessary files like `xcpp.data` which contains the binary representation of the file(s)
92-
we want to include in our application. As of now this would contain all important files like Standard Headers,
93-
Libraries etc coming out of emscripten's sysroot. Assuming we are still inside build we should do the following
94-
95-
.. code-block:: bash
96-
cp $PREFIX/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
97-
cp $PREFIX/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
98-
9996
Once the Jupyter Lite site has built you can test the website locally by executing
10097

10198
.. code-block:: bash
99+
102100
jupyter lite serve --XeusAddon.prefix=$PREFIX
103101
104102
Installing from conda-forge

environment-wasm-build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: xeus-cpp-wasm-build
2+
channels:
3+
- https://repo.mamba.pm/emscripten-forge
4+
- conda-forge
5+
dependencies:
6+
- cmake
7+
- emscripten_emscripten-wasm32==3.1.45

environment-wasm-host.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ channels:
33
- https://repo.mamba.pm/emscripten-forge
44
- https://repo.mamba.pm/conda-forge
55
dependencies:
6+
- emscripten-abi==3.1.45
67
- nlohmann_json
78
- xeus-lite
89
- xeus

0 commit comments

Comments
 (0)