|
| 1 | +name: testMacOS |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + tags-ignore: |
| 8 | + - 'v*' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - '**' |
| 12 | + |
| 13 | +env: |
| 14 | + BUILD_TYPE: Release |
| 15 | + MACOSX_DEPLOYMENT_TARGET: "13.3" |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name |
| 20 | + runs-on: macos-14 |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + submodules: recursive |
| 26 | + |
| 27 | + - name: Install dependencies (Homebrew) |
| 28 | + run: | |
| 29 | + brew update |
| 30 | + brew install cmake boost gtk+3 hdf5 libomp llvm make zlib |
| 31 | +
|
| 32 | + - name: Add Homebrew to PATH |
| 33 | + run: echo "/opt/homebrew/bin" >> $GITHUB_PATH |
| 34 | + |
| 35 | + - name: Add Homebrew LLVM to PATH |
| 36 | + run: echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH |
| 37 | + |
| 38 | + - name: Set Xcode toolchain as default |
| 39 | + run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer |
| 40 | + |
| 41 | + - name: Ensure system linker is used |
| 42 | + run: echo "LD=/usr/bin/ld" >> $GITHUB_ENV |
| 43 | + |
| 44 | + - name: Configure Homebrew clang (symlink for easier access) |
| 45 | + run: | |
| 46 | + brew unlink llvm && brew link llvm --force --overwrite |
| 47 | +
|
| 48 | + - name: Symlink system ld for Homebrew clang |
| 49 | + run: | |
| 50 | + ln -sf /usr/bin/ld /opt/homebrew/bin/ld |
| 51 | + ln -sf /usr/bin/ld /opt/homebrew/opt/llvm/bin/ld |
| 52 | +
|
| 53 | + - name: Configure CMake with Homebrew clang and OpenMP support |
| 54 | + env: |
| 55 | + LDFLAGS: "-L/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/zlib/lib" |
| 56 | + CPPFLAGS: "-I/opt/homebrew/opt/libomp/include -I/opt/homebrew/opt/zlib/include" |
| 57 | + PKG_CONFIG_PATH: "/opt/homebrew/opt/zlib/lib/pkgconfig:/opt/homebrew/lib/pkgconfig" |
| 58 | + CC: "/opt/homebrew/opt/llvm/bin/clang" |
| 59 | + CXX: "/opt/homebrew/opt/llvm/bin/clang++" |
| 60 | + run: | |
| 61 | + cmake -B build \ |
| 62 | + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ |
| 63 | + -DCMAKE_MACOSX_RPATH=ON \ |
| 64 | + -DCMAKE_OSX_DEPLOYMENT_TARGET=${{env.MACOSX_DEPLOYMENT_TARGET}} \ |
| 65 | + -DCMAKE_INSTALL_RPATH="@loader_path;@rpath" \ |
| 66 | + -DCMAKE_PREFIX_PATH="/opt/homebrew/opt/hdf5;/opt/homebrew/opt/zlib;/opt/homebrew/opt/libomp" \ |
| 67 | + -DHDF5_ROOT=/opt/homebrew/opt/hdf5 \ |
| 68 | + -DZLIB_ROOT=/opt/homebrew/opt/zlib \ |
| 69 | + -DZLIB_INCLUDE_DIR=/opt/homebrew/opt/zlib/include \ |
| 70 | + -DZLIB_LIBRARY=/opt/homebrew/opt/zlib/lib/libz.dylib \ |
| 71 | + -DRAYX_WERROR=ON \ |
| 72 | + -DRAYX_REQUIRE_CUDA=OFF \ |
| 73 | + -DRAYX_ENABLE_CUDA=OFF \ |
| 74 | + -DRAYX_BUILD_RAYX_UI=OFF \ |
| 75 | + -DRAYX_BUILD_RAYX_CLI=ON \ |
| 76 | + -DRAYX_BUILD_RAYX_TESTS=ON \ |
| 77 | + -DCMAKE_C_COMPILER="$CC" \ |
| 78 | + -DCMAKE_CXX_COMPILER="$CXX" \ |
| 79 | + -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Xpreprocessor -fopenmp -I/opt/homebrew/opt/libomp/include -I/opt/homebrew/opt/zlib/include" \ |
| 80 | + -DCMAKE_EXE_LINKER_FLAGS="-L/opt/homebrew/opt/libomp/lib -L/opt/homebrew/opt/zlib/lib -lomp -lz" |
| 81 | +
|
| 82 | + - name: Build |
| 83 | + run: | |
| 84 | + cmake --build build --config ${{env.BUILD_TYPE}} |
| 85 | +
|
| 86 | + - name: Run |
| 87 | + working-directory: ${{github.workspace}} |
| 88 | + run: | |
| 89 | + ./build/bin/release/rayx -x -c -m 1 -i Intern/rayx-core/tests/input/BoringImagePlane.rml |
| 90 | + ./build/bin/release/rayx -x -m 1 -i Intern/rayx-core/tests/input/BoringImagePlane.rml |
| 91 | + git checkout -- Intern/rayx-core/tests/input/BoringImagePlane.csv |
| 92 | +
|
| 93 | + - name: Test |
| 94 | + working-directory: ${{github.workspace}}/build/bin/release |
| 95 | + run: ./rayx-core-tst -x |
| 96 | + |
| 97 | + - name: Upload artifact |
| 98 | + uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: RAYX-macOS-${{env.BUILD_TYPE}} |
| 101 | + path: ${{github.workspace}}/build/bin/release |
0 commit comments