Skip to content

Commit 232e345

Browse files
authored
Add wasm development environment to contributions guide (#223)
1 parent cdb1b0a commit 232e345

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

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+
```

0 commit comments

Comments
 (0)