| name: Windows |
| |
| on: [push, pull_request] |
| |
| jobs: |
| msvc: |
| runs-on: windows-2022 |
| strategy: |
| matrix: |
| VER: [v141, v142, v143] |
| EXT: [ON] # OFF: error C2079: 'statbuf' uses undefined struct 'stat' |
| GEN: [Visual Studio 17 2022, Ninja Multi-Config] |
| BIN: [x64, x86] |
| STD: [11, 17] |
| CMAKE: [3.22.0] |
| env: |
| CMAKE_URL: https://github.com/Kitware/CMake/releases/download/v${{matrix.CMAKE}}/cmake-${{matrix.CMAKE}}-windows-x86_64.zip |
| CMAKE_EXE: C:\Tools\Kitware\CMake\${{matrix.CMAKE}}\bin\cmake.exe |
| CTEST_EXE: C:\Tools\Kitware\CMake\${{matrix.CMAKE}}\bin\ctest.exe |
| NINJA_URL: https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-win.zip |
| NINJA_EXE: C:\Tools\Ninja\ninja.exe |
| |
| steps: |
| - name: Checkout OpenCL-CLHPP |
| uses: actions/checkout@v3 |
| with: |
| submodules: recursive |
| |
| - name: Checkout OpenCL-Headers |
| uses: actions/checkout@v3 |
| with: |
| repository: KhronosGroup/OpenCL-Headers |
| path: external/OpenCL-Headers |
| |
| - name: Checkout OpenCL-ICD-Loader |
| uses: actions/checkout@v3 |
| with: |
| repository: KhronosGroup/OpenCL-ICD-Loader |
| path: external/OpenCL-ICD-Loader |
| |
| - name: Create Build Environment |
| shell: pwsh |
| run: | |
| Invoke-WebRequest ${env:CMAKE_URL} -OutFile ~\Downloads\cmake-${{matrix.CMAKE}}-windows-x86_64.zip |
| Expand-Archive ~\Downloads\cmake-${{matrix.CMAKE}}-windows-x86_64.zip -DestinationPath C:\Tools\Kitware\CMake\ |
| Rename-Item C:\Tools\Kitware\CMake\* ${{matrix.CMAKE}} |
| Invoke-WebRequest ${env:NINJA_URL} -OutFile ~\Downloads\ninja-win.zip |
| Expand-Archive ~\Downloads\ninja-win.zip -DestinationPath C:\Tools\Ninja\ |
| Remove-Item ~\Downloads\* |
| & ${env:CMAKE_EXE} --version |
| & ${env:NINJA_EXE} --version |
| |
| - name: Build & install OpenCL-Headers (MSBuild) |
| if: matrix.GEN == 'Visual Studio 17 2022' |
| shell: cmd |
| run: | |
| set C_FLAGS="/w" |
| if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64) |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\external\OpenCL-Headers\install -S %GITHUB_WORKSPACE%\external\OpenCL-Headers -B %GITHUB_WORKSPACE%\external\OpenCL-Headers\build |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/external/OpenCL-Headers/build --target install --config Release -- /verbosity:minimal /maxCpuCount /noLogo |
| |
| - name: Build & install OpenCL-Headers (Ninja Multi-Config) |
| if: matrix.GEN == 'Ninja Multi-Config' |
| shell: cmd |
| run: | |
| set C_FLAGS="/w" |
| 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.VER}}"=="v143" (set VER=14.3) |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\external\OpenCL-Headers\install -S %GITHUB_WORKSPACE%\external\OpenCL-Headers -B %GITHUB_WORKSPACE%\external\OpenCL-Headers\build |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/external/OpenCL-Headers/build --target install -- -j%NUMBER_OF_PROCESSORS% |
| |
| - name: Build & install OpenCL-ICD-Loader (MSBuild) |
| if: matrix.GEN == 'Visual Studio 17 2022' |
| shell: cmd |
| run: | |
| set C_FLAGS="/w" |
| if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64) |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\external\OpenCL-ICD-Loader\install -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%\external\OpenCL-Headers\install -S %GITHUB_WORKSPACE%\external\OpenCL-ICD-Loader -B %GITHUB_WORKSPACE%\external\OpenCL-ICD-Loader\build |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/external/OpenCL-ICD-Loader/build --target install --config Release -- /verbosity:minimal /maxCpuCount /noLogo |
| |
| - name: Build & install OpenCL-ICD-Loader (Ninja Multi-Config) |
| if: matrix.GEN == 'Ninja Multi-Config' |
| shell: cmd |
| run: | |
| set C_FLAGS="/w" |
| 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.VER}}"=="v143" (set VER=14.3) |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\external\OpenCL-ICD-Loader\install -D CMAKE_PREFIX_PATH=%GITHUB_WORKSPACE%\external\OpenCL-Headers\install -S %GITHUB_WORKSPACE%\external\OpenCL-ICD-Loader -B %GITHUB_WORKSPACE%\external\OpenCL-ICD-Loader\build |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/external/OpenCL-ICD-Loader/build --target install --config Release -- -j%NUMBER_OF_PROCESSORS% |
| |
| - name: Configure (MSBuild) |
| if: matrix.GEN == 'Visual Studio 17 2022' |
| shell: cmd |
| # no /WX during configuration because: |
| # warning C4459: declaration of 'platform' hides global declaration |
| # warning C4100: 'input_headers': unreferenced formal parameter |
| run: | |
| set C_FLAGS="/W4" |
| if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64) |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -A %BIN% -T ${{matrix.VER}} -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\external\OpenCL-ICD-Loader\install" -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%\build |
| |
| - name: Configure (Ninja Multi-Config) |
| if: matrix.GEN == 'Ninja Multi-Config' |
| shell: cmd |
| # no /WX during configuration because: |
| # warning C4459: declaration of 'platform' hides global declaration |
| # warning C4100: 'input_headers': unreferenced formal parameter |
| run: | |
| set C_FLAGS="/W4" |
| 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.VER}}"=="v143" (set VER=14.3) |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D BUILD_TESTING=ON -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\external\OpenCL-ICD-Loader\install" -S %GITHUB_WORKSPACE% -B %GITHUB_WORKSPACE%\build |
| |
| - name: Build (MSBuild) |
| if: matrix.GEN == 'Visual Studio 17 2022' |
| shell: cmd |
| run: | |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%\build --config Release -- /verbosity:minimal /maxCpuCount /noLogo |
| %CMAKE_EXE% --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 |
| if /I "${{matrix.VER}}"=="v143" set VER=14.3 |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%\build --config Release |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%\build --config Debug |
| |
| - name: Test |
| continue-on-error: true |
| working-directory: ${{runner.workspace}}/OpenCL-CLHPP/build |
| shell: cmd |
| run: | |
| %CTEST_EXE% -C Release --output-on-failure --parallel %NUMBER_OF_PROCESSORS% |
| %CTEST_EXE% -C Debug --output-on-failure --parallel %NUMBER_OF_PROCESSORS% |
| |
| - name: Install |
| shell: cmd |
| run: | |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/build --config Release --target install |
| |
| - name: "Consume (MSBuild standalone): Configure/Build/Test" |
| shell: cmd |
| run: | |
| set C_FLAGS="/W4" |
| if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64) |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\install" -D DRIVER_STUB_PATH=%GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll -B %GITHUB_WORKSPACE%/build/downstream/bare -S %GITHUB_WORKSPACE%/tests/pkgconfig/bare |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/tests/pkgconfig/bare --config Release |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/tests/pkgconfig/bare --config Debug |
| cd %GITHUB_WORKSPACE%/tests/pkgconfig/bare |
| %CTEST_EXE% --output-on-failure -C Release |
| %CTEST_EXE% --output-on-failure -C Debug |
| |
| - name: "Consume (MSBuild SDK): Configure/Build/Test" |
| shell: cmd |
| run: | |
| set C_FLAGS="/W4" |
| if /I "${{matrix.BIN}}"=="x86" (set BIN=Win32) else (set BIN=x64) |
| %CMAKE_EXE% -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL |
| echo -e 'include("/home/runner/work/OpenCL-CLHPP/OpenCL-CLHPP/external/OpenCL-Headers/install/share/cmake/OpenCLHeaders/OpenCLHeadersTargets.cmake")\ninclude("/home/runner/work/OpenCL-CLHPP/OpenCL-CLHPP/external/OpenCL-ICD-Loader/install/share/cmake/OpenCLICDLoader/OpenCLICDLoaderTargets.cmake")\ninclude("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeadersCpp/OpenCLHeadersCppTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\install" -D DRIVER_STUB_PATH=%GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll -B %GITHUB_WORKSPACE%/build/downstream/bare -S %GITHUB_WORKSPACE%/tests/pkgconfig/bare |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/tests/pkgconfig/bare --config Release |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/tests/pkgconfig/bare --config Debug |
| cd %GITHUB_WORKSPACE%/tests/pkgconfig/bare |
| %CTEST_EXE% --output-on-failure -C Release |
| %CTEST_EXE% --output-on-failure -C Debug |
| |
| - name: "Consume (Ninja-Multi-Config standalone): Configure/Build/Test" |
| shell: cmd |
| run: | |
| set C_FLAGS="/W4" |
| 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.VER}}"=="v143" (set VER=14.3) |
| call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{matrix.BIN}} /vcvars_ver=%VER% |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\install" -D DRIVER_STUB_PATH=%GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll -B %GITHUB_WORKSPACE%/build/downstream/bare -S %GITHUB_WORKSPACE%/tests/pkgconfig/bare |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/tests/pkgconfig/bare --config Release |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/tests/pkgconfig/bare --config Debug |
| cd %GITHUB_WORKSPACE%/tests/pkgconfig/bare |
| %CTEST_EXE% --output-on-failure -C Release |
| %CTEST_EXE% --output-on-failure -C Debug |
| |
| - name: "Consume (Ninja-Multi-Config SDK): Configure/Build/Test" |
| shell: cmd |
| run: | |
| set C_FLAGS="/W4" |
| 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.VER}}"=="v143" (set VER=14.3) |
| %CMAKE_EXE% -E make_directory $GITHUB_WORKSPACE/install/share/cmake/OpenCL |
| echo -e 'include("/home/runner/work/OpenCL-CLHPP/OpenCL-CLHPP/external/OpenCL-Headers/install/share/cmake/OpenCLHeaders/OpenCLHeadersTargets.cmake")\ninclude("/home/runner/work/OpenCL-CLHPP/OpenCL-CLHPP/external/OpenCL-ICD-Loader/install/share/cmake/OpenCLICDLoader/OpenCLICDLoaderTargets.cmake")\ninclude("${CMAKE_CURRENT_LIST_DIR}/../OpenCLHeadersCpp/OpenCLHeadersCppTargets.cmake")' > $GITHUB_WORKSPACE/install/share/cmake/OpenCL/OpenCLConfig.cmake |
| %CMAKE_EXE% -G "${{matrix.GEN}}" -D CMAKE_MAKE_PROGRAM=%NINJA_EXE% -D CMAKE_C_FLAGS=%C_FLAGS% -D CMAKE_C_STANDARD=${{matrix.STD}} -D CMAKE_C_EXTENSIONS=${{matrix.EXT}} -D CMAKE_EXE_LINKER_FLAGS=/INCREMENTAL -D CMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install -D CMAKE_PREFIX_PATH="%GITHUB_WORKSPACE%\external\OpenCL-Headers\install;%GITHUB_WORKSPACE%\install" -D DRIVER_STUB_PATH=%GITHUB_WORKSPACE%/build/Release/OpenCLDriverStub.dll -B %GITHUB_WORKSPACE%/build/downstream/bare -S %GITHUB_WORKSPACE%/tests/pkgconfig/bare |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/tests/pkgconfig/bare --config Release |
| %CMAKE_EXE% --build %GITHUB_WORKSPACE%/tests/pkgconfig/bare --config Debug |
| cd %GITHUB_WORKSPACE%/tests/pkgconfig/bare |
| %CTEST_EXE% --output-on-failure -C Release |
| %CTEST_EXE% --output-on-failure -C Debug |