Skip to content

Towards fixing everything. #361

Towards fixing everything.

Towards fixing everything. #361

name: "Build (GCC/Clang/MSVC)"
on:
push:
paths:
- 'cmake/**'
- 'examples/**'
- 'external/**'
- 'framework/**'
- 'CMakeLists.txt'
pull_request:
workflow_dispatch:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
linux:
name: ${{ matrix.config.name }}, VulkanSDK ${{ matrix.vulkan-sdk }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
config:
#- {
# name: "linux: clang",
# cc: "clang",
# cxx: "clang++"
#}
- {
name: "linux: gcc",
cc: "gcc-13",
cxx: "g++-13"
}
# note: if a specific vulkan version (e.g. 1.1.x, or < 1.2.135) needs testing, you can add it here:
# (not that ubuntu-latest (20.04) only supports >= v1.2.148 via apt)
vulkan-sdk: ["latest", "1.3.216"]
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create Build Environment
shell: bash
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: |
# Add lunarg apt sources
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
if [ "${{ matrix.vulkan-sdk }}" = "latest" ]; then
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-focal.list https://packages.lunarg.com/vulkan/lunarg-vulkan-focal.list
else
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-${{ matrix.vulkan-sdk }}-focal.list https://packages.lunarg.com/vulkan/${{ matrix.vulkan-sdk }}/lunarg-vulkan-${{ matrix.vulkan-sdk }}-focal.list
fi
# For GCC-13
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/ppa
# Update package lists
sudo apt-get update -qq
# Install dependencies
sudo apt-get install -y \
vulkan-sdk \
libassimp-dev \
xorg-dev \
g++-13 \
gcc-13
# clang does not yet (<= 12) support "Down with typename" (P0634R3), which is used in libstdc++ >= 11 in the ranges-header
if [ "${{ matrix.config.cc }}" = "clang" ]; then
sudo apt remove libgcc-11-dev gcc-11
fi
cmake -E make_directory ${{ runner.workspace }}/build
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{ runner.workspace }}/build
run: |
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
cmake \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-Davk_toolkit_BuildHelloWorld=ON \
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF \
-DASSIMP_BUILD_TESTS=OFF \
-DINJECT_DEBUG_POSTFIX=OFF \
-DGLFW_BUILD_EXAMPLES=OFF \
-DGLFW_BUILD_TESTS=OFF \
-DGLFW_BUILD_DOCS=OFF \
-DGLFW_INSTALL=OFF \
$GITHUB_WORKSPACE
- name: Build
shell: bash
working-directory: ${{ runner.workspace }}/build
run: cmake --build .
windows:
name: ${{ matrix.config.name }}, windows-2019, VulkanSDK ${{ matrix.vulkan-sdk }}
runs-on: windows-2019
env:
vulkan_sdk: "$GITHUB_WORKSPACE/vulkan_sdk/"
strategy:
fail-fast: false
matrix:
config:
- {
name: "windows: msvc",
cc: "cl",
cxx: "cl"
}
# note: if a specific vulkan version needs testing, you can add it here:
vulkan-sdk: ["latest", "1.3.204.1"]
steps:
# IMPORTANT: apparently checkout@v3 pulls to ${{ github.event.repository.name }}/${{ github.event.repository.name }} instead of just ${{ github.event.repository.name }} on windows
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create Build Environment
working-directory: ${{ runner.workspace }}/${{ github.event.repository.name }}
shell: pwsh
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: |
If ('${{ matrix.vulkan-sdk }}' -eq 'latest') {
# the download URL for the latest SDK version changes sometimes (every four months or so?)...
curl -LS -o vulkan-sdk.exe https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe
} Else {
curl -LS -o vulkan-sdk.exe https://sdk.lunarg.com/sdk/download/${{ matrix.vulkan-sdk }}/windows/VulkanSDK-${{ matrix.vulkan-sdk }}-Installer.exe
}
7z x vulkan-sdk.exe -o"${{ env.vulkan_sdk }}"
mkdir "${{ env.vulkan_sdk }}Include/vma/"
curl -LS -o "${{ env.vulkan_sdk }}Include/vma/vk_mem_alloc.h" https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/blob/master/include/vk_mem_alloc.h?raw=true
cmake -E make_directory ${{ runner.workspace }}/${{ github.event.repository.name }}/build
- name: Configure CMake
shell: pwsh
working-directory: ${{ runner.workspace }}/${{ github.event.repository.name }}/build
run: |
$env:CC="${{ matrix.config.cc }}"
$env:CXX="${{ matrix.config.cxx }}"
$env:Path += ";${{ env.vulkan_sdk }}\;${{ env.vulkan_sdk }}\Bin\"
$env:VULKAN_SDK="${{ env.vulkan_sdk }}"
$env:Vulkan_LIBRARY="${{ env.vulkan_sdk }}/Bin"
$env:Vulkan_INCLUDE_DIR="${{ env.vulkan_sdk }}/Include"
cmake `
-DCMAKE_BUILD_TYPE=$BUILD_TYPE `
-Davk_toolkit_BuildHelloWorld=ON `
${{ runner.workspace }}/${{ github.event.repository.name }} -G "Visual Studio 16 2019" -A x64
- name: Build
shell: bash
working-directory: ${{ runner.workspace }}/${{ github.event.repository.name }}/build
run: VULKAN_SDK=${{ env.vulkan_sdk }} cmake --build . --config $BUILD_TYPE
windows-latest:
name: ${{ matrix.config.name }}, windows-latest, VulkanSDK ${{ matrix.vulkan-sdk }}
runs-on: windows-latest
env:
vulkan_sdk: "$GITHUB_WORKSPACE/vulkan_sdk/"
strategy:
fail-fast: false
matrix:
config:
- {
name: "windows: msvc",
cc: "cl",
cxx: "cl"
}
# note: if a specific vulkan version needs testing, you can add it here:
vulkan-sdk: ["latest", "1.3.204.1"]
steps:
# IMPORTANT: apparently checkout@v3 pulls to ${{ github.event.repository.name }}/${{ github.event.repository.name }} instead of just ${{ github.event.repository.name }} on windows
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create Build Environment
working-directory: ${{ runner.workspace }}/${{ github.event.repository.name }}
shell: pwsh
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: |
If ('${{ matrix.vulkan-sdk }}' -eq 'latest') {
# the download URL for the latest SDK version changes sometimes (every four months or so?)...
curl -LS -o vulkan-sdk.exe https://sdk.lunarg.com/sdk/download/latest/windows/vulkan-sdk.exe
} Else {
curl -LS -o vulkan-sdk.exe https://sdk.lunarg.com/sdk/download/${{ matrix.vulkan-sdk }}/windows/VulkanSDK-${{ matrix.vulkan-sdk }}-Installer.exe
}
7z x vulkan-sdk.exe -o"${{ env.vulkan_sdk }}"
mkdir "${{ env.vulkan_sdk }}Include/vma/"
curl -LS -o "${{ env.vulkan_sdk }}Include/vma/vk_mem_alloc.h" https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator/blob/master/include/vk_mem_alloc.h?raw=true
cmake -E make_directory ${{ runner.workspace }}/${{ github.event.repository.name }}/build
- name: Configure CMake
shell: pwsh
working-directory: ${{ runner.workspace }}/${{ github.event.repository.name }}/build
run: |
$env:CC="${{ matrix.config.cc }}"
$env:CXX="${{ matrix.config.cxx }}"
$env:VULKAN_SDK="${{ env.vulkan_sdk }}"
$env:Vulkan_LIBRARY="${{ env.vulkan_sdk }}/Bin"
$env:Vulkan_INCLUDE_DIR="${{ env.vulkan_sdk }}/Include"
$env:Path += ";${{ env.vulkan_sdk }}\;${{ env.vulkan_sdk }}\Bin\"
cmake `
-DCMAKE_BUILD_TYPE=$BUILD_TYPE `
-Davk_toolkit_BuildHelloWorld=ON `
${{ runner.workspace }}/${{ github.event.repository.name }} -G "Visual Studio 17 2022" -A x64
- name: Build
shell: bash
working-directory: ${{ runner.workspace }}/${{ github.event.repository.name }}/build
run: cmake --build . --config $BUILD_TYPE