1name: MacOS 2 3on: 4 push: 5 paths-ignore: 6 - '**/*.md' 7 pull_request: 8 paths-ignore: 9 - '**/*.md' 10 11jobs: 12 compatibility: 13 runs-on: macos-11 14 strategy: 15 matrix: 16 VER: [9, 11] 17 GEN: [Xcode, Ninja Multi-Config] 18 STD: [11, 17] 19 20 steps: 21 - name: Checkout OpenCL-Headers 22 uses: actions/checkout@v3 23 24 - name: Create Build Environment 25 shell: bash 26 run: | 27 cmake -E make_directory $GITHUB_WORKSPACE/build; 28 cmake -E make_directory $GITHUB_WORKSPACE/install; 29 if [[ "${{matrix.GEN}}" == "Ninja Multi-Config" && ! `which ninja` ]]; then brew install ninja; fi; 30 # Install Ninja only if it's the selected generator and it's not available. 31 cmake --version 32 33 - name: Install gcc if required 34 run: | 35 if [[ ! `which /usr/local/bin/gcc-${{matrix.VER}}` ]]; then brew install gcc@${{matrix.VER}}; fi; 36 37 - name: Configure CMake 38 shell: bash 39 run: cmake 40 -G "${{matrix.GEN}}" 41 -D BUILD_TESTING=ON 42 -D CMAKE_C_FLAGS="-Wall -Wextra -pedantic -Werror" 43 -D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}} 44 -D CMAKE_C_EXTENSIONS=OFF 45 -D CMAKE_CXX_FLAGS="-Wall -Wextra -pedantic -Werror" 46 -D CMAKE_CXX_COMPILER=/usr/local/bin/g++-${{matrix.VER}} 47 -D CMAKE_CXX_EXTENSIONS=OFF 48 -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install 49 -S $GITHUB_WORKSPACE 50 -B $GITHUB_WORKSPACE/build 51 52 - name: Build 53 shell: bash 54 run: | 55 cmake --build $GITHUB_WORKSPACE/build --config Release --parallel `sysctl -n hw.logicalcpu` `if [[ "${{matrix.GEN}}" == "Xcode" ]]; then echo "-- -quiet"; fi;` 56 cmake --build $GITHUB_WORKSPACE/build --config Debug --parallel `sysctl -n hw.logicalcpu` `if [[ "${{matrix.GEN}}" == "Xcode" ]]; then echo "-- -quiet"; fi;` 57 58 - name: Test 59 working-directory: ${{runner.workspace}}/OpenCL-Headers/build 60 shell: bash 61 run: | 62 ctest -C Release --output-on-failure --parallel `sysctl -n hw.logicalcpu` 63 ctest -C Debug --output-on-failure --parallel `sysctl -n hw.logicalcpu` 64 65 - name: Test install 66 shell: bash 67 run: cmake --build $GITHUB_WORKSPACE/build --target install --config Release 68 69 - name: Test pkg-config 70 shell: bash 71 run: | 72 if [[ ! `which pkg-config` ]]; then brew install pkg-config; fi; 73 PKG_CONFIG_PATH="$GITHUB_WORKSPACE/install/share/pkgconfig" pkg-config OpenCL-Headers --cflags | grep -q "\-I$GITHUB_WORKSPACE/install/include" 74