Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 9 additions & 8 deletions .github/workflows/deploy-github-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,33 @@ jobs:
$HOME/emsdk/emsdk activate ${{matrix.emsdk_ver}}
source $HOME/emsdk/emsdk_env.sh
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
micromamba activate xeus-cpp-wasm-host

mkdir build
pushd build

export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
echo "PREFIX=$PREFIX" >> $GITHUB_ENV

export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot

emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
-DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX \
-DSYSROOT_PATH=$SYSROOT_PATH \
..
emmake make -j ${{ env.ncpus }} install

- name: Jupyter Lite integration
shell: bash -l {0}
run: |
micromamba activate xeus-cpp-wasm-host
export XEUS_CPP_INSTALL_DIR=$CONDA_PREFIX
micromamba create -n xeus-lite-host jupyterlite-core
micromamba activate xeus-lite-host
python -m pip install jupyterlite-xeus jupyter_server notebook
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --output-dir dist
cp $PREFIX/bin/xcpp.data dist/extensions/@jupyterlite/xeus/static
cp $PREFIX/lib/libclangCppInterOp.so dist/extensions/@jupyterlite/xeus/static
jupyter lite build --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR --contents notebooks/xeus-cpp-lite-demo.ipynb --output-dir dist
cp $XEUS_CPP_INSTALL_DIR/bin/xcpp.data dist/extensions/@jupyterlite/xeus/static
cp $XEUS_CPP_INSTALL_DIR/lib/libclangCppInterOp.so dist/extensions/@jupyterlite/xeus/static

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,32 +249,32 @@ jobs:
$HOME/emsdk/emsdk activate ${{matrix.emsdk_ver}}
source $HOME/emsdk/emsdk_env.sh
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32

micromamba activate xeus-cpp-wasm-host
mkdir build
pushd build

export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
echo "PREFIX=$PREFIX" >> $GITHUB_ENV

export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot

emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
-DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX \
-DSYSROOT_PATH=$SYSROOT_PATH \
..
emmake make -j ${{ env.ncpus }} install

- name: Jupyter Lite integration
shell: bash -l {0}
run: |
micromamba activate xeus-cpp-wasm-host
export XEUS_CPP_INSTALL_DIR=$CONDA_PREFIX
micromamba create -n xeus-lite-host jupyterlite-core
micromamba activate xeus-lite-host
python -m pip install jupyterlite-xeus
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }}
cp $PREFIX/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
cp $PREFIX/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
jupyter lite build --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR
cp $XEUS_CPP_INSTALL_DIR/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
cp $XEUS_CPP_INSTALL_DIR/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static

- name: Setup tmate session
if: ${{ failure() && runner.debug }}
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,17 @@ source $HOME/emsdk/emsdk_env.sh
You are now in a position to build the xeus-cpp kernel. You build it by executing the following
```bash
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
micromamba activate xeus-cpp-wasm-host
export XEUS_CPP_INSTALL_DIR=$CONDA_PREFIX
mkdir build
pushd build
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot

emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
-DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX \
-DSYSROOT_PATH=$SYSROOT_PATH \
..
emmake make install
Expand All @@ -102,20 +103,20 @@ To build Jupyter Lite with this kernel without creating a website you can execut
micromamba create -n xeus-lite-host jupyterlite-core
micromamba activate xeus-lite-host
python -m pip install jupyterlite-xeus
jupyter lite build --XeusAddon.prefix=$PREFIX
jupyter lite build --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR
```

We now need to shift necessary files like `xcpp.data` which contains the binary representation of the file(s)
we want to include in our application. As of now this would contain all important files like Standard Headers,
Libraries etc coming out of emscripten's sysroot. Assuming we are still inside build we should do the following
```bash
cp $PREFIX/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
cp $PREFIX/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
cp $XEUS_CPP_INSTALL_DIR/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
cp $XEUS_CPP_INSTALL_DIR/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
```

Once the Jupyter Lite site has built you can test the website locally by executing
```bash
jupyter lite serve --XeusAddon.prefix=$PREFIX
jupyter lite serve --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR
```

## Trying it online
Expand Down
23 changes: 15 additions & 8 deletions docs/source/InstallationAndUsage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@ Installation within a mamba environment (wasm build instructions)
========================

These instructions will assume you have cmake installed on your system. First clone the repository, and move into that directory

.. code-block:: bash

git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
cd ./xeus-cpp


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

.. code-block:: bash

cd $HOME
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
Expand All @@ -65,16 +67,18 @@ You'll now want to make sure you're using emsdk version "3.1.45" and activate it
You are now in a position to build the xeus-cpp kernel. You build it by executing the following

.. code-block:: bash

micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
micromamba activate xeus-cpp-wasm-host
export XEUS_CPP_INSTALL_DIR=$CONDA_PREFIX
mkdir build
pushd build
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
-DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX \
-DSYSROOT_PATH=$SYSROOT_PATH \
..
emmake make install
Expand All @@ -83,23 +87,26 @@ You are now in a position to build the xeus-cpp kernel. You build it by executin
To build Jupyter Lite with this kernel without creating a website you can execute the following

.. code-block:: bash

micromamba create -n xeus-lite-host jupyterlite-core
micromamba activate xeus-lite-host
python -m pip install jupyterlite-xeus
jupyter lite build --XeusAddon.prefix=$PREFIX
jupyter lite build --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR

We now need to shift necessary files like `xcpp.data` which contains the binary representation of the file(s)
we want to include in our application. As of now this would contain all important files like Standard Headers,
Libraries etc coming out of emscripten's sysroot. Assuming we are still inside build we should do the following

.. code-block:: bash
cp $PREFIX/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
cp $PREFIX/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static

cp $XEUS_CPP_INSTALL_DIR/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
cp $XEUS_CPP_INSTALL_DIR/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static

Once the Jupyter Lite site has built you can test the website locally by executing

.. code-block:: bash
jupyter lite serve --XeusAddon.prefix=$PREFIX

jupyter lite serve --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR

Installing from conda-forge
===========================
Expand Down