diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index da9c2dc25..f9096443b 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -21,13 +21,12 @@ jobs: fail-fast: false matrix: include: - - name: osx15-arm-clang-clang-repl-19-emscripten_wasm - os: macos-15 - compiler: clang + - name: ubu24-x86-gcc12-clang-repl-19-emscripten + os: ubuntu-24.04 + compiler: gcc-12 clang-runtime: '19' cling: Off micromamba_shell_init: bash - emsdk_ver: "3.1.73" steps: - uses: actions/checkout@v4 @@ -70,15 +69,9 @@ jobs: - name: install mamba uses: mamba-org/setup-micromamba@main with: - init-shell: >- - ${{ matrix.micromamba_shell_init }} - - - name: Setup emsdk - shell: bash -l {0} - run: | - git clone --depth=1 https://github.com/emscripten-core/emsdk.git - cd emsdk - ./emsdk install ${{ matrix.emsdk_ver }} + environment-file: environment-wasm-build.yml + init-shell: bash + environment-name: CppInterOp-wasm-build - name: Restore Cache LLVM/Clang runtime build directory uses: actions/cache/restore@v4 @@ -93,11 +86,10 @@ jobs: if: ${{ runner.os != 'windows' }} shell: bash -l {0} run: | - ./emsdk/emsdk activate ${{matrix.emsdk_ver}} - source ./emsdk/emsdk_env.sh - micromamba create -f environment-wasm.yml --platform=emscripten-wasm32 + micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32 export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm + export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build export CMAKE_PREFIX_PATH=$PREFIX export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX @@ -154,20 +146,16 @@ jobs: echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV echo "PREFIX=$PREFIX" >> $GITHUB_ENV + echo "BUILD_PREFIX=$BUILD_PREFIX" >> $GITHUB_ENV - name: Build xeus-cpp shell: bash -l {0} run: | - ./emsdk/emsdk activate ${{matrix.emsdk_ver}} - source ./emsdk/emsdk_env.sh - export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot - micromamba activate CppInterOp-wasm + export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git cd ./xeus-cpp mkdir build pushd build - export CMAKE_PREFIX_PATH=${{ env.PREFIX }} - export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }} emcmake cmake \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ -DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \ @@ -186,7 +174,13 @@ jobs: micromamba create -n xeus-lite-host jupyterlite-core -c conda-forge micromamba activate xeus-lite-host python -m pip install jupyterlite-xeus jupyterlite-core jupyterlab notebook libarchive-c - jupyter lite build --XeusAddon.prefix=${{ env.PREFIX }} --contents notebooks/xeus-cpp-lite-demo.ipynb --contents notebooks/images/marie.png --contents notebooks/audio/audio.wav --output-dir dist + jupyter lite build \ + --XeusAddon.prefix=${{ env.PREFIX }} \ + --contents README.md \ + --contents notebooks/xeus-cpp-lite-demo.ipynb \ + --contents notebooks/images/marie.png \ + --contents notebooks/audio/audio.wav \ + --output-dir dist - name: Upload artifact uses: actions/upload-pages-artifact@v3 @@ -201,7 +195,7 @@ jobs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Deploy to GitHub Pages id: deployment diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 10563d300..136923f78 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -21,22 +21,13 @@ jobs: fail-fast: false matrix: include: - - name: ubu24-arm-gcc12-clang-repl-19-emscripten - os: ubuntu-24.04-arm - compiler: gcc-12 - clang-runtime: '19' - cling: Off - llvm_enable_projects: "clang;lld" - llvm_targets_to_build: "WebAssembly" - emsdk_ver: "3.1.73" - name: osx15-arm-clang-clang-repl-19-emscripten os: macos-15 compiler: clang clang-runtime: '19' cling: Off llvm_enable_projects: "clang;lld" - llvm_targets_to_build: "WebAssembly" - emsdk_ver: "3.1.73" + llvm_targets_to_build: "WebAssembly" - name: ubu24-x86-gcc12-clang-repl-19-emscripten os: ubuntu-24.04 compiler: gcc-12 @@ -44,7 +35,6 @@ jobs: cling: Off llvm_enable_projects: "clang;lld" llvm_targets_to_build: "WebAssembly" - emsdk_ver: "3.1.73" steps: - uses: actions/checkout@v4 @@ -115,13 +105,6 @@ jobs: key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-emscripten lookup-only: true - - name: Setup emsdk - if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }} - run: | - git clone --depth=1 https://github.com/emscripten-core/emsdk.git - cd emsdk - ./emsdk install ${{ matrix.emsdk_ver }} - - name: Setup default Build Type on *nux if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }} run: | @@ -262,11 +245,17 @@ jobs: sudo apt-get autoremove sudo apt-get clean + - name: install mamba + if: ${{ steps.cache.outputs.cache-hit != 'true' }} + uses: mamba-org/setup-micromamba@main + with: + environment-file: environment-wasm-build.yml + init-shell: bash + environment-name: CppInterOp-wasm-build + - name: Build LLVM/Cling on Unix systems if the cache is invalid (emscripten) if: ${{ runner.os != 'windows' && steps.cache.outputs.cache-hit != 'true' }} run: | - ./emsdk/emsdk activate ${{matrix.emsdk_ver}} - source ./emsdk/emsdk_env.sh cling_on=$(echo "${{ matrix.cling }}" | tr '[:lower:]' '[:upper:]') if [[ "${cling_on}" == "ON" ]]; then git clone https://github.com/root-project/cling.git @@ -465,21 +454,12 @@ jobs: clang-runtime: '19' cling: Off micromamba_shell_init: bash - emsdk_ver: "3.1.73" - name: osx15-arm-clang-clang-repl-19-emscripten_wasm os: macos-15 compiler: clang clang-runtime: '19' cling: Off micromamba_shell_init: bash - emsdk_ver: "3.1.73" - - name: ubu24-arm-gcc12-clang-repl-19-emscripten_wasm - os: ubuntu-24.04-arm - compiler: gcc-12 - clang-runtime: '19' - cling: Off - micromamba_shell_init: bash - emsdk_ver: "3.1.73" steps: - uses: actions/checkout@v4 @@ -524,19 +504,6 @@ jobs: echo "ncpus=$(nproc --all)" >> $GITHUB_ENV fi - - name: install mamba - uses: mamba-org/setup-micromamba@main - with: - init-shell: >- - ${{ matrix.micromamba_shell_init }} - - - name: Setup emsdk - shell: bash -l {0} - run: | - git clone --depth=1 https://github.com/emscripten-core/emsdk.git - cd emsdk - ./emsdk install ${{ matrix.emsdk_ver }} - - name: Restore Cache LLVM/Clang runtime build directory uses: actions/cache/restore@v4 id: cache @@ -545,16 +512,22 @@ jobs: llvm-project ${{ matrix.cling=='On' && 'cling' || '' }} key: ${{ env.CLING_HASH }}-${{ runner.os }}-${{ matrix.os }}-${{ matrix.compiler }}-clang-${{ matrix.clang-runtime }}.x-emscripten + + - name: install mamba + uses: mamba-org/setup-micromamba@main + with: + environment-file: environment-wasm-build.yml + init-shell: bash + environment-name: CppInterOp-wasm-build - name: Emscripten build of CppInterOp on Unix systems if: ${{ runner.os != 'windows' }} shell: bash -l {0} run: | - ./emsdk/emsdk activate ${{matrix.emsdk_ver}} - source ./emsdk/emsdk_env.sh - micromamba create -f environment-wasm.yml --platform=emscripten-wasm32 + micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32 - export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm + export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-host + export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build export CMAKE_PREFIX_PATH=$PREFIX export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX @@ -597,7 +570,6 @@ jobs: -DBUILD_SHARED_LIBS=ON \ -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ - -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ -DLLVM_ENABLE_WERROR=On \ ../ fi @@ -612,26 +584,22 @@ jobs: echo "LLVM_BUILD_DIR=$LLVM_BUILD_DIR" >> $GITHUB_ENV echo "CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH" >> $GITHUB_ENV echo "PREFIX=$PREFIX" >> $GITHUB_ENV + echo "BUILD_PREFIX=$BUILD_PREFIX" >> $GITHUB_ENV - name: Build xeus-cpp shell: bash -l {0} run: | - ./emsdk/emsdk activate ${{matrix.emsdk_ver}} - source ./emsdk/emsdk_env.sh - export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot - micromamba activate CppInterOp-wasm + export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git cd ./xeus-cpp mkdir build pushd build - export CMAKE_PREFIX_PATH=${{ env.PREFIX }} - export CMAKE_SYSTEM_PREFIX_PATH=${{ env.PREFIX }} emcmake cmake \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ -DCMAKE_PREFIX_PATH=${{ env.PREFIX }} \ -DCMAKE_INSTALL_PREFIX=${{ env.PREFIX }} \ -DXEUS_CPP_EMSCRIPTEN_WASM_BUILD=ON \ - -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ + -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ -DCppInterOp_DIR="${{ env.CPPINTEROP_BUILD_DIR }}/lib/cmake/CppInterOp" \ -DSYSROOT_PATH=$SYSROOT_PATH \ .. diff --git a/Emscripten-build-instructions.md b/Emscripten-build-instructions.md index 662643db3..1c2746c9e 100644 --- a/Emscripten-build-instructions.md +++ b/Emscripten-build-instructions.md @@ -18,23 +18,15 @@ Now move into this directory using the following command cd ./CppInterOp-wasm ``` -To create a wasm build of CppInterOp we make use of the emsdk toolchain. This can be installed by executing (we only currently -support version 3.1.73) +You shall now want to make sure you are using the same emsdk (3.1.73) as the rest of our dependencies. This can be achieved by executing +the following ```bash -git clone https://github.com/emscripten-core/emsdk.git -./emsdk/emsdk install 3.1.73 +micromamba create -f environment-wasm-build.yml -y +micromamba activate CppInterOp-wasm-build ``` -and activate the emsdk environment - -```bash -./emsdk/emsdk activate 3.1.73 -source ./emsdk/emsdk_env.sh -``` - -Now clone the 19.x release of the LLVM project repository and CppInterOp (the building of the emscripten version of llvm can be -avoided by executing micromamba install llvm -c and setting the LLVM_BUILD_DIR appropriately) - +Now clone the 19.x release of the LLVM project repository and CppInterOp. The building of the emscripten version of llvm can be +avoided by executing micromamba install llvm=19 -c and setting the LLVM_BUILD_DIR appropriately. ```bash git clone --depth=1 --branch release/19.x https://github.com/llvm/llvm-project.git @@ -85,14 +77,14 @@ by executing (assumes you have micromamba installed and that your shell is initi ```bash cd ../../CppInterOp/ -micromamba create -f environment-wasm.yml --platform=emscripten-wasm32 -micromamba activate CppInterOp-wasm +micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32 ``` You will also want to set a few environment variables ```bash -export PREFIX=$CONDA_PREFIX +export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build +export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-host export CMAKE_PREFIX_PATH=$PREFIX export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX ``` @@ -103,11 +95,11 @@ Now to build CppInterOp execute the following mkdir build cd ./build/ emcmake cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=$PREFIX \ -DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \ -DLLD_DIR=$LLVM_BUILD_DIR/lib/cmake/lld \ -DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \ -DBUILD_SHARED_LIBS=ON \ - -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ ../ emmake make -j $(nproc --all) install @@ -126,7 +118,7 @@ the CppInterOp build folder, you can build the wasm version of xeus-cpp by execu ```bash cd ../.. -export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot +export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git cd ./xeus-cpp mkdir build diff --git a/docs/Emscripten-build-instructions.rst b/docs/Emscripten-build-instructions.rst index aa0254c3f..cd3854fb3 100644 --- a/docs/Emscripten-build-instructions.rst +++ b/docs/Emscripten-build-instructions.rst @@ -26,27 +26,19 @@ Now move into this directory using the following command cd ./CppInterOp-wasm -To create a wasm build of CppInterOp we make use of the emsdk toolchain. -This can be installed by executing (we only currently support version -3.1.73) +You shall now want to make sure you are using the same emsdk (3.1.73) +as the rest of our dependencies.This can be achieved by executing +the following .. code:: bash - git clone https://github.com/emscripten-core/emsdk.git - ./emsdk/emsdk install 3.1.73 + micromamba create -f environment-wasm-build.yml -y + micromamba activate CppInterOp-wasm-build -and activate the emsdk environment - -.. code:: bash - - ./emsdk/emsdk activate 3.1.73 - source ./emsdk/emsdk_env.sh - -Now clone the 19.x release of the LLVM project repository and CppInterOp -(the building of the emscripten version of llvm can be avoided by -executing micromamba install llvm -c - and setting the LLVM_BUILD_DIR -appropriately) +Now clone the 19.x release of the LLVM project repository and CppInterOp. +The building of the emscripten version of llvm can be avoided by executing +micromamba install llvm=19 -c +and setting the LLVM_BUILD_DIR appropriately. .. code:: bash @@ -104,14 +96,13 @@ initialised for the micromamba install) .. code:: bash cd ../../CppInterOp/ - micromamba create -f environment-wasm.yml --platform=emscripten-wasm32 - micromamba activate CppInterOp-wasm + micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32 You will also want to set a few environment variables .. code:: bash - - export PREFIX=$CONDA_PREFIX + export BUILD_PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-build + export PREFIX=$MAMBA_ROOT_PREFIX/envs/CppInterOp-wasm-host export CMAKE_PREFIX_PATH=$PREFIX export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX @@ -122,11 +113,11 @@ Now to build CppInterOp execute the following mkdir build cd ./build/ emcmake cmake -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_PREFIX_PATH=$PREFIX \ -DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \ -DLLD_DIR=$LLVM_BUILD_DIR/lib/cmake/lld \ -DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \ -DBUILD_SHARED_LIBS=ON \ - -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ ../ emmake make -j $(nproc --all) install @@ -147,7 +138,7 @@ build folder, you can build the wasm version of xeus-cpp by executing .. code:: bash cd ../.. - export SYSROOT_PATH=$PWD/emsdk/upstream/emscripten/cache/sysroot + export SYSROOT_PATH=$BUILD_PREFIX/opt/emsdk/upstream/emscripten/cache/sysroot git clone --depth=1 https://github.com/compiler-research/xeus-cpp.git cd ./xeus-cpp mkdir build diff --git a/environment-wasm-build.yml b/environment-wasm-build.yml new file mode 100644 index 000000000..ec84c7c1b --- /dev/null +++ b/environment-wasm-build.yml @@ -0,0 +1,7 @@ +name: CppInterOp-wasm-build +channels: + - https://repo.prefix.dev/emscripten-forge-dev + - conda-forge +dependencies: + - cmake + - emscripten_emscripten-wasm32==3.1.73 diff --git a/environment-wasm.yml b/environment-wasm-host.yml similarity index 74% rename from environment-wasm.yml rename to environment-wasm-host.yml index 4db4342d8..e48c2d8bd 100644 --- a/environment-wasm.yml +++ b/environment-wasm-host.yml @@ -1,8 +1,7 @@ -name: CppInterOp-wasm +name: CppInterOp-wasm-host channels: - https://repo.prefix.dev/emscripten-forge-dev dependencies: - - emscripten-abi==3.1.73 - nlohmann_json - xeus-lite - xeus