name: Build on: [push, pull_request] jobs: linux-gcc: runs-on: ubuntu-latest strategy: matrix: VER: [7, 8, 9] EXT: [ON, OFF] GEN: [Unix Makefiles, Ninja] VAR: [Debug, Release] STD: [99, 11] # 90 results in errors BIN: [32, 64] steps: - uses: actions/checkout@v2 - name: Create Build Environment run: cmake -E make_directory $GITHUB_WORKSPACE/build; cmake -E make_directory $GITHUB_WORKSPACE/install; cmake -E make_directory $GITHUB_WORKSPACE/downstream/pkgconfig/bare; cmake -E make_directory $GITHUB_WORKSPACE/downstream/pkgconfig/sdk; if [[ "${{matrix.GEN}}" == "Ninja" && ! `which ninja` ]]; then sudo apt install -y ninja-build; fi; if [[ "${{matrix.BIN}}" == "32" ]]; then sudo apt install -y gcc-multilib gcc-8-multilib gcc-9-multilib; fi # Install Ninja only if it's the selected generator and it's not available. - name: Configure CMake shell: bash run: cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=${{matrix.VAR}} -D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}" -D CMAKE_C_COMPILER=gcc-${{matrix.VER}} -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build - name: Build shell: bash run: cmake --build $GITHUB_WORKSPACE/build -- -j`nproc` - name: Test working-directory: ${{runner.workspace}}/OpenCL-Headers/build shell: bash run: ctest --parallel `nproc` - name: Install shell: bash run: cmake --build $GITHUB_WORKSPACE/build --target install -- -j`nproc` - name: Consume (Configure PkgConfig - bare) shell: bash run: cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=${{matrix.VAR}} -D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}" -D CMAKE_C_COMPILER=gcc-${{matrix.VER}} -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install -S $GITHUB_WORKSPACE/tests/pkgconfig/bare -B $GITHUB_WORKSPACE/downstream/pkgconfig/bare - name: Consume (Build PkgConfig - bare) shell: bash run: cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/bare -- -j`nproc` - name: Consume (Emulate SDK presence) shell: bash run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL; echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake - name: Consume (Configure PkgConfig - SDK) shell: bash run: cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=${{matrix.VAR}} -D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -m${{matrix.BIN}}" -D CMAKE_C_COMPILER=gcc-${{matrix.VER}} -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install -S $GITHUB_WORKSPACE/tests/pkgconfig/sdk -B $GITHUB_WORKSPACE/downstream/pkgconfig/sdk - name: Consume (Build PkgConfig - SDK) shell: bash run: cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk -- -j`nproc` windows-msvc: runs-on: windows-latest strategy: matrix: VER: [v140, v141, v142] EXT: [ON, OFF] GEN: [Visual Studio 16 2019, Ninja Multi-Config] BIN: [x64, x86] #STD Proper 11, 17 incoming: https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/ steps: - uses: actions/checkout@v2 - name: Create Build Environment shell: cmd run: | cmake -E make_directory $GITHUB_WORKSPACE/build; cmake -E make_directory $GITHUB_WORKSPACE/install; - name: Configure (MSBuild) if: matrix.GEN == 'Visual Studio 16 2019' shell: cmd run: | if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001") if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64) cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%/build - name: Configure (Ninja) if: matrix.GEN == 'Ninja Multi-Config' shell: cmd run: | if /I "${{matrix.VER}}"=="v140" (set VER=14.0) if /I "${{matrix.VER}}"=="v141" (set VER=14.1) if /I "${{matrix.VER}}"=="v142" (set VER=14.2) if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001") call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%/build - name: Build (MSBuild) if: matrix.GEN == 'Visual Studio 16 2019' shell: cmd run: | cmake --build %GITHUB_WORKSPACE%\build --config Release -- /verbosity:minimal /maxCpuCount /noLogo cmake --build %GITHUB_WORKSPACE%\build --config Debug -- /verbosity:minimal /maxCpuCount /noLogo - name: Build (Ninja) if: matrix.GEN == 'Ninja Multi-Config' shell: cmd run: | if /I "${{matrix.VER}}"=="v140" set VER=14.0 if /I "${{matrix.VER}}"=="v141" set VER=14.1 if /I "${{matrix.VER}}"=="v142" set VER=14.2 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% cmake --build %GITHUB_WORKSPACE%\build --config Release cmake --build %GITHUB_WORKSPACE%\build --config Debug - name: Test working-directory: ${{runner.workspace}}/OpenCL-Headers/build shell: cmd run: | ctest -C Release --parallel %NUMBER_OF_PROCESSORS% - name: Install shell: cmd run: | cmake --build %GITHUB_WORKSPACE%/build --config Release --target install - name: Consume (Configure PkgConfig - bare MSBuild) if: matrix.GEN == 'Visual Studio 16 2019' shell: cmd run: | if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001") if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64) cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\bare -B %GITHUB_WORKSPACE%\downstream\pkgconfig\bare - name: Consume (Configure PkgConfig - bare Ninja) if: matrix.GEN == 'Ninja Multi-Config' shell: cmd run: | if /I "${{matrix.VER}}"=="v140" (set VER=14.0) if /I "${{matrix.VER}}"=="v141" (set VER=14.1) if /I "${{matrix.VER}}"=="v142" (set VER=14.2) if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001") call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\bare -B %GITHUB_WORKSPACE%\downstream\pkgconfig\bare - name: Consume (Build PkgConfig - bare MSBuild) if: matrix.GEN == 'Visual Studio 16 2019' shell: cmd run: | cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Release -- /verbosity:minimal /maxCpuCount /noLogo cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Debug -- /verbosity:minimal /maxCpuCount /noLogo - name: Consume (Build PkgConfig - bare Ninja) if: matrix.GEN == 'Ninja Multi-Config' shell: cmd run: | if /I "${{matrix.VER}}"=="v140" set VER=14.0 if /I "${{matrix.VER}}"=="v141" set VER=14.1 if /I "${{matrix.VER}}"=="v142" set VER=14.2 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Release cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\bare --config Debug - name: Consume (Emulate SDK presence) shell: bash run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL; echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake - name: Consume (Configure PkgConfig - SDK MSBuild) if: matrix.GEN == 'Visual Studio 16 2019' shell: cmd run: | if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001") if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64) cmake -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\sdk -B %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk - name: Consume (Configure PkgConfig - SDK Ninja) if: matrix.GEN == 'Ninja Multi-Config' shell: cmd run: | if /I "${{matrix.VER}}"=="v140" (set VER=14.0) if /I "${{matrix.VER}}"=="v141" (set VER=14.1) if /I "${{matrix.VER}}"=="v142" (set VER=14.2) if /I "${{matrix.EXT}}"=="ON" (set C_FLAGS="/W4 /WX") else (set C_FLAGS="/W4 /WX /Za /wd4001") call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%/install -S %GITHUB_WORKSPACE%\tests\pkgconfig\sdk -B %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk - name: Consume (Build PkgConfig - SDK MSBuild) if: matrix.GEN == 'Visual Studio 16 2019' shell: cmd run: | cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Release -- /verbosity:minimal /maxCpuCount /noLogo cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Debug -- /verbosity:minimal /maxCpuCount /noLogo - name: Consume (Build PkgConfig - SDK Ninja) if: matrix.GEN == 'Ninja Multi-Config' shell: cmd run: | if /I "${{matrix.VER}}"=="v140" set VER=14.0 if /I "${{matrix.VER}}"=="v141" set VER=14.1 if /I "${{matrix.VER}}"=="v142" set VER=14.2 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Release cmake --build %GITHUB_WORKSPACE%\downstream\pkgconfig\sdk --config Debug macos-gcc: runs-on: macos-latest strategy: matrix: VER: [8, 9] EXT: [ON, OFF] GEN: [Xcode, Ninja Multi-Config] STD: [99, 11] # 90 results in errors steps: - uses: actions/checkout@v2 - name: Create Build Environment run: | cmake -E make_directory $GITHUB_WORKSPACE/build; cmake -E make_directory $GITHUB_WORKSPACE/install; if [[ "${{matrix.GEN}}" == "Ninja Multi-Config" && ! `which ninja` ]]; then brew install ninja; fi; # Install Ninja only if it's the selected generator and it's not available. - name: Configure CMake shell: bash run: cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format" -D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}} -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build - name: Build (Xcode) if: matrix.GEN == 'Xcode' shell: bash run: | cmake --build $GITHUB_WORKSPACE/build --config Release cmake --build $GITHUB_WORKSPACE/build --config Debug - name: Build (Ninja) if: matrix.GEN == 'Ninja Multi-Config' shell: bash run: | cmake --build $GITHUB_WORKSPACE/build --config Release cmake --build $GITHUB_WORKSPACE/build --config Debug - name: Test working-directory: ${{runner.workspace}}/OpenCL-Headers/build shell: bash run: ctest -C Release --parallel `sysctl -n hw.logicalcpu` - name: Install (Xcode) if: matrix.GEN == 'Xcode' shell: bash run: | cmake --build $GITHUB_WORKSPACE/build --config Release --target install - name: Install (Ninja) if: matrix.GEN == 'Ninja Multi-Config' shell: bash run: | cmake --build $GITHUB_WORKSPACE/build --config Release --target install - name: Consume (Configure PkgConfig - bare) shell: bash run: cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format" -D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}} -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install -S $GITHUB_WORKSPACE/tests/pkgconfig/bare -B $GITHUB_WORKSPACE/downstream/pkgconfig/bare - name: Consume (Build PkgConfig - bare) shell: bash run: | cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/bare --config Release cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/bare --config Debug - name: Consume (Emulate SDK presence) shell: bash run: cmake -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL; echo 'include("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeaders/OpenCLHeadersTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake - name: Consume (Configure PkgConfig - SDK) shell: bash run: cmake -G "${{matrix.GEN}}" -D BUILD_TESTING=ON -D CMAKE_C_FLAGS="-Wall -Wextra -Werror -pedantic -Wno-format" -D CMAKE_C_COMPILER=/usr/local/bin/gcc-${{matrix.VER}} -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/install -S $GITHUB_WORKSPACE/tests/pkgconfig/sdk -B $GITHUB_WORKSPACE/downstream/pkgconfig/sdk - name: Consume (Build PkgConfig - SDK) shell: bash run: | cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk --config Release cmake --build $GITHUB_WORKSPACE/downstream/pkgconfig/sdk --config Debug