Build Embree Libraries #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Builds the native Embree shared libraries that ship in | |
| # Evergine.Bindings.Embree/runtimes/. Run it manually, download the artifacts, and commit | |
| # them together with the rtcore_config.h they come with. | |
| # | |
| # rtcore_config.h is generated by Embree's CMake and decides the layout of several public | |
| # structs (RTC_MAX_INSTANCE_LEVEL_COUNT, RTC_GEOMETRY_INSTANCE_ARRAY, RTC_MIN_WIDTH), so the | |
| # copy vendored in EmbreeGen/Headers/embree4/ must always come from the same build as the | |
| # binaries. HelloEmbree asserts the resulting struct sizes at startup. | |
| # | |
| # Embree is built with EMBREE_TASKING_SYSTEM=INTERNAL so each binary is self-contained; the | |
| # default TBB tasking system would drag tbb12/tbbmalloc into the package as well. | |
| name: Build Embree Libraries | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| embree-ref: | |
| description: 'Embree tag to build' | |
| required: false | |
| type: string | |
| default: 'v4.4.1' | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| rid: linux-x64 | |
| max-isa: AVX2 | |
| - os: ubuntu-24.04-arm | |
| rid: linux-arm64 | |
| max-isa: NEON | |
| - os: windows-latest | |
| rid: win-x64 | |
| max-isa: AVX2 | |
| - os: windows-11-arm | |
| rid: win-arm64 | |
| max-isa: NEON | |
| - os: macos-latest | |
| rid: osx-arm64 | |
| max-isa: NEON | |
| steps: | |
| - name: Checkout Embree | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: RenderKit/embree | |
| ref: ${{ inputs.embree-ref || 'v4.4.1' }} | |
| - name: Install build dependencies (Linux) | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake | |
| - name: Configure | |
| shell: bash | |
| run: | | |
| cmake -S . -B build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DEMBREE_TASKING_SYSTEM=INTERNAL \ | |
| -DEMBREE_ISPC_SUPPORT=OFF \ | |
| -DEMBREE_TUTORIALS=OFF \ | |
| -DEMBREE_STATIC_LIB=OFF \ | |
| -DEMBREE_GEOMETRY_INSTANCE_ARRAY=ON \ | |
| -DEMBREE_MAX_ISA=${{ matrix.max-isa }} | |
| - name: Build | |
| run: cmake --build build --config Release --parallel | |
| # On Linux and macOS CMake emits versioned names behind symlinks | |
| # (libembree4.so -> libembree4.so.4 -> libembree4.so.4.4.1). Symlinks do not survive | |
| # NuGet packaging, so the real file is copied out under the plain name that | |
| # [DllImport("embree4")] probes for. | |
| - name: Collect artifacts | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p out | |
| case "${{ matrix.rid }}" in | |
| win-*) | |
| cp "$(find build -name 'embree4.dll' -print -quit)" out/embree4.dll | |
| ;; | |
| linux-*) | |
| cp "$(readlink -f "$(find build -name 'libembree4.so*' -print -quit)")" out/libembree4.so | |
| ;; | |
| osx-*) | |
| cp "$(readlink -f "$(find build -name 'libembree4*.dylib' -print -quit)")" out/libembree4.dylib | |
| ;; | |
| esac | |
| cp include/embree4/rtcore_config.h out/ | |
| ls -l out | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: embree-${{ matrix.rid }} | |
| path: out/ |