Build with YaaZ/Vulkan-Hpp#main #3
Workflow file for this run
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: Build with custom Vulkan | |
| run-name: Build with ${{inputs.vulkan}} | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| vulkan: | |
| description: Vulkan revision | |
| required: true | |
| default: YaaZ/Vulkan-Hpp#main | |
| type: string | |
| workflow_call: | |
| inputs: | |
| vulkan: | |
| required: true | |
| type: string | |
| jobs: | |
| build: | |
| name: ${{matrix.env.os}} ${{matrix.env.name || matrix.env.c}} ${{matrix.env.modules && 'cppm'}} | |
| env: | |
| compiler: ${{matrix.env.name || matrix.env.c}} | |
| modules: ${{matrix.env.modules}} | |
| runs-on: ${{matrix.env.os}} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| env: [ | |
| { os: macos-15, cxx: clang++, name: apple-clang }, | |
| # { os: macos-15, cxx: /opt/homebrew/opt/llvm/bin/clang++, name: clang, cxx_flags: '-I/opt/homebrew/opt/llvm/include/c++/v1 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk', linker_flags: '-L/opt/homebrew/opt/llvm/lib/c++', modules: true }, # TODO Enable when https://github.com/YaaZ/VulkanMemoryAllocator-Hpp/issues/65 is fixed | |
| { os: ubuntu-24.04, cxx: clang++-16, c: clang-16 }, | |
| { os: ubuntu-24.04, cxx: clang++-17, c: clang-17 }, | |
| { os: ubuntu-24.04, cxx: clang++-18, c: clang-18 }, | |
| { os: ubuntu-24.04, cxx: clang++-18, c: clang-18, cxx_flags: '-stdlib=libc++', linker_flags: '-stdlib=libc++ -lc++abi', modules: true }, | |
| { os: ubuntu-24.04, cxx: g++-12, c: gcc-12 }, | |
| { os: ubuntu-24.04, cxx: g++-13, c: gcc-13 }, | |
| { os: ubuntu-24.04, cxx: g++-14, c: gcc-14 }, | |
| { os: windows-2025, name: msvc, cxx_flags: '//EHsc' }, | |
| { os: windows-2025, name: msvc, cxx_flags: '//EHsc', modules: true, extra_flags: '-DVMA_HPP_SAMPLES_BUILD=OFF' }, # TODO Build samples when MSVC stops failing with ICE | |
| { os: windows-2025, cxx: clang-cl, c: clang-cl, cxx_flags: '/EHsc' }, | |
| { os: windows-2025, cxx: c++, c: cc, name: gcc }, | |
| ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5.0.0 | |
| with: | |
| submodules: true | |
| - name: Setup CMake and Ninja | |
| if: matrix.env.modules | |
| uses: lukka/get-cmake@latest | |
| with: | |
| cmakeVersion: 4.1.2 | |
| ninjaVersion: latest | |
| - name: Setup MSVC | |
| if: contains(matrix.env.os, 'windows') && matrix.env.name == 'msvc' | |
| uses: TheMrMilchmann/setup-msvc-dev@v4 | |
| with: | |
| arch: x64 | |
| - name: Setup libc | |
| if: contains(matrix.env.os, 'ubuntu') && matrix.env.modules | |
| run: sudo apt install libc++-dev libc++abi-dev | |
| - name: Setup libc & fix 'import std' | |
| if: contains(matrix.env.os, 'macos') && matrix.env.modules | |
| run: | | |
| brew install llvm | |
| CMAKE_FIX=`which cmake` | |
| CMAKE_FIX="`dirname $CMAKE_FIX`/../share/cmake-4.1/Modules/Compiler/Clang-CXX-CXXImportStd.cmake" | |
| sed -i '' 's|\${_clang_modules_json_impl}.modules.json|/opt/homebrew/opt/llvm/lib/c++/libc++.modules.json|g' $CMAKE_FIX # https://gitlab.kitware.com/cmake/cmake/-/issues/25965#note_1523575 | |
| - name: Setup build environment | |
| run: | | |
| IFS='#' read -r -a VULKAN <<< '${{inputs.vulkan}}' | |
| FLAGS=(--no-checkout --shallow-exclude=v1.4.326 --branch main) | |
| [[ ${VULKAN[1]} ]] && FLAGS=(--depth 1 --branch ${VULKAN[1]}) | |
| git clone --single-branch ${FLAGS[@]} ${VULKAN[0]} vulkan || \ | |
| git clone --single-branch ${FLAGS[@]} https://github.com/${VULKAN[0]}.git vulkan | |
| (cd vulkan && git submodule update --init --depth 1 Vulkan-Headers || true) | |
| echo "vk=${VULKAN[1]}" >> $GITHUB_ENV | |
| cat > build <<'EOF' | |
| #!/usr/bin/env bash | |
| set -eo pipefail | |
| (cd vulkan && git checkout -q -f $1) | |
| shift | |
| CXX_FLAGS=( | |
| ${{(contains(env.compiler, 'clang') || contains(env.compiler, 'gcc')) && '-Wno-nullability-completeness -Wno-deprecated-declarations' || ''}} | |
| ${{matrix.env.cxx_flags || ''}} | |
| ) | |
| CXX_FLAGS="${CXX_FLAGS[@]} $@" | |
| FLAGS=( | |
| -B cmake-build -G Ninja --fresh | |
| -DVMA_HPP_GENERATOR_BUILD=OFF | |
| -DVMA_HPP_RUN_GENERATOR=OFF | |
| -DCMAKE_BUILD_TYPE=Release | |
| -DFETCHCONTENT_SOURCE_DIR_VULKAN=vulkan | |
| -DVULKAN_HEADERS_ENABLE_MODULE=${{matrix.env.modules && 'ON' || 'OFF'}} | |
| -DVULKAN_HPP_BUILD_CXX_MODULE=${{matrix.env.modules && 'ON' || 'OFF'}} | |
| ${{matrix.env.modules && '-DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444' || ''}} | |
| ${{matrix.env.cxx && format('-DCMAKE_CXX_COMPILER={0}', matrix.env.cxx)}} | |
| ${{matrix.env.c && format('-DCMAKE_C_COMPILER={0}', matrix.env.c)}} | |
| ${{matrix.env.linker_flags && format('-DCMAKE_EXE_LINKER_FLAGS=''{0}''', matrix.env.linker_flags)}} | |
| ${{matrix.env.extra_flags || ''}} | |
| -DCMAKE_CXX_FLAGS="$CXX_FLAGS" | |
| ) | |
| RESULT=0 | |
| for STANDARD in ${{!matrix.env.modules && '11 14 17 20' || ''}} 23; do | |
| ${{env.compiler == 'clang-17' && '[[ $STANDARD == 23 ]] && continue # clang-17 + c++23 is excluded.' || ''}} | |
| echo "::group::Build with c++$STANDARD" | |
| rm -r cmake-build &> /dev/null || true | |
| cmake "${FLAGS[@]}" -DCMAKE_CXX_STANDARD=$STANDARD || { echo "::error::CMake failed with c++$STANDARD $@"; RESULT=1; } | |
| cmake --build cmake-build || { echo "::error::Build failed with c++$STANDARD $@"; RESULT=1; } | |
| ${{matrix.env.modules && 'ls cmake-build/include/CMakeFiles | grep VulkanMemoryAllocator-HppModule &> /dev/null || \'}} | |
| ${{matrix.env.modules && '{ echo "::error::VulkanMemoryAllocator-HppModule was not built for c++$STANDARD $@"; RESULT=1; }'}} | |
| echo "::endgroup::" | |
| done | |
| exit $RESULT | |
| EOF | |
| chmod +x build | |
| echo . >> $GITHUB_PATH | |
| - if: ${{!cancelled()}} | |
| run: build ${{env.vk || env.modules && 'v1.4.344' || 'v1.4.327'}} | |
| - if: ${{!cancelled()}} | |
| run: build ${{env.vk || env.modules && 'v1.4.344' || 'v1.4.327'}} -DVULKAN_HPP_NO_EXCEPTIONS | |
| - if: ${{!cancelled()}} | |
| run: build ${{env.vk || env.modules && 'v1.4.344' || 'v1.4.327'}} -DVULKAN_HPP_NO_SMART_HANDLE | |
| - if: ${{!cancelled()}} | |
| run: build ${{env.vk || env.modules && 'v1.4.344' || 'v1.4.327'}} -DVULKAN_HPP_USE_REFLECT -DVULKAN_HPP_HANDLES_MOVE_EXCHANGE | |
| - if: ${{!cancelled()}} | |
| run: build ${{env.vk || env.modules && 'v1.4.344' || 'v1.4.327'}} -DVULKAN_HPP_TYPESAFE_CONVERSION=0 |