-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to enable mkvk targets (VkFormat-related file generation). (…
…#840) The option defaults to OFF. Only project developers need to regenerate these files. Fixes #834. Other included related fixes: * Modify mkvkformatfiles to write CRLF on Windows. * Stop using unix2dos in mkvk custom commands and remove near duplicate WIN32 custom commands. Developers must ensure they use a Windows native Perl to get the correct line endings when generating dfdutils' `*.inl` files. * Generate dfdutils .inl files from vulkan_core not vkformat_enum to remove dependency on the latter's generation. * Add CI jobs to test generation on all platforms since main builds will no longer be building those targets. Unrelated fixes: * Set `HOMEBREW_NO_AUTO_UPDATE` for macOS Travis CI jobs to finally stop the auto update and shave more than 1 hour off the total build time. * Bracket the whole `script` section of `.travis.yml` with `set -e` and `set +e` instead of piecemeal in various `if` clauses.
- Loading branch information
1 parent
7dedd7e
commit e77a531
Showing
7 changed files
with
324 additions
and
204 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright 2024 The Khronos Group Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
<# | ||
.SYNOPSIS | ||
Check generation of VkFormat related files. | ||
.DESCRIPTION | ||
Regenerates all VkFormat related files and compares them with the | ||
version in Git. Used to verify correct functioning of the generation | ||
scripts in CI. | ||
.INPUTS | ||
None | ||
.OUTPUTS | ||
None | ||
#> | ||
|
||
param ( | ||
# Default of $null results in an empty string when not set, so be explicit. | ||
[string] $BUILD_DIR = "" | ||
# With positional parameters, BUILD_DIR will be $null if no parameter. | ||
# [Parameter(Position=0)] [string[]]$BUILD_DIR | ||
) | ||
|
||
function Get-ParamValue { | ||
<# | ||
.SYNOPSIS | ||
Get a parameter value. | ||
.DESCRIPTION | ||
Returns one of the following in this priority order: | ||
1. Value set on command line, if any. | ||
2. Value from same-named environment variable, if any | ||
3. $DefaultValue param. | ||
#> | ||
param ( $ParamName, $DefaultValue ) | ||
$res = get-variable $ParamName -ValueOnly -ErrorAction 'SilentlyContinue' | ||
if ($res -eq "" -or $res -eq $null) { | ||
$res = [Environment]::GetEnvironmentVariable($ParamName) | ||
if ($res -eq $null) { | ||
$res = $DefaultValue | ||
} | ||
} | ||
return $res | ||
} | ||
|
||
$BUILD_DIR = Get-ParamValue BUILD_DIR "build/checkmkvk" | ||
|
||
cmake . -B $BUILD_DIR -D KTX_FEATURE_TESTS=OFF -D KTX_FEATURE_TOOLS=OFF -D KTX_GENERATE_VK_FILES=ON | ||
# Clean first is to ensure all files are generated so everything is tested. | ||
cmake --build $BUILD_DIR --target mkvk --clean-first | ||
rm $BUILD_DIR -Recurse -Confirm:$false | ||
# Verify no files were modified. Exit with 1, if so. | ||
git diff --quiet HEAD | ||
if (!$?) { | ||
git status | ||
git diff | ||
exit 1 | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#! /usr/bin/env bash | ||
# Copyright 2024 The Khronos Group Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Check generation of VkFormat related files. | ||
# | ||
# Regenerates all VkFormat related files and compares them with the | ||
# version in Git. Used to verify correct functioning of the generation | ||
# scripts in CI. | ||
|
||
BUILD_DIR=${BUILD_DIR:-build/checkmkvk} | ||
|
||
cmake . -B $BUILD_DIR -D KTX_FEATURE_TESTS=OFF -D KTX_FEATURE_TOOLS=OFF -D KTX_GENERATE_VK_FILES=ON | ||
# Clean first is to ensure all files are generated so everything is tested. | ||
cmake --build $BUILD_DIR --target mkvk --clean-first | ||
rm -rf $BUILD_DIR | ||
# Verify no files were modified. Exit with 1, if so. | ||
if ! git diff --quiet HEAD; then | ||
git status | ||
git diff | ||
exit 1 | ||
fi |
Oops, something went wrong.