Skip to content

Samples: Prioritize Vulkan-Hpp include directory #93

Samples: Prioritize Vulkan-Hpp include directory

Samples: Prioritize Vulkan-Hpp include directory #93

Workflow file for this run

name: CI Build
on:
pull_request:
branches: [ main ]
jobs:
build:
name: ${{matrix.env.modules && '[modules] ' || ' '}}${{matrix.env.os}} ${{matrix.env.arch}}, ${{matrix.env.gen}}, ${{matrix.env.cxx && matrix.env.cxx || 'default'}}
runs-on: ${{matrix.env.os}}
defaults:
run:
shell: bash
strategy:
matrix:
env: [
{ os: macos-14, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: macos-15, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: macos-26, cxx: clang++, c: clang, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-22.04, cxx: g++-10, c: gcc-10, arch: x64, gen: Ninja, cxx_max: 17 },
{ os: ubuntu-22.04, cxx: g++-11, c: gcc-11, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-22.04, cxx: clang++-13, c: clang-13, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-22.04, cxx: clang++-14, c: clang-14, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-22.04, cxx: clang++-15, c: clang-15, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-24.04, cxx: g++-12, c: gcc-12, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-24.04, cxx: g++-13, c: gcc-13, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-24.04, cxx: g++-14, c: gcc-14, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: ubuntu-24.04, cxx: clang++-16, c: clang-16, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-24.04, cxx: clang++-17, c: clang-17, arch: x64, gen: Ninja, cxx_max: 20 },
{ os: ubuntu-24.04, cxx: clang++-18, c: clang-18, arch: x64, gen: Ninja, cxx_max: 23 },
{ os: windows-2022, cxx: cl, c: cl, arch: x86, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2022, cxx: cl, c: cl, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2022, cxx: clang-cl, c: clang-cl, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: windows-2022, cxx: c++, c: cc, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2025, cxx: cl, c: cl, arch: x86, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2025, cxx: cl, c: cl, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: windows-2025, cxx: clang-cl, c: clang-cl, arch: x64, gen: Ninja, cxx_max: 23 },
# { os: windows-2025, cxx: c++, c: cc, arch: x64, gen: Visual Studio 17 2022, cxx_max: 23 },
{ os: macos-26, cxx: /opt/homebrew/opt/llvm/bin/clang++, c: /opt/homebrew/opt/llvm/bin/clang, arch: x64, gen: Ninja, modules: true, cxx_max: 23, 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++' },
{ os: ubuntu-24.04, cxx: clang++-21, c: clang-21, arch: x64, gen: Ninja, modules: true, cxx_max: 23, cxx_flags: '-stdlib=libc++', linker_flags: '-stdlib=libc++ -lc++abi' },
{ os: windows-2025, cxx: cl, c: cl , arch: x64, gen: Ninja, modules: true, cxx_max: 23, cxx_flags: '//EHsc' },
]
env:
VAR_CMAKE_FLAGS: |
${{ matrix.env.c && format('-D CMAKE_C_COMPILER={0}', matrix.env.c) }} \
${{ matrix.env.cxx && format('-D CMAKE_CXX_COMPILER={0}', matrix.env.cxx) }} \
${{ matrix.env.cxx_flags && format('-D CMAKE_CXX_FLAGS''={0}''', matrix.env.cxx_flags) }} \
${{ matrix.env.linker_flags && format('-D CMAKE_EXE_LINKER_FLAGS=''{0}''', matrix.env.linker_flags) }} \
steps:
- name: Checkout
uses: actions/checkout@v5.0.0
with:
submodules: recursive
# Setups for each OS
- name: Setup Windows
if: contains(matrix.env.os, 'windows')
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: ${{matrix.env.arch}}
- name: Setup Ubuntu
if: contains(matrix.env.os, 'ubuntu')
run: sudo apt update && sudo apt install libgl-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev
- name: Setup MacOS
if: contains(matrix.env.os, 'macos')
run: brew install clang-format molten-vk
# Additional setups for module testing
- name: Setup Modules (CMake, Ninja)
if: matrix.env.modules && contains(matrix.env.gen, 'Ninja')
uses: lukka/get-cmake@latest
with:
cmakeVersion: 4.1.2
ninjaVersion: latest
- name: Setup Modules (Ubuntu)
if: matrix.env.modules && contains(matrix.env.os, 'ubuntu')
run: |
sudo apt-get update && sudo apt-get install lsb-release gpg software-properties-common wget
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 21 all
sudo ln -s /lib/llvm-21/share /lib/share
- name: Setup Modules (MacOS)
if: matrix.env.modules && contains(matrix.env.os, 'macos')
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
# Build generator (C++20) and generate headers.
- name: Generate Headers with C++20
run: |
for BUILD_TYPE in Debug Release; do
[ $BUILD_TYPE = Release ] && PRESET="generator-run" || PRESET="generator-build"
cmake -B build -G '${{matrix.env.gen}}' --fresh --preset $PRESET \
${{ env.VAR_CMAKE_FLAGS }} \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --config $BUILD_TYPE --clean-first
done
# Build samples using highest available C++ standard.
- name: Build Samples with C++${{matrix.env.cxx_max}}
if: (!matrix.env.modules) # Exclude module runners.
run: |
for BUILD_TYPE in Debug Release; do
cmake -B build -G '${{matrix.env.gen}}' --fresh --preset samples \
${{ env.VAR_CMAKE_FLAGS }} \
-D CMAKE_CXX_STANDARD=${{matrix.env.cxx_max}} \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build build --parallel --config $BUILD_TYPE --clean-first
done
# Run all unit tests with C++11 to maximum support C++ version.
# Module runners ignore all versions below C++23
- name: Build Tests with C++11 to C++${{matrix.env.cxx_max}}
run: |
for CXX_STANDARD in 11 14 17 20 23; do
for BUILD_TYPE in Debug Release; do
# do not compile C++ version outside of current compiler's capabilities
if [ $CXX_STANDARD -gt ${{matrix.env.cxx_max}} ]; then
continue
fi
# runners for modules only need to test C++23 and up, so ignore the rest
if [ $CXX_STANDARD -lt 23 ] && ${{matrix.env.modules && true || false}}; then
continue
fi
echo "================================================================================="
echo "Building C++$CXX_STANDARD in $BUILD_TYPE"
echo "================================================================================="
cmake -B build -G '${{matrix.env.gen}}' --fresh --preset tests \
-D VULKAN_HPP_BUILD_CXX_MODULE=${{matrix.env.modules && 'ON' || 'OFF'}} \
${{ env.VAR_CMAKE_FLAGS }} \
-D CMAKE_CXX_STANDARD=$CXX_STANDARD \
-D CMAKE_BUILD_TYPE=$BUILD_TYPE \
${{matrix.env.modules && '-DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=d0edc3af-4c50-42ea-a356-e2862fe7a444' || ''}}
cmake --build build --parallel --config $BUILD_TYPE --clean-first
ctest -j --output-on-failure --test-dir build -C $BUILD_TYPE
done
done