forked from malte-v/VulkanMemoryAllocator-Hpp
-
Notifications
You must be signed in to change notification settings - Fork 41
129 lines (128 loc) · 6.52 KB
/
build-custom-vulkan.yml
File metadata and controls
129 lines (128 loc) · 6.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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.345' || 'v1.4.345'}} -DVULKAN_HPP_TYPESAFE_CONVERSION=0