diff --git a/.github/workflows/deploy-github-page.yml b/.github/workflows/deploy-github-page.yml index a2658f5f..87a75990 100644 --- a/.github/workflows/deploy-github-page.yml +++ b/.github/workflows/deploy-github-page.yml @@ -51,19 +51,18 @@ 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 @@ -71,12 +70,14 @@ jobs: - 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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c6f12b60..bd5abc32 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -249,19 +249,17 @@ 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 @@ -269,12 +267,14 @@ jobs: - 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 }} diff --git a/README.md b/README.md index bb143784..6aa673c3 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/docs/source/InstallationAndUsage.rst b/docs/source/InstallationAndUsage.rst index e24cb9b4..89098356 100644 --- a/docs/source/InstallationAndUsage.rst +++ b/docs/source/InstallationAndUsage.rst @@ -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 @@ -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 @@ -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 ===========================