Skip to content

Commit 72e53f7

Browse files
committed
Use CONDA_PREFIX in build
1 parent c805027 commit 72e53f7

File tree

4 files changed

+42
-33
lines changed

4 files changed

+42
-33
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,32 +51,33 @@ jobs:
5151
$HOME/emsdk/emsdk activate ${{matrix.emsdk_ver}}
5252
source $HOME/emsdk/emsdk_env.sh
5353
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
54+
micromamba activate xeus-cpp-wasm-host
5455
5556
mkdir build
5657
pushd build
57-
58-
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
59-
echo "PREFIX=$PREFIX" >> $GITHUB_ENV
58+
6059
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
6160
6261
emcmake cmake \
6362
-DCMAKE_BUILD_TYPE=Release \
64-
-DCMAKE_INSTALL_PREFIX=$PREFIX \
63+
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
6564
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
66-
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
65+
-DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX \
6766
-DSYSROOT_PATH=$SYSROOT_PATH \
6867
..
6968
emmake make -j ${{ env.ncpus }} install
7069
7170
- name: Jupyter Lite integration
7271
shell: bash -l {0}
7372
run: |
73+
micromamba activate xeus-cpp-wasm-host
74+
export XEUS_CPP_INSTALL_DIR=$CONDA_PREFIX
7475
micromamba create -n xeus-lite-host jupyterlite-core
7576
micromamba activate xeus-lite-host
7677
python -m pip install jupyterlite-xeus jupyter_server notebook
77-
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --output-dir dist
78-
cp $PREFIX/bin/xcpp.data dist/extensions/@jupyterlite/xeus/static
79-
cp $PREFIX/lib/libclangCppInterOp.so dist/extensions/@jupyterlite/xeus/static
78+
jupyter lite build --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR --contents notebooks/xeus-cpp-lite-demo.ipynb --output-dir dist
79+
cp $XEUS_CPP_INSTALL_DIR/bin/xcpp.data dist/extensions/@jupyterlite/xeus/static
80+
cp $XEUS_CPP_INSTALL_DIR/lib/libclangCppInterOp.so dist/extensions/@jupyterlite/xeus/static
8081
8182
- name: Upload artifact
8283
uses: actions/upload-pages-artifact@v3

.github/workflows/main.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,32 +249,32 @@ jobs:
249249
$HOME/emsdk/emsdk activate ${{matrix.emsdk_ver}}
250250
source $HOME/emsdk/emsdk_env.sh
251251
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
252-
252+
micromamba activate xeus-cpp-wasm-host
253253
mkdir build
254254
pushd build
255-
256-
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
257-
echo "PREFIX=$PREFIX" >> $GITHUB_ENV
255+
258256
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
259-
257+
260258
emcmake cmake \
261259
-DCMAKE_BUILD_TYPE=Release \
262-
-DCMAKE_INSTALL_PREFIX=$PREFIX \
260+
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
263261
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
264-
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
262+
-DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX \
265263
-DSYSROOT_PATH=$SYSROOT_PATH \
266264
..
267265
emmake make -j ${{ env.ncpus }} install
268266
269267
- name: Jupyter Lite integration
270268
shell: bash -l {0}
271269
run: |
270+
micromamba activate xeus-cpp-wasm-host
271+
export XEUS_CPP_INSTALL_DIR=$CONDA_PREFIX
272272
micromamba create -n xeus-lite-host jupyterlite-core
273273
micromamba activate xeus-lite-host
274274
python -m pip install jupyterlite-xeus
275-
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }}
276-
cp $PREFIX/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
277-
cp $PREFIX/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
275+
jupyter lite build --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR
276+
cp $XEUS_CPP_INSTALL_DIR/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
277+
cp $XEUS_CPP_INSTALL_DIR/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
278278
279279
- name: Setup tmate session
280280
if: ${{ failure() && runner.debug }}

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,17 @@ source $HOME/emsdk/emsdk_env.sh
8282
You are now in a position to build the xeus-cpp kernel. You build it by executing the following
8383
```bash
8484
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
85+
micromamba activate xeus-cpp-wasm-host
86+
export XEUS_CPP_INSTALL_DIR=$CONDA_PREFIX
8587
mkdir build
8688
pushd build
87-
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
8889
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
8990

9091
emcmake cmake \
9192
-DCMAKE_BUILD_TYPE=Release \
92-
-DCMAKE_INSTALL_PREFIX=$PREFIX \
93+
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
9394
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
94-
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
95+
-DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX \
9596
-DSYSROOT_PATH=$SYSROOT_PATH \
9697
..
9798
emmake make install
@@ -102,20 +103,20 @@ To build Jupyter Lite with this kernel without creating a website you can execut
102103
micromamba create -n xeus-lite-host jupyterlite-core
103104
micromamba activate xeus-lite-host
104105
python -m pip install jupyterlite-xeus
105-
jupyter lite build --XeusAddon.prefix=$PREFIX
106+
jupyter lite build --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR
106107
```
107108

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

116117
Once the Jupyter Lite site has built you can test the website locally by executing
117118
```bash
118-
jupyter lite serve --XeusAddon.prefix=$PREFIX
119+
jupyter lite serve --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR
119120
```
120121

121122
## Trying it online

docs/source/InstallationAndUsage.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ 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
53-
5455
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
5556

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

6769
.. code-block:: bash
70+
6871
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32
72+
micromamba activate xeus-cpp-wasm-host
73+
export XEUS_CPP_INSTALL_DIR=$CONDA_PREFIX
6974
mkdir build
7075
pushd build
71-
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-cpp-wasm-host
7276
export SYSROOT_PATH=$HOME/emsdk/upstream/emscripten/cache/sysroot
7377
emcmake cmake \
7478
-DCMAKE_BUILD_TYPE=Release \
75-
-DCMAKE_INSTALL_PREFIX=$PREFIX \
79+
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
7680
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \
77-
-DCMAKE_FIND_ROOT_PATH=$PREFIX \
81+
-DCMAKE_FIND_ROOT_PATH=$CONDA_PREFIX \
7882
-DSYSROOT_PATH=$SYSROOT_PATH \
7983
..
8084
emmake make install
@@ -83,23 +87,26 @@ 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
89-
jupyter lite build --XeusAddon.prefix=$PREFIX
94+
jupyter lite build --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR
9095
9196
We now need to shift necessary files like `xcpp.data` which contains the binary representation of the file(s)
9297
we want to include in our application. As of now this would contain all important files like Standard Headers,
9398
Libraries etc coming out of emscripten's sysroot. Assuming we are still inside build we should do the following
9499

95100
.. 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
101+
102+
cp $XEUS_CPP_INSTALL_DIR/bin/xcpp.data _output/extensions/@jupyterlite/xeus/static
103+
cp $XEUS_CPP_INSTALL_DIR/lib/libclangCppInterOp.so _output/extensions/@jupyterlite/xeus/static
98104
99105
Once the Jupyter Lite site has built you can test the website locally by executing
100106

101107
.. code-block:: bash
102-
jupyter lite serve --XeusAddon.prefix=$PREFIX
108+
109+
jupyter lite serve --XeusAddon.prefix=$XEUS_CPP_INSTALL_DIR
103110
104111
Installing from conda-forge
105112
===========================

0 commit comments

Comments
 (0)