Fix embree TBB dependency location #44
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
| name: macOS Build | |
| on: | |
| push: | |
| branches: [develop, main] | |
| tags: ["*-prealpha"] | |
| pull_request: | |
| branches: [develop, main] | |
| workflow_dispatch: | |
| env: | |
| USD_VERSION: "26.03" | |
| PYTHON_VERSION: "3.11" | |
| USD_INSTALL_DIR: usd-install | |
| BUILD_TYPE: Release | |
| jobs: | |
| build-usd: | |
| runs-on: macos-14 | |
| outputs: | |
| cache-key: ${{ steps.cache-key.outputs.value }} | |
| steps: | |
| - name: Compute cache key | |
| id: cache-key | |
| run: | | |
| XCODE_VER=$(xcodebuild -version | head -1 | awk '{print $2}') | |
| echo "value=usd-macos-${{ env.USD_VERSION }}-xcode${XCODE_VER}-py${{ env.PYTHON_VERSION }}-tbb2" >> $GITHUB_OUTPUT | |
| - name: Cache USD | |
| id: cache-usd | |
| uses: actions/cache@v5 | |
| with: | |
| path: ${{ env.USD_INSTALL_DIR }} | |
| key: ${{ steps.cache-key.outputs.value }} | |
| - name: Install build dependencies | |
| if: steps.cache-usd.outputs.cache-hit != 'true' | |
| # Do NOT install tbb here: build_usd.py builds its own (classic) TBB with an | |
| # @rpath install id. If homebrew's oneTBB is present, embree's find_package(TBB) | |
| # prefers it (it ships TBBConfig.cmake) and bakes in the absolute install id | |
| # /opt/homebrew/opt/tbb/lib/libtbb.12.dylib, which is neither bundled nor present | |
| # on end-user machines, so hdEmbree.dylib fails to dlopen. | |
| run: brew install cmake ninja glew | |
| - name: Install Python Jinja2 | |
| if: steps.cache-usd.outputs.cache-hit != 'true' | |
| run: | | |
| python3 -m venv .venv | |
| .venv/bin/pip install jinja2 | |
| echo "${{ github.workspace }}/.venv/bin" >> $GITHUB_PATH | |
| - name: Checkout OpenUSD ${{ env.USD_VERSION }} | |
| if: steps.cache-usd.outputs.cache-hit != 'true' | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: PixarAnimationStudios/OpenUSD | |
| ref: v${{ env.USD_VERSION }} | |
| path: OpenUSD | |
| fetch-depth: 1 | |
| - name: Build USD | |
| if: steps.cache-usd.outputs.cache-hit != 'true' | |
| env: | |
| # CMake 4 dropped support for cmake_minimum_required < 3.5, which OpenUSD's | |
| # bundled dependencies (e.g. zlib 1.2.13) still declare. build_usd.py passes | |
| # this env var down to every nested dependency configure. | |
| CMAKE_POLICY_VERSION_MINIMUM: "3.5" | |
| run: | | |
| python3 OpenUSD/build_scripts/build_usd.py \ | |
| --embree \ | |
| --no-python --no-usdview \ | |
| --no-examples --no-tutorials --no-docs \ | |
| --build-variant release \ | |
| ${{ github.workspace }}/${{ env.USD_INSTALL_DIR }} | |
| - name: Remove USD build artifacts from install dir | |
| if: steps.cache-usd.outputs.cache-hit != 'true' | |
| run: rm -rf ${{ github.workspace }}/${{ env.USD_INSTALL_DIR }}/build | |
| build-usdtweak: | |
| runs-on: macos-14 | |
| needs: build-usd | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Restore USD cache | |
| uses: actions/cache/restore@v5 | |
| with: | |
| path: ${{ env.USD_INSTALL_DIR }} | |
| key: ${{ needs.build-usd.outputs.cache-key }} | |
| - name: Install dependencies | |
| # No tbb: usdtweak links TBB::tbb via pxrConfig.cmake, which points at the TBB | |
| # inside the cached USD install (with an @rpath install id), not homebrew's. | |
| run: brew install glew | |
| - name: Configure | |
| run: | | |
| cmake -G Ninja \ | |
| -DCMAKE_OSX_ARCHITECTURES=arm64 \ | |
| -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ | |
| "-DCMAKE_PREFIX_PATH=${{ github.workspace }}/${{ env.USD_INSTALL_DIR }};$(brew --prefix glew)" \ | |
| -Dpxr_DIR=${{ github.workspace }}/${{ env.USD_INSTALL_DIR }} \ | |
| -DBUILD_TWIKI=ON \ | |
| -B build | |
| - name: Build | |
| run: cmake --build build | |
| - name: Package (CPack DragNDrop) | |
| run: cd build && cpack | |
| - name: Upload DMG artifact | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: usdtweak-macos-dmg | |
| path: build/usdtweak-*.dmg | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build-usdtweak | |
| if: (startsWith(github.ref, 'refs/tags/') && endsWith(github.ref, '-prealpha')) || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Download DMG artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: usdtweak-macos-dmg | |
| - name: Upload to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: "*.dmg" | |
| draft: true | |
| prerelease: true |