Skip to content

Commit c34f786

Browse files
authored
Merge branch 'main' into cppinterop-out
2 parents a0fdb40 + 5f25366 commit c34f786

File tree

7 files changed

+161
-19
lines changed

7 files changed

+161
-19
lines changed

.github/workflows/clang-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
fetch-depth: 0
2222

2323
- name: Setup Python
24-
uses: actions/setup-python@v5
24+
uses: actions/setup-python@v6
2525
with:
2626
python-version: "3.11"
2727

.github/workflows/clang-tidy-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/checkout@v5
1919

2020
- name: Setup Python
21-
uses: actions/setup-python@v5
21+
uses: actions/setup-python@v6
2222
with:
2323
python-version: "3.11"
2424

.github/workflows/deploy-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
fetch-depth: 0
3535

3636
- name: Set up Python
37-
uses: actions/setup-python@v5
37+
uses: actions/setup-python@v6
3838
with:
3939
python-version: '3.11'
4040

.github/workflows/emscripten.yml

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
fetch-depth: 0
8585

8686
- name: Set up Python
87-
uses: actions/setup-python@v5
87+
uses: actions/setup-python@v6
8888
with:
8989
python-version: '3.11'
9090

@@ -708,7 +708,7 @@ jobs:
708708
if [[ "${os}" != macos* ]] ; then
709709
EMCC_CORES=1 emmake make -j 1 check-cppinterop
710710
else
711-
EMCC_CORES=2 emmake make -j 2 check-cppinterop
711+
emmake make -j ${{ env.ncpus }} check-cppinterop
712712
fi
713713
cd ./unittests/CppInterOp/
714714
# Explaination of options for emrun
@@ -785,7 +785,13 @@ jobs:
785785
.\emsdk\emsdk_env.ps1
786786
$env:PWD_DIR= $PWD.Path
787787
$env:SYSROOT_PATH="$env:EMSDK/upstream/emscripten/cache/sysroot"
788-
$env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
788+
echo "SYSROOT_PATH=$env:SYSROOT_PATH"
789+
echo "SYSROOT_PATH=$env:SYSROOT_PATH" >> $env:GITHUB_ENV
790+
791+
$env:PREFIX="$env:MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm"
792+
echo "PREFIX=$env:PREFIX"
793+
echo "PREFIX=$env:PREFIX" >> $env:GITHUB_ENV
794+
789795
$env:CMAKE_PREFIX_PATH=$env:PREFIX
790796
$env:CMAKE_SYSTEM_PREFIX_PATH=$env:PREFIX
791797
@@ -888,6 +894,11 @@ jobs:
888894
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
889895
cd ..\..
890896
Error-OnFailure { emmake make -j ${{ env.ncpus }} install }
897+
echo "SYSROOT_PATH=$env:SYSROOT_PATH" >> $GITHUB_ENV
898+
echo "CPPINTEROP_DIR=$env:CPPINTEROP_DIR" >> $GITHUB_ENV
899+
echo "LLVM_BUILD_DIR=$env:LLVM_BUILD_DIR" >> $GITHUB_ENV
900+
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH" >> $GITHUB_ENV
901+
echo "PREFIX=$env:PREFIX" >> $GITHUB_ENV
891902
892903
- name: Build and Test/Install CppInterOp on Windows systems (static library)
893904
if: ${{ runner.os == 'windows' }}
@@ -990,7 +1001,7 @@ jobs:
9901001
echo "Running DynamicLibraryManagerTests in Chromium"
9911002
Error-OnFailure{ emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" DynamicLibraryManagerTests.html }
9921003
993-
- name: Build xeus-cpp
1004+
- name: Build xeus-cpp on Unix Systems
9941005
if: ${{ runner.os != 'windows' }}
9951006
shell: bash -l {0}
9961007
run: |
@@ -1014,7 +1025,31 @@ jobs:
10141025
..
10151026
emmake make -j ${{ env.ncpus }} install
10161027
1017-
- name: Test xeus-cpp C++ Emscripten
1028+
- name: Build xeus-cpp on Windows systems
1029+
if: ${{ runner.os == 'windows' }}
1030+
shell: powershell
1031+
run: |
1032+
.\emsdk\emsdk activate ${{matrix.emsdk_ver}}
1033+
.\emsdk\emsdk_env.ps1
1034+
micromamba activate CppInterOp-wasm
1035+
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
1036+
cd .\xeus-cpp
1037+
mkdir build
1038+
pushd build
1039+
$env:CMAKE_PREFIX_PATH="${{ env.PREFIX }}"
1040+
$env:CMAKE_SYSTEM_PREFIX_PATH="${{ env.PREFIX }}"
1041+
emcmake cmake `
1042+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
1043+
-DCMAKE_PREFIX_PATH=${{ env.PREFIX }} `
1044+
-DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} `
1045+
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON `
1046+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
1047+
-DXEUS_CPP_RESOURCE_DIR=${{ env.LLVM_BUILD_DIR }}\lib\clang\${{ matrix.clang-runtime }} `
1048+
-DSYSROOT_PATH=${{ env.SYSROOT_PATH }} `
1049+
..
1050+
emmake make -j ${{ env.ncpus }} install
1051+
1052+
- name: Test xeus-cpp C++ Emscripten on Unix Systems
10181053
if: ${{ runner.os != 'windows' }}
10191054
shell: bash -l {0}
10201055
run: |
@@ -1023,6 +1058,30 @@ jobs:
10231058
cd ./xeus-cpp/build/test
10241059
node test_xeus_cpp.js
10251060
1061+
- name: Test xeus-cpp C++ Emscripten on Windows Systems
1062+
if: ${{ runner.os == 'windows' }}
1063+
shell: powershell
1064+
run: |
1065+
function Error-OnFailure {
1066+
param (
1067+
[Parameter(Mandatory)]
1068+
[ScriptBlock]$Command
1069+
)
1070+
1071+
& $Command
1072+
1073+
if ($LASTEXITCODE -ne 0) {
1074+
exit $LASTEXITCODE
1075+
}
1076+
}
1077+
micromamba activate CppInterOp-wasm
1078+
cd .\xeus-cpp\build\test
1079+
node test_xeus_cpp.js
1080+
echo "Running test_xeus_cpp in Firefox"
1081+
Error-OnFailure { emrun.bat --browser="firefox.exe" --kill_exit --timeout 60 --browser-args="--headless" test_xeus_cpp.html }
1082+
echo "Running test_xeus_cpp in Chromium"
1083+
Error-OnFailure { emrun.bat --browser="chrome.exe" --kill_exit --timeout 60 --browser-args="--headless --no-sandbox" test_xeus_cpp.html }
1084+
10261085
- name: Jupyter Lite integration
10271086
if: ${{ runner.os != 'windows' }}
10281087
shell: bash -l {0}
@@ -1031,3 +1090,12 @@ jobs:
10311090
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
10321091
micromamba activate xeus-lite-host
10331092
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/smallpt.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist
1093+
1094+
- name: Jupyter Lite integration
1095+
if: ${{ runner.os == 'windows' }}
1096+
shell: powershell
1097+
run: |
1098+
cd .\xeus-cpp\
1099+
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
1100+
micromamba activate xeus-lite-host
1101+
jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/smallpt.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist

.github/workflows/main.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ jobs:
225225
fetch-depth: 0
226226

227227
- name: Set up Python
228-
uses: actions/setup-python@v5
228+
uses: actions/setup-python@v6
229229
with:
230230
python-version: '3.11'
231231

@@ -282,10 +282,13 @@ jobs:
282282
# Create lcov report
283283
# capture coverage info
284284
vers="${CC#*-}"
285-
lcov --directory build/ --capture --output-file coverage.info --gcov-tool /usr/bin/gcov-${vers}
286-
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' ${{ github.workspace }}'/llvm-project/*' ${{ github.workspace }}'/unittests/*' --output-file coverage.info
285+
lcov --directory build/ --capture --output-file coverage.info --gcov-tool /usr/bin/gcov-${vers} --ignore-errors mismatch
286+
lcov --remove coverage.info '/usr/*' ${{ github.workspace }}'/llvm-project/*' --ignore-errors unused --output-file coverage.info
287+
lcov --remove coverage.info '${{ github.workspace }}/unittests/*' --ignore-errors unused --output-file coverage.info
288+
lcov --remove coverage.info '${{ github.workspace }}/build/*' --ignore-errors unused --output-file coverage.info
287289
# output coverage data for debugging (optional)
288290
lcov --list coverage.info
291+
rm -rf ./build/
289292
290293
- name: Upload to codecov.io
291294
if: ${{ success() && (matrix.coverage == true) }}
@@ -310,4 +313,3 @@ jobs:
310313
uses: mxschmitt/action-tmate@v3
311314
# When debugging increase to a suitable value!
312315
timeout-minutes: 30
313-

Emscripten-build-instructions.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
178178
and
179179

180180
```powershell
181-
$env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
181+
$env:PREFIX="$env:MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm"
182182
$env:CMAKE_PREFIX_PATH=$env:PREFIX
183183
$env:CMAKE_SYSTEM_PREFIX_PATH=$env:PREFIX
184184
```
@@ -337,7 +337,7 @@ emmake make -j $(nproc --all) install
337337
## Xeus-cpp-lite Wasm Build Instructions
338338

339339
A project which makes use of the wasm build of CppInterOp is xeus-cpp. xeus-cpp is a C++ Jupyter kernel. Assuming you are in
340-
the CppInterOp build folder, you can build the wasm version of xeus-cpp by executing (replace LLVM_VERSION with the version
340+
the CppInterOp build folder, you can build the wasm version of xeus-cpp on Linux/MacOS by executing (replace LLVM_VERSION with the version
341341
of llvm you are building against)
342342

343343
```bash
@@ -359,7 +359,28 @@ emcmake cmake \
359359
emmake make -j $(nproc --all) install
360360
```
361361

362-
To build and test Jupyter Lite with this kernel locally you can execute the following
362+
and on Windows by executing
363+
364+
```powershell
365+
cd ..\..
366+
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
367+
$env:LLVM_VERSION=20
368+
cd .\xeus-cpp
369+
mkdir build
370+
cd build
371+
emcmake cmake `
372+
-DCMAKE_BUILD_TYPE=Release `
373+
-DCMAKE_PREFIX_PATH="$env:PREFIX" `
374+
-DCMAKE_INSTALL_PREFIX="$env:PREFIX" `
375+
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON `
376+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
377+
-DXEUS_CPP_RESOURCE_DIR="$env:LLVM_BUILD_DIR/lib/clang/$env:LLVM_VERSION" `
378+
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
379+
..
380+
emmake make -j $(nproc --all) install
381+
```
382+
383+
To build and test Jupyter Lite with this kernel locally on Linux/MacOS you can execute the following
363384

364385
```bash
365386
cd ../..
@@ -373,3 +394,18 @@ jupyter lite serve --XeusAddon.prefix=$PREFIX \
373394
--XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
374395
--XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d"
375396
```
397+
398+
and on Windows execute
399+
400+
```powershell
401+
cd ..\..
402+
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
403+
micromamba activate xeus-lite-host
404+
jupyter lite serve --XeusAddon.prefix="$env:PREFIX" `
405+
--contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb `
406+
--contents xeus-cpp/notebooks/smallpt.ipynb `
407+
--contents xeus-cpp/notebooks/images/marie.png `
408+
--contents xeus-cpp/notebooks/audio/audio.wav `
409+
--XeusAddon.mounts="$env:PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" `
410+
--XeusAddon.mounts="$env:PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d"
411+
```

docs/Emscripten-build-instructions.rst

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ and
203203

204204
.. code:: powershell
205205
206-
$env:PREFIX="%CONDA_PREFIX%/envs/CppInterOp-wasm"
206+
$env:PREFIX="$env:MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm"
207207
$env:CMAKE_PREFIX_PATH=$env:PREFIX
208208
$env:CMAKE_SYSTEM_PREFIX_PATH=$env:PREFIX
209209
@@ -358,8 +358,8 @@ Assuming it passes all test you can install by executing the following.
358358

359359
A project which makes use of the wasm build of CppInterOp is xeus-cpp.
360360
xeus-cpp is a C++ Jupyter kernel. Assuming you are in the CppInterOp
361-
build folder, you can build the wasm version of xeus-cpp by executing
362-
(replace LLVM_VERSION with the version of llvm you are building against)
361+
build folder, you can build the wasm version of xeus-cpp on Linux/MacOS
362+
by executing (replace LLVM_VERSION with the version of llvm you are building against)
363363

364364
.. code:: bash
365365
@@ -380,7 +380,28 @@ build folder, you can build the wasm version of xeus-cpp by executing
380380
..
381381
emmake make -j $(nproc --all) install
382382
383-
To build and test Jupyter Lite with this kernel locally you can execute the following
383+
and on Windows by executing
384+
385+
.. code:: powershell
386+
387+
cd ..\..
388+
git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git
389+
$env:LLVM_VERSION=20
390+
cd .\xeus-cpp
391+
mkdir build
392+
cd build
393+
emcmake cmake `
394+
-DCMAKE_BUILD_TYPE=Release `
395+
-DCMAKE_PREFIX_PATH="$env:PREFIX" `
396+
-DCMAKE_INSTALL_PREFIX="$env:PREFIX" `
397+
-DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON `
398+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON `
399+
-DXEUS_CPP_RESOURCE_DIR="$env:LLVM_BUILD_DIR/lib/clang/$env:LLVM_VERSION" `
400+
-DSYSROOT_PATH="$env:SYSROOT_PATH" `
401+
..
402+
emmake make -j $(nproc --all) install
403+
404+
To build and test Jupyter Lite with this kernel locally on Linux/MacOS you can execute the following
384405

385406
.. code:: bash
386407
@@ -394,3 +415,18 @@ To build and test Jupyter Lite with this kernel locally you can execute the foll
394415
--contents xeus-cpp/notebooks/audio/audio.wav \
395416
--XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
396417
--XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d"
418+
419+
and on Windows execute
420+
421+
.. code:: powershell
422+
423+
cd ..\..
424+
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyterlite-xeus jupyter_server jupyterlab notebook python-libarchive-c -c conda-forge
425+
micromamba activate xeus-lite-host
426+
jupyter lite serve --XeusAddon.prefix="$env:PREFIX" `
427+
--contents xeus-cpp/notebooks/xeus-cpp-lite-demo.ipynb `
428+
--contents xeus-cpp/notebooks/smallpt.ipynb `
429+
--contents xeus-cpp/notebooks/images/marie.png `
430+
--contents xeus-cpp/notebooks/audio/audio.wav `
431+
--XeusAddon.mounts="$env:PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" `
432+
--XeusAddon.mounts="$env:PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d"

0 commit comments

Comments
 (0)