Add ktx
This commit is contained in:
Executable
+71
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Runs at before_script stage of a Travis-CI build.
|
||||
|
||||
# exit if any command fails
|
||||
set -e
|
||||
|
||||
# No certs so we're building either a PR or a fork.
|
||||
if [ -z "$MACOS_CERTIFICATES_P12" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
KEY_CHAIN=build.keychain
|
||||
KEY_PASS=mysecretpassword
|
||||
MACOS_CERTS_TMPFILE=macOS_certificates.p12
|
||||
# All other env vars used here are encrypted env vars set in the Travis
|
||||
# settings.
|
||||
|
||||
# Set up a keychain for signing certificates
|
||||
security create-keychain -p $KEY_PASS $KEY_CHAIN
|
||||
security default-keychain -s $KEY_CHAIN
|
||||
# Turn off timeout that re-locks the keychain to avoid risk of build
|
||||
# taking longer than whatever timeout is set (default is 300s).
|
||||
security set-keychain-settings -u $KEY_CHAIN
|
||||
security unlock-keychain -p $KEY_PASS $KEY_CHAIN
|
||||
|
||||
# Import the macOS certificates
|
||||
#
|
||||
# $MACOS_CERTIFICATES_P12 holds a base64 encoded version of the .p12 file
|
||||
# created by Keychain Access with the exported application and installer
|
||||
# certificates.
|
||||
#
|
||||
# $MACOS_CERTIFICATES_PASSWORD is the password created for the .p12 file when
|
||||
# it was exported.
|
||||
#
|
||||
echo $MACOS_CERTIFICATES_P12 | base64 --decode > $MACOS_CERTS_TMPFILE
|
||||
# In CI (macOS 12.6) `security` prints a bunch of "attribute" info when
|
||||
# importing. I have been unable to find out if it is a security risk.
|
||||
# -q does not squelch it. macOS 14.6 `security` does not do this.
|
||||
#
|
||||
security import $MACOS_CERTS_TMPFILE -k $KEY_CHAIN -P $MACOS_CERTIFICATES_PASSWORD -T /usr/bin/codesign -T /usr/bin/productbuild
|
||||
rm $MACOS_CERTS_TMPFILE
|
||||
|
||||
# Allow Apple tools access to signing certs in the keychain. Both this and
|
||||
# an unlocked keychain are needed for access.
|
||||
#
|
||||
security set-key-partition-list -S apple-tool:,apple: -s -k $KEY_PASS $KEY_CHAIN
|
||||
|
||||
# Add altool-specific password for notarization
|
||||
#
|
||||
# This is the altool-specific password created in the Apple developer account
|
||||
# to be used for notarization, the same account that was used to created the
|
||||
# signing certificates imported above.
|
||||
#
|
||||
# $APPLE_ID is the id of the developer account.
|
||||
#
|
||||
# $ALTOOL_PW_LABEL is a label given to the password. This is used later by
|
||||
# `altool` to find the password when submitting the notarization request.
|
||||
#
|
||||
# $ALTOOL_PW is the actual password. -w must NOT be the last option. If so
|
||||
# it will incorrectly interpret $ALTOOL_PW as the keychain name and will
|
||||
# prompt for a password!
|
||||
#
|
||||
security add-generic-password -a $APPLE_ID -T $(xcrun -find altool) -w $ALTOOL_PASSWORD -l $ALTOOL_PW_LABEL -s $ALTOOL_PW_LABEL
|
||||
|
||||
# Verify it is there
|
||||
security find-generic-password -l $ALTOOL_PW_LABEL
|
||||
|
||||
# vim:ai:ts=4:sts=2:sw=2:expandtab
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2020 Andreas Atteneder
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -e
|
||||
|
||||
# Fallback to arm64-v8a
|
||||
ANDROID_ABI=${ANDROID_ABI:-'arm64-v8a'}
|
||||
ASTCENC_ISA=${ASTCENC_ISA:-'ASTCENC_ISA_NONE=ON'}
|
||||
|
||||
CONFIGURATION=${CONFIGURATION:-Release}
|
||||
WERROR=${WERROR:-OFF}
|
||||
|
||||
if [ "$CONFIGURATION" = "Debug" ]; then
|
||||
BUILD_DIR="build-android-$ANDROID_ABI-Debug"
|
||||
INSTALL_DIR="install-android-debug/$ANDROID_ABI"
|
||||
else
|
||||
BUILD_DIR="build-android-$ANDROID_ABI"
|
||||
INSTALL_DIR="install-android/$ANDROID_ABI"
|
||||
fi
|
||||
|
||||
# You need to set the following environment variables first
|
||||
# ANDROID_NDK= <Path to Android NDK>
|
||||
|
||||
cmake_args=("-G" "Ninja" \
|
||||
"-B" "$BUILD_DIR" \
|
||||
"-D" "ANDROID_PLATFORM=android-24" \
|
||||
"-D" "ANDROID_ABI=$ANDROID_ABI" \
|
||||
"-D" "ANDROID_NDK=$ANDROID_NDK" \
|
||||
"-D" "CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake" \
|
||||
"-D" "CMAKE_BUILD_TYPE=$CONFIGURATION" \
|
||||
"-D" "BASISU_SUPPORT_SSE=OFF" \
|
||||
"-D" "${ASTCENC_ISA}"
|
||||
"-D" "KTX_FEATURE_TESTS=OFF"
|
||||
"-D" "KTX_WERROR=$WERROR"
|
||||
)
|
||||
|
||||
config_display="Configure KTX-Software (Android $ANDROID_ABI $CONFIGURATION): "
|
||||
for arg in "${cmake_args[@]}"; do
|
||||
case $arg in
|
||||
"-G") config_display+="Generator=" ;;
|
||||
"-B") config_display+="Build Dir=" ;;
|
||||
"-D") ;;
|
||||
*) config_display+="$arg, " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo ${config_display%??}
|
||||
cmake . "${cmake_args[@]}"
|
||||
|
||||
pushd "$BUILD_DIR"
|
||||
|
||||
echo "Build KTX-Software (Android $ANDROID_ABI $CONFIGURATION)"
|
||||
cmake --build . --config $CONFIGURATION -j
|
||||
# echo "Test KTX-Software (Android $ANDROID_ABI Release)"
|
||||
# ctest --output-on-failure -C $CONFIGURATION # --verbose
|
||||
echo "Install KTX-Software (Android $ANDROID_ABI $CONFIGURATION)"
|
||||
cmake --install . --config $CONFIGURATION --prefix ../$INSTALL_DIR
|
||||
|
||||
popd
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2020 Andreas Atteneder
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -e
|
||||
|
||||
# Fallback to arm64-v8a
|
||||
ANDROID_ABI=${ANDROID_ABI:-'arm64-v8a'}
|
||||
ASTCENC_ISA=${ASTCENC_ISA:-'ASTCENC_ISA_NONE=ON'}
|
||||
|
||||
BUILD_DIR="build-android-$ANDROID_ABI-debug"
|
||||
|
||||
# You need to set the following environment variables first
|
||||
# ANDROID_NDK= <Path to Android NDK>
|
||||
|
||||
cmake_args=("-G" "Ninja" \
|
||||
"-B" "$BUILD_DIR" \
|
||||
"-D" "ANDROID_PLATFORM=android-24" \
|
||||
"-D" "ANDROID_ABI=$ANDROID_ABI" \
|
||||
"-D" "ANDROID_NDK=$ANDROID_NDK" \
|
||||
"-D" "CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake" \
|
||||
"-D" "CMAKE_BUILD_TYPE=Debug" \
|
||||
"-D" "BASISU_SUPPORT_SSE=OFF" \
|
||||
"-D" "${ASTCENC_ISA}"
|
||||
)
|
||||
|
||||
config_display="Configure KTX-Software (Android $ANDROID_ABI Debug): "
|
||||
for arg in "${cmake_args[@]}"; do
|
||||
case $arg in
|
||||
"-G") config_display+="Generator=" ;;
|
||||
"-B") config_display+="Build Dir=" ;;
|
||||
"-D") ;;
|
||||
*) config_display+="$arg, " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo ${config_display%??}
|
||||
cmake . "${cmake_args[@]}"
|
||||
|
||||
pushd "$BUILD_DIR"
|
||||
|
||||
echo "Build KTX-Software (Android $ANDROID_ABI Debug)"
|
||||
cmake --build . --config Debug -j
|
||||
# echo "Test KTX-Software (Android $ANDROID_ABI Debug)"
|
||||
# ctest --output-on-failure -C Debug # --verbose
|
||||
echo "Install KTX-Software (Android $ANDROID_ABI Debug)"
|
||||
cmake --install . --config Debug --prefix ../install-android-debug/$ANDROID_ABI
|
||||
|
||||
popd
|
||||
Executable
+120
@@ -0,0 +1,120 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Build for iOS with Xcode.
|
||||
|
||||
# Exit if any command fails.
|
||||
set -e
|
||||
|
||||
# Set parameters from command-line arguments, if any. This is designed
|
||||
# to handle args of the form PARAM=value or PARAM="value1 value2 ...".
|
||||
# Any other form of CL args must be handled first.
|
||||
for i in "$@"; do
|
||||
eval $i
|
||||
done
|
||||
|
||||
# Set defaults
|
||||
ARCH=${ARCH:-$(uname -m)}
|
||||
CONFIGURATION=${CONFIGURATION:-Release}
|
||||
FEATURE_DOC=${FEATURE_DOC:-OFF}
|
||||
FEATURE_JNI=${FEATURE_JNI:-OFF}
|
||||
FEATURE_PY=${FEATURE_PY:-OFF}
|
||||
FEATURE_LOADTESTS=${FEATURE_LOADTESTS:-OpenGL+Vulkan}
|
||||
FEATURE_TESTS=${FEATURE_TESTS:-OFF}
|
||||
FEATURE_TOOLS=${FEATURE_TOOLS:-OFF}
|
||||
PACKAGE=${PACKAGE:-NO}
|
||||
SUPPORT_OPENCL=${SUPPORT_OPENCL:-OFF}
|
||||
SUPPORT_SSE=OFF
|
||||
WERROR=${WERROR:-OFF}
|
||||
|
||||
BUILD_DIR=${BUILD_DIR:-build/ios}
|
||||
|
||||
# Ensure that Vulkan SDK's glslc is in PATH
|
||||
export PATH="${VULKAN_SDK}/bin:$PATH"
|
||||
|
||||
# Due to the spaces in the platform names, must use array variables so
|
||||
# destination args can be expanded to a single word.
|
||||
OSX_XCODE_OPTIONS=(-alltargets -destination "platform=OS X,arch=x86_64")
|
||||
IOS_XCODE_OPTIONS=(-alltargets -destination "generic/platform=iOS" -destination "platform=iOS Simulator,OS=latest")
|
||||
XCODE_CODESIGN_ENV='CODE_SIGN_IDENTITY= CODE_SIGN_ENTITLEMENTS= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO'
|
||||
|
||||
if which -s xcpretty ; then
|
||||
function handle_compiler_output() {
|
||||
tee -a fullbuild.log | xcpretty
|
||||
}
|
||||
else
|
||||
function handle_compiler_output() {
|
||||
cat
|
||||
}
|
||||
fi
|
||||
|
||||
# Cause the build pipes below to set the exit to the exit code of the
|
||||
# last program to exit non-zero.
|
||||
set -o pipefail
|
||||
|
||||
#
|
||||
# iOS
|
||||
#
|
||||
|
||||
cmake_args=("-G" "Xcode" "-B" "$BUILD_DIR")
|
||||
if [[ "$FEATURE_LOADTESTS" != "OFF" && -n "$VCPKG_ROOT" ]]; then
|
||||
cmake_args+=(
|
||||
"-D" "CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
|
||||
)
|
||||
fi
|
||||
cmake_args+=( \
|
||||
"-D" "CMAKE_SYSTEM_NAME=iOS" \
|
||||
"-D" "ASTCENC_ISA_NEON=ON" \
|
||||
"-D" "KTX_FEATURE_DOC=$FEATURE_DOC" \
|
||||
"-D" "KTX_FEATURE_JNI=$FEATURE_JNI" \
|
||||
"-D" "KTX_FEATURE_PY=$FEATURE_PY"
|
||||
"-D" "KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS" \
|
||||
"-D" "KTX_FEATURE_TESTS=$FEATURE_TESTS" \
|
||||
"-D" "KTX_FEATURE_TOOLS=$FEATURE_TOOLS" \
|
||||
"-D" "BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL" \
|
||||
"-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE" \
|
||||
"-D" "KTX_WERROR=$WERROR"
|
||||
)
|
||||
config_display="Configure KTX-Software (iOS): "
|
||||
for arg in "${cmake_args[@]}"; do
|
||||
case $arg in
|
||||
"-G") config_display+="Generator=" ;;
|
||||
"-B") config_display+="Build Dir=" ;;
|
||||
"-D") ;;
|
||||
*) config_display+="$arg, " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo ${config_display%??}
|
||||
cmake . "${cmake_args[@]}"
|
||||
|
||||
pushd $BUILD_DIR
|
||||
|
||||
oldifs=$IFS
|
||||
#; is necessary because `for` is a Special Builtin.
|
||||
IFS=, ; for config in $CONFIGURATION
|
||||
do
|
||||
IFS=$oldifs # Because of ; IFS set above will still be present.
|
||||
echo "Build KTX-Software (iOS $config)"
|
||||
cmake --build . --config $config -- -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO | handle_compiler_output
|
||||
# A simulator build would look like this but note that due to the way vcpkg
|
||||
# manifest mode works, different CMake configurations are needed for
|
||||
# device and simulator. Hence a different BUILD_DIR and separate run
|
||||
# of this script.
|
||||
#echo "Build KTX-Software (iOS Simulator $config)"
|
||||
#cmake --build . --config $config -- -sdk iphonesimulator
|
||||
|
||||
if [ "$config" = "Release" -a "$PACKAGE" = "YES" ]; then
|
||||
echo "Pack KTX-Software (iOS $config)"
|
||||
if ! cpack -C $config; then
|
||||
cat _CPack_Packages/iOS/ZIP/ZipBuildOutput.log
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
popd
|
||||
|
||||
# vim:ai:ts=4:sts=2:sw=2:expandtab
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2021 Shukant Pal
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
echo "Build Java bindings for KTX-Software"
|
||||
echo "LIBKTX_BINARY_DIR " $LIBKTX_BINARY_DIR
|
||||
|
||||
build_libktx_java_dir=interface/java_binding
|
||||
|
||||
pushd $build_libktx_java_dir
|
||||
LIBKTX_BINARY_DIR=$LIBKTX_BINARY_DIR mvn package
|
||||
popd
|
||||
Executable
+176
@@ -0,0 +1,176 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Build on Linux.
|
||||
|
||||
######################################################################
|
||||
# Nota Bene
|
||||
#
|
||||
# Contains untested cross-compilation support that was under
|
||||
# development when Travis-CI made arm64 Ubuntu runners available
|
||||
# rendering it unneeded. Kept here to preserve the learning and in
|
||||
# case it becomes useful.
|
||||
######################################################################
|
||||
|
||||
# Exit if any command fails.
|
||||
set -e
|
||||
|
||||
# cd repo root so script will work whereever the current directory
|
||||
path_to_repo_root=..
|
||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/$path_to_repo_root"
|
||||
|
||||
# Set parameters from command-line arguments, if any.
|
||||
for i in $@; do
|
||||
eval $i
|
||||
done
|
||||
|
||||
# Set some defaults
|
||||
ARCH=${ARCH:-$(uname -m)}
|
||||
CMAKE_GEN=${CMAKE_GEN:-Ninja Multi-Config}
|
||||
CONFIGURATION=${CONFIGURATION:-Release}
|
||||
FEATURE_DOC=${FEATURE_DOC:-OFF}
|
||||
FEATURE_JNI=${FEATURE_JNI:-OFF}
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
FEATURE_LOADTESTS=${FEATURE_LOADTESTS:-OpenGL+Vulkan}
|
||||
else
|
||||
# No Vulkan SDK yet for Linux/arm64.
|
||||
FEATURE_LOADTESTS=${FEATURE_LOADTESTS:-OpenGL}
|
||||
fi
|
||||
FEATURE_PY=${FEATURE_PY:-OFF}
|
||||
FEATURE_TESTS=${FEATURE_TESTS:-ON}
|
||||
FEATURE_TOOLS=${FEATURE_TOOLS:-ON}
|
||||
FEATURE_TOOLS_CTS=${FEATURE_TOOLS_CTS:-ON}
|
||||
FEATURE_GL_UPLOAD=${FEATURE_GL_UPLOAD:-ON}
|
||||
FEATURE_VK_UPLOAD=${FEATURE_VK_UPLOAD:-ON}
|
||||
PACKAGE=${PACKAGE:-NO}
|
||||
SUPPORT_SSE=${SUPPORT_SSE:-ON}
|
||||
SUPPORT_OPENCL=${SUPPORT_OPENCL:-OFF}
|
||||
PY_USE_VENV=${PY_USE_VENV:-OFF}
|
||||
WERROR=${WERROR:-OFF}
|
||||
|
||||
if [[ "$ARCH" = "aarch64" && "$FEATURE_LOADTESTS" =~ "Vulkan" ]]; then
|
||||
if [[ "$FEATURE_LOADTESTS" = "Vulkan" ]]; then
|
||||
FEATURE_LOADTESTS=OFF
|
||||
else
|
||||
FEATURE_LOADTESTS=OpenGL
|
||||
fi
|
||||
echo "$0: Forcing FEATURE_LOADTESTS to \"$FEATURE_LOADTESTS\" as no Vulkan SDK yet for Linux/arm64."
|
||||
fi
|
||||
|
||||
if [ ! "$CMAKE_GEN" = "Ninja Multi-Config" ]; then
|
||||
# Single configuration generator.
|
||||
if [[ "$CONFIGURATION" =~ "," ]]; then
|
||||
echo "$0: Multiple build configurations specified with single-configuration CMake generator."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cmake_args=("-G" "$CMAKE_GEN")
|
||||
|
||||
if [[ -z $BUILD_DIR ]]; then
|
||||
BUILD_DIR=build/linux
|
||||
if [ "$ARCH" != $(uname -m) ]; then
|
||||
BUILD_DIR+="-$ARCH-"
|
||||
fi
|
||||
if [ ! "$CMAKE_GEN" = "Ninja Multi-Config" ]; then
|
||||
# Single configuration generator. That only a single configuration
|
||||
# is specified has already been verified.
|
||||
BUILD_DIR+="-$CONFIGURATION"
|
||||
CMAKE_BUILD_TYPE=$CONFIGURATION
|
||||
fi
|
||||
fi
|
||||
cmake_args+=("-B" $BUILD_DIR)
|
||||
# Just setting the environment variable does not seem to work so pass to cmake.
|
||||
if [[ -n "$VCPKG_INSTALL_OPTIONS" ]]; then
|
||||
cmake_args+=("-D" "VCPKG_INSTALL_OPTIONS=$VCPKG_INSTALL_OPTIONS")
|
||||
fi
|
||||
if [[ "$FEATURE_LOADTESTS" != "OFF" && -n "$VCPKG_ROOT" ]]; then
|
||||
cmake_args+=(
|
||||
"-D" "CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
|
||||
)
|
||||
fi
|
||||
if [ -n "$CMAKE_BUILD_TYPE" ]; then
|
||||
cmake_args+=("-D" "CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE")
|
||||
fi
|
||||
|
||||
mkdir -p $BUILD_DIR
|
||||
|
||||
cmake_args+=(\
|
||||
"-D" "KTX_FEATURE_DOC=$FEATURE_DOC" \
|
||||
"-D" "KTX_FEATURE_JNI=$FEATURE_JNI" \
|
||||
"-D" "KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS" \
|
||||
"-D" "KTX_FEATURE_PY=$FEATURE_PY" \
|
||||
"-D" "KTX_FEATURE_TESTS=$FEATURE_TESTS" \
|
||||
"-D" "KTX_FEATURE_TOOLS=$FEATURE_TOOLS" \
|
||||
"-D" "KTX_FEATURE_TOOLS_CTS=$FEATURE_TOOLS_CTS" \
|
||||
"-D" "KTX_FEATURE_GL_UPLOAD=$FEATURE_GL_UPLOAD" \
|
||||
"-D" "KTX_FEATURE_VK_UPLOAD=$FEATURE_VK_UPLOAD" \
|
||||
"-D" "BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL" \
|
||||
"-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE" \
|
||||
"-D" "KTX_PY_USE_VENV=$PY_USE_VENV" \
|
||||
"-D" "KTX_WERROR=$WERROR"
|
||||
)
|
||||
if [ "$ARCH" != $(uname -m) ]; then
|
||||
cmake_args+=("--toolchain", "cmake/linux-$ARCH-toolchain.cmake")
|
||||
fi
|
||||
config_display="Configure KTX-Software (Linux on $ARCH): "
|
||||
for arg in "${cmake_args[@]}"; do
|
||||
case $arg in
|
||||
"-A") config_display+="Arch=" ;;
|
||||
"-G") config_display+="Generator=" ;;
|
||||
"-B") config_display+="Build Dir=" ;;
|
||||
"-D") ;;
|
||||
"--toolchain") config_display+="Toolchain File=" ;;
|
||||
*) config_display+="$arg, " ;;
|
||||
esac
|
||||
done
|
||||
echo ${config_display%??}
|
||||
cmake . "${cmake_args[@]}"
|
||||
|
||||
pushd $BUILD_DIR
|
||||
|
||||
oldifs=$IFS
|
||||
#; is necessary because `for` is a Special Builtin.
|
||||
IFS=, ; for config in $CONFIGURATION
|
||||
do
|
||||
IFS=$oldifs # Because of ; IFS set above will still be present.
|
||||
# Build and test
|
||||
echo "Build KTX-Software (Linux $ARCH $config)"
|
||||
cmake --build . --config $config
|
||||
if [ "$ARCH" = "$(uname -m)" ]; then
|
||||
echo "Test KTX-Software (Linux $ARCH $config)"
|
||||
ctest --output-on-failure -C $config #--verbose
|
||||
fi
|
||||
if [ "$config" = "Release" -a "$PACKAGE" = "YES" ]; then
|
||||
echo "Pack KTX-Software (Linux $ARCH $config)"
|
||||
if ! cpack -C $config -G DEB; then
|
||||
# The DEB generator does not seem to write any log files.
|
||||
#cat _CPack_Packages/Linux/DEB/DEBOutput.log
|
||||
exit 1
|
||||
fi
|
||||
if ! cpack -C $config -G RPM; then
|
||||
echo "RPM generator .err file"
|
||||
cat _CPack_Packages/Linux/RPM/rpmbuildktx-software.err
|
||||
echo "RPM generator .out file"
|
||||
cat _CPack_Packages/Linux/RPM/rpmbuildktx-software.out
|
||||
exit 1
|
||||
fi
|
||||
if ! cpack -C $config -G TBZ2; then
|
||||
# The TBZ2 generator does not seem to write any log files.
|
||||
# cat _CPack_Packages/Linux/TBZ2/TBZ2Output.log
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
#echo "***** toktx version.h *****"
|
||||
#cat tools/toktx/version.h
|
||||
#echo "****** toktx version ******"
|
||||
#build/linux-release/tools/toktx/toktx --version
|
||||
#echo "***************************"
|
||||
|
||||
popd
|
||||
|
||||
# vim:ai:ts=4:sts=2:sw=2:expandtab
|
||||
|
||||
Executable
+153
@@ -0,0 +1,153 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Build for macOS with Xcode.
|
||||
|
||||
# Exit if any command fails.
|
||||
set -e
|
||||
|
||||
# Travis CI doesn't have JAVA_HOME for some reason
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
echo Setting JAVA_HOME from /usr/libexec/java_home
|
||||
export JAVA_HOME=$(/usr/libexec/java_home)
|
||||
echo JAVA_HOME is $JAVA_HOME
|
||||
fi
|
||||
|
||||
# Set parameters from command-line arguments, if any.
|
||||
for i in $@; do
|
||||
eval $i
|
||||
done
|
||||
|
||||
# Set defaults
|
||||
ARCHS=${ARCHS:-$(uname -m)}
|
||||
CONFIGURATION=${CONFIGURATION:-Release}
|
||||
FEATURE_DOC=${FEATURE_DOC:-OFF}
|
||||
FEATURE_JNI=${FEATURE_JNI:-OFF}
|
||||
FEATURE_LOADTESTS=${FEATURE_LOADTESTS:-OpenGL+Vulkan}
|
||||
FEATURE_PY=${FEATURE_PY:-OFF}
|
||||
FEATURE_TESTS=${FEATURE_TESTS:-ON}
|
||||
FEATURE_TOOLS=${FEATURE_TOOLS:-ON}
|
||||
FEATURE_TOOLS_CTS=${FEATURE_TOOLS_CTS:-ON}
|
||||
PACKAGE=${PACKAGE:-NO}
|
||||
SUPPORT_SSE=${SUPPORT_SSE:-ON}
|
||||
SUPPORT_OPENCL=${SUPPORT_OPENCL:-OFF}
|
||||
PY_USE_VENV=${PY_USE_VENV:-OFF}
|
||||
WERROR=${WERROR:-OFF}
|
||||
|
||||
if [ "$ARCHS" = '(ARCHS_STANDARD)' ]; then
|
||||
BUILD_DIR=${BUILD_DIR:-build/macos-universal}
|
||||
else
|
||||
BUILD_DIR=${BUILD_DIR:-build/macos-$ARCHS}
|
||||
fi
|
||||
|
||||
export VULKAN_SDK=${VULKAN_SDK:-VULKAN_SDK=~/VulkanSDK/1.2.176.1/macOS}
|
||||
|
||||
# Ensure that Vulkan SDK's glslc is in PATH
|
||||
export PATH="${VULKAN_SDK}/bin:$PATH"
|
||||
|
||||
# Due to the spaces in the platform names, must use array variables so
|
||||
# destination args can be expanded to a single word.
|
||||
OSX_XCODE_OPTIONS=(-alltargets -destination "platform=OS X,arch=x86_64")
|
||||
IOS_XCODE_OPTIONS=(-alltargets -destination "generic/platform=iOS" -destination "platform=iOS Simulator,OS=latest")
|
||||
XCODE_NO_CODESIGN_ENV='CODE_SIGN_IDENTITY= CODE_SIGN_ENTITLEMENTS= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO'
|
||||
|
||||
if which -s xcpretty ; then
|
||||
function handle_compiler_output() {
|
||||
tee -a fullbuild.log | xcpretty
|
||||
}
|
||||
else
|
||||
function handle_compiler_output() {
|
||||
cat
|
||||
}
|
||||
fi
|
||||
|
||||
cmake_args=("-G" "Xcode" "-B" "$BUILD_DIR")
|
||||
# Just setting the environment variable does not seem to work so pass to cmake.
|
||||
if [[ -n "$VCPKG_INSTALL_OPTIONS" ]]; then
|
||||
cmake_args+=("-D" "VCPKG_INSTALL_OPTIONS=$VCPKG_INSTALL_OPTIONS")
|
||||
fi
|
||||
if [[ "$FEATURE_LOADTESTS" != "OFF" && -n "$VCPKG_ROOT" ]]; then
|
||||
cmake_args+=(
|
||||
"-D" "CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
|
||||
)
|
||||
fi
|
||||
cmake_args+=( \
|
||||
"-D" "CMAKE_OSX_ARCHITECTURES=$ARCHS" \
|
||||
"-D" "KTX_FEATURE_DOC=$FEATURE_DOC" \
|
||||
"-D" "KTX_FEATURE_JNI=$FEATURE_JNI" \
|
||||
"-D" "KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS" \
|
||||
"-D" "KTX_FEATURE_PY=$FEATURE_PY" \
|
||||
"-D" "KTX_FEATURE_TESTS=$FEATURE_TESTS" \
|
||||
"-D" "KTX_FEATURE_TOOLS=$FEATURE_TOOLS" \
|
||||
"-D" "KTX_FEATURE_TOOLS_CTS=$FEATURE_TOOLS_CTS" \
|
||||
"-D" "KTX_PY_USE_VENV=$PY_USE_VENV" \
|
||||
"-D" "KTX_WERROR=$WERROR" \
|
||||
"-D" "BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL" \
|
||||
"-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE"
|
||||
)
|
||||
if [ "$ARCHS" = "x86_64" ]; then cmake_args+=("-D" "ASTCENC_ISA_SSE41=ON"); fi
|
||||
if [ -n "$CODE_SIGN_IDENTITY" ]; then
|
||||
cmake_args+=( \
|
||||
"-D" "CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_STYLE=Manual" \
|
||||
"-D" "XCODE_CODE_SIGN_IDENTITY=${CODE_SIGN_IDENTITY}" \
|
||||
"-D" "XCODE_DEVELOPMENT_TEAM=${DEVELOPMENT_TEAM}" \
|
||||
"-D" "PRODUCTBUILD_IDENTITY_NAME=${PKG_SIGN_IDENTITY}"
|
||||
)
|
||||
fi
|
||||
config_display="Configure KTX-Software (macOS): "
|
||||
for arg in "${cmake_args[@]}"; do
|
||||
case $arg in
|
||||
"-G") config_display+="Generator=" ;;
|
||||
"-B") config_display+="Build Dir=" ;;
|
||||
"-D") ;;
|
||||
*) config_display+="$arg, " ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo ${config_display%??}
|
||||
cmake . "${cmake_args[@]}"
|
||||
|
||||
# Cause the build pipes below to set the exit to the exit code of the
|
||||
# last program to exit non-zero.
|
||||
set -o pipefail
|
||||
|
||||
pushd $BUILD_DIR
|
||||
|
||||
oldifs=$IFS
|
||||
#; is necessary because `for` is a Special Builtin.
|
||||
IFS=, ; for config in $CONFIGURATION
|
||||
do
|
||||
IFS=$oldifs # Because of ; IFS set above will still be present.
|
||||
# Build and test
|
||||
#if [ "$config" = "Debug" ]; then continue; fi
|
||||
echo "Build KTX-Software (macOS $ARCHS $config)"
|
||||
if [ -n "$CODE_SIGN_IDENTITY" -a "$config" = "Release" ]; then
|
||||
cmake --build . --config $config | handle_compiler_output
|
||||
else
|
||||
cmake --build . --config $config -- $XCODE_NO_CODESIGN_ENV | handle_compiler_output
|
||||
fi
|
||||
|
||||
# Rosetta 2 should let x86_64 tests run on an Apple Silicon Mac hence the -o.
|
||||
if [ "$ARCHS" = "$(uname -m)" -o "$ARCHS" = "x64_64" ]; then
|
||||
echo "Test KTX-Software (macOS $ARCHS $config)"
|
||||
ctest --output-on-failure -C $config # --verbose
|
||||
fi
|
||||
|
||||
if [ "$config" = "Release" -a "$PACKAGE" = "YES" ]; then
|
||||
echo "Pack KTX-Software (macOS $ARCHS $config)"
|
||||
if ! cpack -C $config -G productbuild; then
|
||||
cat _CPack_Packages/Darwin/productbuild/ProductBuildOutput.log
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
#echo "***** toktx version.h *****"
|
||||
#pwd
|
||||
#cat ../tools/toktx/version.h
|
||||
#echo "****** toktx version ******"
|
||||
#Release/toktx --version
|
||||
#echo "***************************"
|
||||
|
||||
popd
|
||||
Executable
+155
@@ -0,0 +1,155 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Build WebAssembly with Emscripten in Docker.
|
||||
|
||||
# Exit if any command fails.
|
||||
set -e
|
||||
|
||||
docker_running=0
|
||||
rm_container=0
|
||||
|
||||
function atexit () {
|
||||
if [ $docker_running -eq 0 ]; then
|
||||
docker stop emscripten > /dev/null
|
||||
# By default keep the container as it now has a populated emscripten cache.
|
||||
if [ $rm_container -eq 1 ]; then
|
||||
docker rm emscripten > /dev/null
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $0 [Option] [PARAMETER=value] [target...]"
|
||||
echo ""
|
||||
echo "Build KTX-Software using Emscripten docker package."
|
||||
echo "Defaults to building everything (Release config) if no targets specified."
|
||||
echo "Options:"
|
||||
echo " --help, -h Print this usage message."
|
||||
echo " --remove-container, -r Remove docker container when finished."
|
||||
echo " --verbose ,-v Cause the underlying make to run in verbose mode."
|
||||
exit $1
|
||||
}
|
||||
|
||||
# cd repo root so script will work whereever the current directory
|
||||
path_to_repo_root=..
|
||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/$path_to_repo_root"
|
||||
|
||||
for arg in $@; do
|
||||
case $arg in
|
||||
--help | -h)
|
||||
usage 0
|
||||
;;
|
||||
--remove-container | -r)
|
||||
rm_container=1
|
||||
shift
|
||||
;;
|
||||
--verbose | -v)
|
||||
verbose_make="-- VERBOSE=1"
|
||||
shift
|
||||
;;
|
||||
*\=*)
|
||||
# Set parameter from command-line arguments
|
||||
eval $arg
|
||||
shift ;;
|
||||
*)
|
||||
targets="$targets --target $arg"
|
||||
shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Set defaults
|
||||
CONFIGURATION=${CONFIGURATION:-Release}
|
||||
FEATURE_DOC=${FEATURE_DOC:-OFF}
|
||||
FEATURE_JNI=${FEATURE_JNI:-OFF}
|
||||
FEATURE_LOADTESTS=${FEATURE_LOADTESTS:-OpenGL}
|
||||
FEATURE_PY=${FEATURE_PY:-OFF}
|
||||
FEATURE_TESTS=${FEATURE_TESTS:-OFF}
|
||||
FEATURE_TOOLS=${FEATURE_TOOLS:-OFF}
|
||||
PACKAGE=${PACKAGE:-NO}
|
||||
SUPPORT_SSE=OFF
|
||||
SUPPORT_OPENCL=${SUPPORT_OPENCL:-OFF}
|
||||
WERROR=${WERROR:-OFF}
|
||||
|
||||
BUILD_DIR=${BUILD_DIR:-build/web-$CONFIGURATION}
|
||||
|
||||
trap atexit EXIT SIGINT
|
||||
|
||||
# Check emscripten container status.
|
||||
if ! container_status="$(docker container inspect -f '{{.State.Status}}' emscripten 2> /dev/null)"; then
|
||||
# `inspect` failed therefore no docker container. Create one.
|
||||
|
||||
# In the event that /src in docker ends up having the same owner as
|
||||
# the repo (cwd) on the docker host, which is presumably the user running
|
||||
# this script, it is necessary to set the uid/gid used to run the
|
||||
# commands in docker. This is because the recent fix for
|
||||
# CVE-2022-24765 causes Git to error when the repo owner differs from
|
||||
# the user running the command and the default docker user running the
|
||||
# commands is root. For details see
|
||||
# https://github.blog/2022-04-12-git-security-vulnerability-announced/
|
||||
# When I run docker locally on macOS /src is owned by root so we don't
|
||||
# trip over the CVE fix. However in Linux CI runners, on both Travis and
|
||||
# GitHub, /src ends up owned by the same uid as the repo on the host.
|
||||
# Since .github/workflows/web.yml starts docker before calling this
|
||||
# script, the correct uid is set there. This is retained as an example
|
||||
# in case this is related to Linux rather than GHA/Travis or some other
|
||||
# system exhibits the same behavior.
|
||||
if [ -n "$TRAVIS" ]; then
|
||||
ugids="--user $(id -u):$(id -g)"
|
||||
fi
|
||||
echo "Starting Enscripten Docker container"
|
||||
docker run -dit --name emscripten $ugids -v $(pwd):/src emscripten/emsdk bash
|
||||
else
|
||||
if [ "$container_status" = "running" ]; then
|
||||
# CI has already started it.
|
||||
echo "Emscripten Docker container running"
|
||||
dockerrunning=1
|
||||
elif [ "$container_status" = "exited" ]; then
|
||||
# It wasn't removed after previous run. Resume it for use of Emscripten cache.
|
||||
echo "Resuming Emscripten Docker container"
|
||||
docker start emscripten
|
||||
else
|
||||
echo "Emscripten container is in unsupported state."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Software versions"
|
||||
echo '*****************'
|
||||
docker exec emscripten sh -c "emcc -v; echo '********'"
|
||||
docker exec emscripten sh -c "cmake --version; echo '********'"
|
||||
docker exec emscripten sh -c "git --version; echo '********'"
|
||||
|
||||
mkdir -p $BUILD_DIR
|
||||
|
||||
# emcmake uses the "Unix Makefiles" generator on Linux which does not
|
||||
# support multiple configurations.
|
||||
echo "Configure and Build KTX-Software (Web $CONFIGURATION)"
|
||||
|
||||
# Uncomment for debugging some generator expressions.
|
||||
#targets="--target debug_isgnufe1 --target debug_gnufe_ffpcontract"
|
||||
|
||||
# Since 4.0.9 SDL2 has to be installed in order for its CMake config
|
||||
# file to be found.
|
||||
if [ -n "$FEATURE_LOADTESTS" ]; then
|
||||
docker exec emscripten sh -c "embuilder build sdl3"
|
||||
fi
|
||||
|
||||
docker exec emscripten sh -c "emcmake cmake -B$BUILD_DIR . \
|
||||
-D CMAKE_BUILD_TYPE=$CONFIGURATION \
|
||||
-D KTX_FEATURE_DOC=$FEATURE_DOC \
|
||||
-D KTX_FEATURE_JNI=$FEATURE_JNI \
|
||||
-D KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS \
|
||||
-D KTX_FEATURE_TESTS=$FEATURE_TESTS \
|
||||
-D KTX_FEATURE_TOOLS=$FEATURE_TOOLS \
|
||||
-D KTX_WERROR=$WERROR \
|
||||
&& cmake --build $BUILD_DIR $targets $verbose_make"
|
||||
|
||||
if [ "$PACKAGE" = "YES" ]; then
|
||||
echo "Pack KTX-Software (Web $CONFIGURATION)"
|
||||
# Call cmake rather than cpack so we don't need knowledge of the working
|
||||
# directory inside docker.
|
||||
docker exec emscripten sh -c "cmake --build $BUILD_DIR --target package"
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
# Copyright 2022 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Allow setting of variables on the command line. A command line parameter
|
||||
# must look like (including the quotes shown) '$VAR="string"'. Spaces
|
||||
# around the equals are acceptable.
|
||||
# Since the cmake Visual Studio generator generates multi-config build
|
||||
# trees, CONFIGURATION can be a comma separated list of the config_displays
|
||||
# to build
|
||||
for ($i=0; $i -lt $args.length; $i++)
|
||||
{
|
||||
Invoke-Expression $($args[$i])
|
||||
}
|
||||
|
||||
function Set-ConfigVariable {
|
||||
param ( $VariableName, $DefaultValue )
|
||||
$res = get-variable $VariableName -ValueOnly -ErrorAction 'SilentlyContinue'
|
||||
if ([string]::IsNullOrEmpty($res)) {
|
||||
$res = [Environment]::GetEnvironmentVariable($VariableName)
|
||||
if ($res -eq $null) {
|
||||
$res = $DefaultValue
|
||||
}
|
||||
}
|
||||
return $res
|
||||
}
|
||||
|
||||
# Build for the local machine by default.
|
||||
# NOTE: See comment around line 25 in ./install_win.ps1.
|
||||
$found = (Get-ComputerInfo).CsSystemType -match "(?<arch>.*)-based PC"
|
||||
$defaultArch = $matches['arch'].toLower()
|
||||
|
||||
# These defaults are here to permit easy running of the script locally
|
||||
# when debugging is needed. Use local variables to avoid polluting the
|
||||
# environment. Some cases have been observed where setting env. var's
|
||||
# here sets them for the parent as well.
|
||||
$ARCH = Set-ConfigVariable ARCH $defaultArch
|
||||
if ($ARCH -ne "x64" -and $ARCH -ne "arm64") {
|
||||
echo "KTX build for Windows does not support $ARCH architecture."
|
||||
echo "Only amd64 and arm64 are supported."
|
||||
exit 1
|
||||
}
|
||||
$BUILD_DIR = Set-ConfigVariable BUILD_DIR "build/build-batch-vs2022"
|
||||
$CONFIGURATION = Set-ConfigVariable CONFIGURATION "Release"
|
||||
$CMAKE_GEN = Set-ConfigVariable CMAKE_GEN "Visual Studio 17 2022"
|
||||
$CMAKE_TOOLSET = Set-ConfigVariable CMAKE_TOOLSET ""
|
||||
$FEATURE_DOC = Set-ConfigVariable FEATURE_DOC "OFF"
|
||||
$FEATURE_JNI = Set-ConfigVariable FEATURE_JNI "OFF"
|
||||
if ($ARCH -eq $defaultArch) {
|
||||
$FEATURE_LOADTESTS = Set-ConfigVariable FEATURE_LOADTESTS "OpenGL+Vulkan"
|
||||
} else {
|
||||
$FEATURE_LOADTESTS = Set-ConfigVariable FEATURE_LOADTESTS "OpenGL"
|
||||
}
|
||||
if ($FEATURE_LOADTESTS -match "Vulkan" -and $ARCH -ne $defaultArch) {
|
||||
echo "The Vulkan SDK does not support cross-compilation of Vulkan apps."
|
||||
echo "Removing `"Vulkan`" from FEATURE_LOADTESTS."
|
||||
$FEATURE_LOADTESTS = $FEATURE_LOADTESTS -replace "\+?Vulkan"
|
||||
if (-not $FEATURE_LOADTESTS) {
|
||||
$FEATURE_LOADTESTS = "OFF"
|
||||
}
|
||||
}
|
||||
$FEATURE_PY = Set-ConfigVariable FEATURE_PY "OFF"
|
||||
$FEATURE_TESTS = Set-ConfigVariable FEATURE_TESTS "ON"
|
||||
$FEATURE_TOOLS = Set-ConfigVariable FEATURE_TOOLS "ON"
|
||||
$FEATURE_TOOLS_CTS = Set-ConfigVariable FEATURE_TOOLS_CTS "ON"
|
||||
$PACKAGE = Set-ConfigVariable PACKAGE "NO"
|
||||
$PYTHON = Set-ConfigVariable PYTHON ""
|
||||
$SUPPORT_SSE = Set-ConfigVariable SUPPORT_SSE "ON"
|
||||
$SUPPORT_OPENCL = Set-ConfigVariable SUPPORT_OPENCL "OFF"
|
||||
$PY_USE_VENV = Set-ConfigVariable PY_USE_VENV "OFF"
|
||||
$WERROR = Set-ConfigVariable WERROR "OFF"
|
||||
if ($ARCH -eq 'x64') {
|
||||
$OPENGL_ES_EMULATOR = Set-ConfigVariable OPENGL_ES_EMULATOR `
|
||||
"c:/Imagination` Technologies/PowerVR_Graphics/PowerVR_Tools/PVRVFrame/Library/Windows_x86_64"
|
||||
} else {
|
||||
$OPENGL_ES_EMULATOR = Set-ConfigVariable OPENGL_ES_EMULATOR ""
|
||||
}
|
||||
$CODE_SIGN_KEY_VAULT = Set-ConfigVariable CODE_SIGN_KEY_VAULT ""
|
||||
$CODE_SIGN_TIMESTAMP_URL = Set-ConfigVariable CODE_SIGN_TIMESTAMP_URL ""
|
||||
$LOCAL_KEY_VAULT_SIGNING_IDENTITY = Set-ConfigVariable LOCAL_KEY_VAULT_SIGNING_IDENTITY ""
|
||||
$LOCAL_KEY_VAULT_CERTIFICATE_THUMBPRINT = Set-ConfigVariable LOCAL_KEY_VAULT_CERTIFICATE_THUMBPRINT ""
|
||||
$AZURE_KEY_VAULT_URL = Set-ConfigVariable AZURE_KEY_VAULT_URL ""
|
||||
$AZURE_KEY_VAULT_CERTIFICATE = Set-ConfigVariable AZURE_KEY_VAULT_CERTIFICATE ""
|
||||
$AZURE_KEY_VAULT_CLIENT_ID = Set-ConfigVariable AZURE_KEY_VAULT_CLIENT_ID ""
|
||||
$AZURE_KEY_VAULT_CLIENT_SECRET = Set-ConfigVariable AZURE_KEY_VAULT_CLIENT_SECRET ""
|
||||
$AZURE_KEY_VAULT_TENANT_ID = Set-ConfigVariable AZURE_KEY_VAULT_TENANT_ID ""
|
||||
|
||||
if ($FEATURE_LOADTESTS -match 'OpenGL') { $need_gles_emulator=1 }
|
||||
|
||||
if (($PACKAGE -eq "YES") -and ($FEATURE_TOOLS -eq "OFF")) {
|
||||
echo "Error: Cannot package a configuration that does not build tools. Set FEATURE_TOOLS to ON or PACKAGE to NO"
|
||||
exit 2
|
||||
}
|
||||
|
||||
$cmake_args = @(
|
||||
"-G", "$CMAKE_GEN"
|
||||
"-A", "$ARCH"
|
||||
)
|
||||
if($CMAKE_TOOLSET) {
|
||||
$cmake_args += @(
|
||||
"-T", "$CMAKE_TOOLSET"
|
||||
)
|
||||
}
|
||||
# Just setting the environment variable does not seem to work, so pass to cmake.
|
||||
if($env:VCPKG_INSTALL_OPTIONS) {
|
||||
$cmake_args += @( "-D", "VCPKG_INSTALL_OPTIONS=$env:VCPKG_INSTALL_OPTIONS" )
|
||||
}
|
||||
if($FEATURE_LOADTESTS -ne "OFF" -and $env:VCPKG_ROOT) {
|
||||
$cmake_args += @(
|
||||
"-D", "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
|
||||
)
|
||||
}
|
||||
$cmake_args += @(
|
||||
"-B", "$BUILD_DIR"
|
||||
"-D", "KTX_FEATURE_DOC=$FEATURE_DOC"
|
||||
"-D", "KTX_FEATURE_JNI=$FEATURE_JNI"
|
||||
"-D", "KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS"
|
||||
"-D", "KTX_FEATURE_PY=$FEATURE_PY"
|
||||
"-D", "KTX_FEATURE_TESTS=$FEATURE_TESTS"
|
||||
"-D", "KTX_FEATURE_TOOLS=$FEATURE_TOOLS"
|
||||
"-D", "KTX_FEATURE_TOOLS_CTS=$FEATURE_TOOLS_CTS"
|
||||
"-D", "KTX_PY_USE_VENV=$PY_USE_VENV"
|
||||
"-D", "KTX_WERROR=$WERROR"
|
||||
"-D", "BASISU_SUPPORT_SSE=$SUPPORT_SSE"
|
||||
"-D", "BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL"
|
||||
"-D", "CODE_SIGN_KEY_VAULT=$CODE_SIGN_KEY_VAULT"
|
||||
)
|
||||
if($FEATURE_PYTHON -eq "ON" -and $PYTHON) {
|
||||
$cmake_args += @(
|
||||
"-D", "PYTHON=$PYTHON"
|
||||
)
|
||||
}
|
||||
|
||||
if ($CODE_SIGN_KEY_VAULT) {
|
||||
# To avoid CMake warning, only specify this when actually signing.
|
||||
$cmake_args += @(
|
||||
"-D", "CODE_SIGN_TIMESTAMP_URL=$CODE_SIGN_TIMESTAMP_URL"
|
||||
)
|
||||
}
|
||||
if ($CODE_SIGN_KEY_VAULT -eq "Azure") {
|
||||
$cmake_args += @(
|
||||
"-D", "AZURE_KEY_VAULT_URL=$AZURE_KEY_VAULT_URL"
|
||||
"-D", "AZURE_KEY_VAULT_CERTIFICATE=$AZURE_KEY_VAULT_CERTIFICATE"
|
||||
"-D", "AZURE_KEY_VAULT_CLIENT_ID=$AZURE_KEY_VAULT_CLIENT_ID"
|
||||
"-D", "AZURE_KEY_VAULT_CLIENT_SECRET=$AZURE_KEY_VAULT_CLIENT_SECRET"
|
||||
"-D", "AZURE_KEY_VAULT_TENANT_ID=$AZURE_KEY_VAULT_TENANT_ID"
|
||||
)
|
||||
} elseif ($CODE_SIGN_KEY_VAULT) {
|
||||
$cmake_args += @(
|
||||
"-D", "LOCAL_KEY_VAULT_SIGNING_IDENTITY=$LOCAL_KEY_VAULT_SIGNING_IDENTITY"
|
||||
"-D", "LOCAL_KEY_VAULT_CERTIFICATE_THUMBPRINT=$LOCAL_KEY_VAULT_CERTIFICATE_THUMBPRINT"
|
||||
)
|
||||
} `
|
||||
if ($need_gles_emulator) {
|
||||
$cmake_args += @("-D", "OPENGL_ES_EMULATOR=$OPENGL_ES_EMULATOR")
|
||||
}
|
||||
|
||||
$config_display = "Configure KTX-Software: "
|
||||
foreach ($item in $cmake_args) {
|
||||
switch ($item) {
|
||||
"-A" { $config_display += 'Arch=' }
|
||||
"-B" { $config_display += 'Build Dir=' }
|
||||
"-D" { }
|
||||
"-G" { $config_display += 'Generator=' }
|
||||
"-T" { $config_display += 'Toolset=' }
|
||||
"" { }
|
||||
default { $config_display += "$item, " }
|
||||
}
|
||||
}
|
||||
$config_display = $config_display -replace ', $', ''
|
||||
echo $config_display
|
||||
|
||||
cmake . $cmake_args
|
||||
|
||||
# Return an error code if cmake config fails.
|
||||
if(!$?){
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Find SDK version and ls it
|
||||
#if ($FEATURE_LOADTESTS -ne "OFF") {
|
||||
# $m = select-string -Pattern "<WindowsTargetPlatformVersion>(?<version>(?<major>[0-9][0-9])[0-9\.]*)</.*" -Path $BUILD_DIR/tests/loadtests/gl3loadtests.vcxproj
|
||||
# $sdk_ver = $m.matches[0].groups["version"].value
|
||||
# $sdk_major = $m.matches[0].groups["major"].value
|
||||
# echo "sdk_ver = $sdk_ver"
|
||||
# echo "sdk_major = $sdk_major"
|
||||
# ls "C:\Program Files (x86)\Windows Kits\$sdk_major\lib"
|
||||
# ls "C:\Program Files (x86)\Windows Kits\$sdk_major\lib\$sdk_ver\um\arm64\glu32.lib" -ErrorAction 'Continue'
|
||||
# ls "C:\Program Files (x86)\Windows Kits\$sdk_major\lib\$sdk_ver\um\x64\glu32.lib" -ErrorAction 'Continue'
|
||||
#}
|
||||
|
||||
$configArray = $CONFIGURATION.split(",")
|
||||
foreach ($config in $configArray) {
|
||||
pushd $BUILD_DIR
|
||||
try {
|
||||
#git status
|
||||
echo "Build KTX-Software (Windows $ARCH $config)"
|
||||
cmake --build . --config $config
|
||||
# Return an error code if cmake fails
|
||||
if(!$?){
|
||||
popd
|
||||
exit 1
|
||||
}
|
||||
|
||||
#git status
|
||||
if ($PACKAGE -eq "YES" -and $config -eq "Release") {
|
||||
echo "Pack KTX-Software (Windows $ARCH $config)"
|
||||
cmake --build . --config $config --target PACKAGE
|
||||
# Return an error code if cmake fails
|
||||
if(!$?){
|
||||
popd
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
echo "Done building."
|
||||
} finally {
|
||||
popd
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Executable
+22
@@ -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
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2024 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $0 [--help] [--pre-release] [--filter <pattern>] [--output-dir <directory>]"
|
||||
echo ""
|
||||
echo "Download the assets of the latest KTX-Software release from the"
|
||||
echo "GitHub repo."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --filter, -f <pattern>"
|
||||
echo " Only download assets whose name matches <pattern> where"
|
||||
echo " pattern is a regular expression."
|
||||
echo " --help, -h Print this usage message."
|
||||
echo " --output-dir <directory>"
|
||||
echo " Save the downloaded files in <directory>. Defaults to"
|
||||
echo " the current directory."
|
||||
echo " --draft, -d"
|
||||
echo " Retrieve assets from latest draft. Requires suitable"
|
||||
echo " GitHub access token in .netrc."
|
||||
echo " --pre-release, -p"
|
||||
echo " Retrieve assets from latest pre-release. Will retrieve"
|
||||
echo " from latest draft if it is also marked pre-release."
|
||||
exit $1
|
||||
}
|
||||
|
||||
# list_releases.sh should be colocated with this script
|
||||
# and the directory may not be in $PATH.
|
||||
get_release=$(dirname $0)/list_releases.sh
|
||||
|
||||
target="--latest"
|
||||
output_dir="."
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
--filter | -f)
|
||||
if [ $# -lt 1 ]; then
|
||||
usage 1
|
||||
else
|
||||
pattern=$2
|
||||
shift 2
|
||||
fi
|
||||
;;
|
||||
--help | -h)
|
||||
usage 0;;
|
||||
--output-dir | -o)
|
||||
if [ $# -lt 1 ]; then
|
||||
usage 1
|
||||
else
|
||||
output_dir=$2
|
||||
shift 2
|
||||
fi
|
||||
;;
|
||||
--draft | -d)
|
||||
target="--latest-draft"
|
||||
shift;;
|
||||
--pre-release | -p)
|
||||
target="--latest-pre"
|
||||
shift;;
|
||||
*) usage 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Retrieve target release metadata, extract and filter assets and extract
|
||||
# their urls using jq (jquery). Must use the url not browser_download_url
|
||||
# as we retrieve the asset via api.github.com so we can get assets from
|
||||
# drafts when necessary.
|
||||
jq ".assets | map(select(.name | test(\"$pattern\"))) | map(.url)" <<< $($get_release $target) | jq -c '.[]' | xargs -L 1 curl -O -J -L -n --create-dirs --output-dir $output_dir -H "Accept: application/octet-stream" -H "X-GitHub-Api-Version: 2022-11-28"
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#! /bin/bash
|
||||
# Copyright 2016-2020 Mark Callow
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Smudge driver for the kwexpander filter for expanding keywords. Currently
|
||||
# only $Date$ is supported.
|
||||
#
|
||||
# See CONTRIBUTING.md for usage information.
|
||||
|
||||
last_date=$(git log --pretty=format:"%ad" -1 HEAD -- "$1")
|
||||
sed -e 's/\$Date.*\$/\$Date: '"$last_date"' \$'/
|
||||
Executable
+125
@@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env ruby
|
||||
# Copyright 2022 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Thanks to Valerio Mazzeo (@valeriomazzeo) for inspiring this.
|
||||
|
||||
gem 'octokit', '~> 4.15.0'
|
||||
require 'optparse'
|
||||
require 'ostruct'
|
||||
require 'octokit'
|
||||
require 'mime/types'
|
||||
|
||||
options = OpenStruct.new
|
||||
options.draft = false
|
||||
options.overwrite = false
|
||||
options.prerelease = false
|
||||
OptionParser.new do |opt|
|
||||
opt.on('-s', '--secret SECRET', 'GitHub access token') { |o| options[:secret] = o }
|
||||
opt.on('-r', '--repo-slug REPO_SLUG', 'Repo slug. i.e.: apple/swift') { |o| options[:repo_slug] = o }
|
||||
opt.on('-n', '--relnotes RELNOTES_STRING', 'Release notes') { |o| options[:relnotes] = o }
|
||||
opt.on('-c', '--relnotes-file RELNOTES_FILE', 'Release notes path') { |o| options[:relnotes_file] = o }
|
||||
opt.on('-t', '--tag TAG', 'Tag name') { |o| options[:tag_name] = o }
|
||||
opt.on('-d', '--draft BOOLEAN', TrueClass, 'true if draft release') { |o| options[:draft] = o }
|
||||
opt.on('-d', '--overwrite BOOLEAN', TrueClass, 'true to overwrite existing assets') { |o| options[:overwrite] = o }
|
||||
opt.on('-p', '--prerelease BOOLEAN', TrueClass, 'true if prerelease') { |o| options[:prerelease] = o }
|
||||
end.parse!
|
||||
|
||||
raise OptionParser::MissingArgument if options[:secret].nil?
|
||||
raise OptionParser::MissingArgument if options[:repo_slug].nil?
|
||||
raise OptionParser::MissingArgument if options[:relnotes_file].nil? and options[:relnotes].nil?
|
||||
raise OptionParser::MissingArgument if options[:tag_name].nil?
|
||||
|
||||
client = Octokit::Client.new(:access_token => options[:secret])
|
||||
user = client.user
|
||||
user.login
|
||||
|
||||
unless client.scopes.include? 'public_repo' or client.scopes.include? 'repo'
|
||||
raise "Insufficient permissions. Make sure your token contains the repo or public_repo scope."
|
||||
end
|
||||
|
||||
puts "Logged in as #{user.name}"
|
||||
puts "Deploying to repo: #{options[:repo_slug]}"
|
||||
|
||||
if not options[:relnotes].nil?
|
||||
body = options[:relnotes]
|
||||
else
|
||||
body = File.open(options[:relnotes_file], "rb").read
|
||||
end
|
||||
|
||||
tag_matched = false
|
||||
our_release = nil
|
||||
releases = client.releases(options[:repo_slug])
|
||||
releases.each do |release|
|
||||
puts "Release tag_name = #{release.tag_name}"
|
||||
if release.tag_name == options[:tag_name]
|
||||
tag_matched = true
|
||||
our_release = release
|
||||
break
|
||||
end
|
||||
end
|
||||
puts "tag #{options[:tag_name]} matched: #{tag_matched}."
|
||||
if our_release
|
||||
puts "our_release.url: #{our_release.url}."
|
||||
end
|
||||
|
||||
# if tag has been pushed directly to git, create a github release
|
||||
if not our_release
|
||||
our_release = client.create_release(
|
||||
options[:repo_slug],
|
||||
options[:tag_name],
|
||||
{ :name => options[:tag_name],
|
||||
:draft => options[:draft],
|
||||
:prerelease => options[:prerelease],
|
||||
:body => body
|
||||
})
|
||||
else
|
||||
our_release = client.update_release(our_release.url,
|
||||
{
|
||||
:body => body,
|
||||
:tag_name => our_release.tag_name,
|
||||
:name => our_release.name,
|
||||
:draft => our_release.draft,
|
||||
:prerelease => our_release.prerelease
|
||||
})
|
||||
end
|
||||
|
||||
def asset(client, name, url)
|
||||
client.release_assets(url).detect { |asset| asset.name == name }
|
||||
end
|
||||
|
||||
def content_type(file)
|
||||
type = MIME::Types.type_for(file).first
|
||||
type ||= 'application/octet-stream'
|
||||
type.to_s
|
||||
end
|
||||
|
||||
def delete(client, asset, file)
|
||||
#info :overwrite, file
|
||||
client.delete_release_asset(asset.url)
|
||||
end
|
||||
|
||||
def normalize_filename(str)
|
||||
str = File.basename(str)
|
||||
str = str.split(' ').first
|
||||
# We likely don't need transliterate as our package names are English.
|
||||
# See https://github.com/travis-ci/dpl/blob/d104a6ec5fb0ba480875fe120d1e9e986824b9dc/lib/dpl/helper/transliterate.rb
|
||||
#str = transliterate(str) #
|
||||
str.gsub(/[^\w@+\-_]/, '.')
|
||||
end
|
||||
|
||||
def upload_file(path, overwrite, release, client)
|
||||
file = normalize_filename(path)
|
||||
asset = asset(client, file, release.url)
|
||||
#return info :skip_existing, file if asset && !overwrite
|
||||
return if asset && !overwrite
|
||||
puts "uploading asset #{path} to #{release.url}"
|
||||
delete(client, asset, file) if asset
|
||||
#info :upload_file, file
|
||||
client.upload_asset(release.url, path,
|
||||
{:name => file, :content_type => content_type(file)})
|
||||
end
|
||||
|
||||
# This is not thoroughly tested. Asset uploads are normally
|
||||
# done using the Travis CI "releases" provider.
|
||||
ARGV.each { |file| upload_file(file, options[:overwrite], our_release, client) }
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Copyright 2024, Mark Callow
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# gk: grep in ktx software
|
||||
|
||||
# Depth of this script relative to the project root
|
||||
depth=..
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [--help,-h] [--filepattern,-f <filename pattern>] [<match pattern>]"
|
||||
echo " <filename pattern> defaults to '*' if no -f."
|
||||
echo " With no <match pattern> prints names of files matching <filename pattern>."
|
||||
exit $1
|
||||
}
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
case $1 in
|
||||
--help | -h)
|
||||
usage 0
|
||||
;;
|
||||
--filepattern | -f)
|
||||
if [ $# -lt 1 ]; then
|
||||
usage 1
|
||||
else
|
||||
filepattern=$2
|
||||
shift 2
|
||||
fi
|
||||
;;
|
||||
--*)
|
||||
usage 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$filepattern" -a $# -eq 0 ]; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
match=$1
|
||||
elif [ $# -gt 1 ]; then
|
||||
usage 1
|
||||
elif [ -z "$filepattern" ]; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
if [ -z "$filepattern" ]; then
|
||||
filepattern='*'
|
||||
fi
|
||||
|
||||
# Make sure we're in the KTX root directory
|
||||
cd $(dirname $0)/$depth
|
||||
if [ -n "$match" ]; then
|
||||
find . -path './build*' -prune -o -path tests/cts -prune -o -path './.git' -prune -o -path './external' -prune -o -type f -name "$filepattern" -exec grep -H "$match" {} \;
|
||||
else
|
||||
find . -path './build*' -prune -o -path tests/cts -prune -o -path './.git' -prune -o -path './external' -prune -o -type f -name "$filepattern" -print
|
||||
fi
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Install software in CI environment necessary to build on Linux.
|
||||
|
||||
# Exit if any command fails.
|
||||
set -e
|
||||
|
||||
# Set parameters from command-line arguments, if any.
|
||||
for i in $@; do
|
||||
eval $i
|
||||
done
|
||||
|
||||
ARCH=${ARCH:-$(uname -m)} # Architecture to install tools for.
|
||||
FEATURE_DOC=${FEATURE_DOC:-ON}
|
||||
FEATURE_GL_UPLOAD=${FEATURE_GL_UPLOAD:-ON}
|
||||
FEATURE_VK_UPLOAD=${FEATURE_VK_UPLOAD:-ON}
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
FEATURE_LOADTESTS=${FEATURE_LOADTESTS:-OpenGL+Vulkan}
|
||||
else
|
||||
# No Vulkan SDK yet for Linux/arm64.
|
||||
FEATURE_LOADTESTS=${FEATURE_LOADTESTS:-OpenGL}
|
||||
fi
|
||||
VULKAN_SDK_VER=${VULKAN_SDK_VER:-1.4.313}
|
||||
|
||||
sudo apt-get -qq update
|
||||
|
||||
# Packages can be specified as 'package:architecture' pretty-much
|
||||
# anywhere. Use :native to request a package for the build machine.
|
||||
# See https://wiki.debian.org/Multiarch/HOWTO for information on
|
||||
# multi-architecture package installs.
|
||||
|
||||
# Tools to run on the build host.
|
||||
# LFS is not preinstalled in the arm64 image.
|
||||
sudo apt-get -qq install git-lfs:native
|
||||
sudo apt-get -qq install ninja-build:native
|
||||
if [ "$FEATURE_DOC" = "ON" ]; then
|
||||
sudo apt-get -qq install doxygen:native
|
||||
sudo apt-get -qq install graphviz:native
|
||||
fi
|
||||
sudo apt-get -qq install rpm:native
|
||||
|
||||
if [ "$ARCH" = "$(uname -m)" ]; then
|
||||
dpkg_arch=native
|
||||
# gcc, g++ and binutils for native builds should already be installed
|
||||
# on CI platforms together with cmake.
|
||||
# sudo apt-get -qq install gcc g++ binutils make
|
||||
else
|
||||
# Adjust for dpkg/apt architecture naming. How irritating that
|
||||
# it differs from what uname -m reports.
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
dpkg_arch=amd64
|
||||
gcc_pkg_arch=x86-64
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
dpkg_arch=arm64
|
||||
gcc_pkg_arch=$ARCH
|
||||
fi
|
||||
sudo dpkg --add-architecture $dpkg_arch
|
||||
sudo apt-get update
|
||||
# Don't think this is right to install cross-compiler. apt reports
|
||||
# package not available.
|
||||
#sudo apt-get -qq install gcc:$dpkg_arch g++:$dpkg_arch binutils:$dpkg_arch
|
||||
# Try this where `arch` is x86-64 or arm64.
|
||||
sudo apt-get -qq install gcc-$gcc_pkg_arch-linux-gnu:native g++-$gcc_pkg_arch-linux-gnu:native binutils-$gcc_pkg_arch-linux-gnu:native
|
||||
fi
|
||||
sudo apt-get -qq install opencl-c-headers:$dpkg_arch
|
||||
sudo apt-get -qq install mesa-opencl-icd:$dpkg_arch
|
||||
if [[ "$FEATURE_GL_UPLOAD" = "ON" || "$FEATURE_LOADTESTS" =~ "OpenGL" ]]; then
|
||||
sudo apt-get -qq install libgl1:$dpkg_arch libgl1-mesa-dev:$dpkg_arch
|
||||
fi
|
||||
if [[ "$FEATURE_VK_UPLOAD" = "ON" || "$FEATURE_LOADTESTS" =~ "Vulkan" ]]; then
|
||||
sudo apt-get -qq install libvulkan1 libvulkan-dev:$dpkg_arch
|
||||
fi
|
||||
|
||||
if [[ "$FEATURE_LOADTESTS" =~ "Vulkan" ]]; then
|
||||
# No Vulkan SDK for Linux/arm64 yet.
|
||||
if [[ "$dpkg_arch" = "arm64" ]]; then
|
||||
echo "No Vulkan SDK for Linux/arm64 yet. Please set FEATURE_LOADTESTS to OpenGL or OFF."
|
||||
else
|
||||
os_codename=$(grep -E 'VERSION_CODENAME=[a-zA-Z]+$' /etc/os-release)
|
||||
os_codename=${os_codename#VERSION_CODENAME=}
|
||||
|
||||
echo "Download Vulkan SDK"
|
||||
# tee is used (and elevated with sudo) so we can write to the destination.
|
||||
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc > /dev/null
|
||||
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-$VULKAN_SDK_VER-$os_codename.list https://packages.lunarg.com/vulkan/$VULKAN_SDK_VER/lunarg-vulkan-$VULKAN_SDK_VER-$os_codename.list
|
||||
echo "Install Vulkan SDK"
|
||||
sudo apt update
|
||||
sudo apt install vulkan-sdk
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ (-n "$FEATURE_LOADTESTS" && "$FEATURE_LOADTESTS" != "OFF") || ("$FEATURE_TESTS" = "ON") ]]; then
|
||||
git lfs pull --include=tests/srcimages,tests/testimages
|
||||
fi
|
||||
|
||||
# vim:ai:ts=4:sts=2:sw=2:expandtab
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Install software in CI environment necessary to build on macOS.
|
||||
|
||||
# Exit if any command fails.
|
||||
set -e
|
||||
|
||||
# Set parameters from command-line arguments, if any.
|
||||
for i in $@; do
|
||||
eval $i
|
||||
done
|
||||
|
||||
FEATURE_LOADTESTS=${FEATURE_LOADTESTS:-OpenGL+Vulkan}
|
||||
PLATFORM=${PLATFORM:-macOS}
|
||||
VULKAN_SDK_VERSION=${VULKAN_SDK_VERSION:-1.4.313.1}
|
||||
VULKAN_INSTALL_DIR=${VULKAN_INSTALL_DIR:-~/VulkanSDK}
|
||||
|
||||
git lfs install
|
||||
git lfs version
|
||||
gem install xcpretty
|
||||
|
||||
if [[ (-n "$FEATURE_LOADTESTS" && "$FEATURE_LOADTESTS" != "OFF") || ("$FEATURE_TESTS" = "ON") ]]; then
|
||||
git lfs pull --include=tests/srcimages,tests/testimages
|
||||
fi
|
||||
|
||||
if [[ -n "$FEATURE_LOADTESTS" && "$FEATURE_LOADTESTS" != "OFF" ]]; then
|
||||
if [ "$PLATFORM" = "iOS" ]; then
|
||||
ios_component=com.lunarg.vulkan.ios
|
||||
fi
|
||||
|
||||
if [[ "$FEATURE_LOADTESTS" =~ "Vulkan" ]]; then
|
||||
pushd ~/Downloads
|
||||
vulkan_sdk_dl_name=vulkan_sdk.zip # Name to download
|
||||
vulkan_sdk_name=vulkansdk-macos-$VULKAN_SDK_VERSION # Name after unzip.
|
||||
echo curl -s -S -O https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VERSION/mac/$vulkan_sdk_dl_name?Human=true
|
||||
curl -s -S -O https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VERSION/mac/$vulkan_sdk_dl_name?Human=true
|
||||
unzip $vulkan_sdk_dl_name
|
||||
open -W $vulkan_sdk_name.app --args --root "$VULKAN_INSTALL_DIR" --accept-licenses --default-answer --confirm-command install $ios_component
|
||||
rm $vulkan_sdk_dl_name
|
||||
rm -rf $vulkan_sdk_name.app
|
||||
unset vulkan_sdk_dw_name vulkan_sdk_name ios_component
|
||||
popd
|
||||
fi
|
||||
fi
|
||||
@@ -0,0 +1,138 @@
|
||||
# Copyright 2022 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Allow setting of variables on the command line. A command line parameter
|
||||
# must look like (including the quotes shown) '$VAR="string"'. Spaces
|
||||
# around the equals are acceptable.
|
||||
for ($i=0; $i -lt $args.length; $i++)
|
||||
{
|
||||
Invoke-Expression $($args[$i])
|
||||
}
|
||||
|
||||
function Set-ConfigVariable {
|
||||
param ( $VariableName, $DefaultValue )
|
||||
$res = get-variable $VariableName -ValueOnly -ErrorAction 'SilentlyContinue'
|
||||
if ($res -eq $null) {
|
||||
$res = [Environment]::GetEnvironmentVariable($VariableName)
|
||||
if ($res -eq $null) {
|
||||
$res = $DefaultValue
|
||||
}
|
||||
}
|
||||
return $res
|
||||
}
|
||||
|
||||
# Find the processor architecture to install the correct VulkanSDK.
|
||||
# NOTE 1: $env:processor_architecture reflects the architecture of
|
||||
# the process not the machine. It will return AMD64 in an X64 process
|
||||
# running on MS's equivalent of Rosetta. Do not use.
|
||||
# $env:PROCESSOR_IDENTIFIER reports the correct information but in a
|
||||
# form, "ARMv8 (64-bit) ...", difficult to process into the arch. name
|
||||
# used in the SDK installers. Hence this though it takes time...
|
||||
$found = (Get-ComputerInfo).CsSystemType -match "(?<arch>.*)-based PC"
|
||||
$localArch = $matches['arch'].toLower()
|
||||
|
||||
# These defaults are here to permit easy running of the script locally
|
||||
# when debugging is needed. Use local variables to avoid polluting the
|
||||
# environment. Some case have been observed where setting env. var's here
|
||||
# sets them for the parent as well.
|
||||
#
|
||||
# Install for the local machine by default.
|
||||
$ARCH = Set-ConfigVariable ARCH $localArch
|
||||
if ($ARCH -ne "x64" -and $ARCH -ne "arm64") {
|
||||
echo "KTX build for Windows does not support $ARCH architecture."
|
||||
echo "Only amd64 and arm64 are supported."
|
||||
exit 1
|
||||
}
|
||||
$FEATURE_LOADTESTS = Set-ConfigVariable FEATURE_LOADTESTS "OpenGL+Vulkan"
|
||||
$FEATURE_TESTS = Set-ConfigVariable FEATURE_TESTS "ON"
|
||||
$SUPPORT_OPENCL = Set-ConfigVariable SUPPORT_OPENCL "OFF"
|
||||
$OPENCL_SDK_HOME = Set-ConfigVariable OPENCL_SDK_HOME "https://github.com/intel/llvm/releases/download/2021-09"
|
||||
$OPENCL_SDK_NAME = Set-ConfigVariable OPENCL_SDK_NAME "win-oclcpuexp-2021.12.9.0.24_rel"
|
||||
$OPENGL_ES_EMULATOR = Set-ConfigVariable OPENGL_ES_EMULATOR "C:/Imagination/Windows_x86_64"
|
||||
$OPENGL_ES_EMULATOR_WIN = Set-ConfigVariable OPENGL_ES_EMULATOR_WIN "C:\Imagination\Windows_x86_64"
|
||||
$PVR_SDK_HOME = Set-ConfigVariable PVR_SDK_HOME "https://github.com/powervr-graphics/Native_SDK/raw/master/lib/Windows_x86_64/"
|
||||
$VULKAN_SDK_VERSION = Set-ConfigVariable VULKAN_SDK_VERSION 1.4.313.2
|
||||
|
||||
if ($FEATURE_TESTS -eq "ON") {
|
||||
git lfs pull --include=tests/srcimages,tests/testimages
|
||||
}
|
||||
|
||||
if ($FEATURE_LOADTESTS -and $FEATURE_LOADTESTS -ne "OFF") {
|
||||
if ($FEATURE_LOADTESTS -match "OpenGL") {
|
||||
echo "Download PowerVR OpenGL ES Emulator libraries (latest version)."
|
||||
$null = md $OPENGL_ES_EMULATOR_WIN
|
||||
pushd $OPENGL_ES_EMULATOR_WIN
|
||||
# Must use `curl.exe` as `curl` is an alias for the totally different
|
||||
# Invoke-WebRequest command which is difficult to use for downloads.
|
||||
# curl writes its progress meter to stderr which means PS prints the
|
||||
# output with a bright red background so sadly we turn off the meter
|
||||
# (-s, --silent) then turn actual error messages back on (-S --show-error).
|
||||
curl.exe -s -S -L -O $PVR_SDK_HOME/libGLES_CM.dll
|
||||
curl.exe -s -S -L -O $PVR_SDK_HOME/libGLES_CM.lib
|
||||
curl.exe -s -S -L -O $PVR_SDK_HOME/libGLESv2.dll
|
||||
curl.exe -s -S -L -O $PVR_SDK_HOME/libGLESv2.lib
|
||||
curl.exe -s -S -L -O $PVR_SDK_HOME/libEGL.dll
|
||||
curl.exe -s -S -L -O $PVR_SDK_HOME/libEGL.lib
|
||||
popd
|
||||
}
|
||||
if ($FEATURE_LOADTESTS -match "Vulkan") {
|
||||
$message = "Install VulkanSDK for $localArch"
|
||||
# Grumble, grumble, ...
|
||||
if ($localArch -eq "X64") {
|
||||
$vsdk_platform = "windows"
|
||||
} else {
|
||||
$vsdk_platform = "warm"
|
||||
}
|
||||
if ($ARCH -ne $localArch) {
|
||||
$message += "and component to cross compile for $ARCH."
|
||||
$vulkan_cross_component = "com.lunarg.vulkan." + $ARCH.toLower()
|
||||
} else {
|
||||
$message += "."
|
||||
}
|
||||
echo $message
|
||||
pushd $env:TEMP
|
||||
$vulkan_sdk_name = "vulkan_sdk.exe"
|
||||
echo "curl.exe -s -S -O https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VERSION/$vsdk_platform/vulkan_sdk.exe"
|
||||
curl.exe -s -S -O "https://sdk.lunarg.com/sdk/download/$VULKAN_SDK_VERSION/$vsdk_platform/vulkan_sdk.exe?Human=true"
|
||||
Start-Process .\$vulkan_sdk_name -ArgumentList "--accept-licenses --default-answer --confirm-command install $vulkan_cross_component" -NoNewWindow -Wait
|
||||
echo "Return to cloned repo."
|
||||
popd
|
||||
$key='HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
|
||||
$VULKAN_SDK=(Get-ItemProperty -Path $key -Name VULKAN_SDK).VULKAN_SDK
|
||||
echo "VULKAN_SDK=$VULKAN_SDK"
|
||||
}
|
||||
}
|
||||
|
||||
function Augment-UserPath {
|
||||
param ( $PathAddition )
|
||||
$key='HKCU:\Environment'
|
||||
$curUserPath=(Get-ItemProperty -Path $key -Name Path).Path
|
||||
}
|
||||
|
||||
if ($SUPPORT_OPENCL -eq "ON") {
|
||||
# Must be in repo root for this lfs pull.
|
||||
git lfs pull --include=external/basisu/opencl
|
||||
echo "Download and install OpenCL CPU runtime..."
|
||||
echo "... in sibling of cloned repo (../$OPENCL_SDK_NAME)."
|
||||
pushd ..
|
||||
echo "curl.exe -s -S -L -O \"$env:OPENCL_SDK_HOME/$env:OPENCL_SDK_NAME.zip\""
|
||||
# The quotes prevent some strange variable expansion behavior in PS.
|
||||
# The curl command actually works without quotes as foo/$VAR.zip works
|
||||
# but play it safe. In the 7z command $VAR.zip results in an empty
|
||||
# string. And without the quotes -o$VAR results in "-o$VAR" being
|
||||
# passed to the command.
|
||||
curl.exe -s -S -L -O "$OPENCL_SDK_HOME/$OPENCL_SDK_NAME.zip"
|
||||
echo "7z -o\"$OPENCL_SDK_NAME\" e \"$OPENCL_SDK_NAME.zip\""
|
||||
7z -o"$OPENCL_SDK_NAME" e "$OPENCL_SDK_NAME.zip"
|
||||
|
||||
# Can't use $env:Path=$env:Path;... as it won't be seen by caller.
|
||||
# Can't use setx $env:Path;... to write it to the registry because
|
||||
# setx truncates the target when > 1025 bytes and Path in Appveyor and
|
||||
# GitHub Actions is > 1025. Furthermore this ultimately results in the
|
||||
# system Path being duplicated as the setx result containing it is
|
||||
# written to the user Path.
|
||||
Augment-UserPath "$PWD.Path\$OPENCL_SDK_NAME"
|
||||
echo "Return to cloned repo."
|
||||
popd
|
||||
}
|
||||
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#! /usr/bin/env bash
|
||||
# -*- tab-width: 4; -*-
|
||||
# vi: set sw=2 ts=4:
|
||||
|
||||
# Copyright 2024 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Wrapper for git diff to use ktx compare.
|
||||
|
||||
# Per https://git-scm.com/docs/git/2.18.0#Documentation/git.txt-codeGITEXTERNALDIFFcode
|
||||
# git diff sends 7 arguments:
|
||||
# path old-file old-hex old-mode new-file new-hex new-mode
|
||||
|
||||
if [ $# -ne 7 ]; then
|
||||
echo "$0: Git did not provide the expected 7 arguments."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
oldfile=$2
|
||||
newfile=$5
|
||||
|
||||
#echo "oldfile = $oldfile"
|
||||
#echo "newfile = $newfile"
|
||||
|
||||
ktx compare $oldfile $newfile
|
||||
# Mask ktx compare's exit code. git diff expects the diff program to exit
|
||||
# without error even when there are differences.
|
||||
status=$?
|
||||
if [ $status -eq 7 ]; then
|
||||
exit 0
|
||||
else
|
||||
exit $status
|
||||
fi
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2024 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $0 [--help | --latest | --latest-pre]"
|
||||
echo ""
|
||||
echo "With no option retrieves the list of releases from the KTX-Software"
|
||||
echo "GitHub repo."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --help, -h Print this usage message."
|
||||
echo " --latest, -l Retrieve information about latest release."
|
||||
echo " --latest-draft, -d Retrieve information about latest draft release."
|
||||
echo " Requires suitable GitHub access token in .netrc."
|
||||
echo " --latest-pre, -p Retrieve information about latest pre-release."
|
||||
echo " Will retrieve latest draft if it is also marked"
|
||||
echo " pre-release."
|
||||
exit $1
|
||||
}
|
||||
|
||||
ktx_repo_url=https://api.github.com/repos/KhronosGroup/KTX-Software
|
||||
|
||||
# Authorization with a github token with push access is needed to see
|
||||
# draft releases. Put a suitable token in ~/.netrc. -n tells curl to
|
||||
# look for .netrc.
|
||||
function get_release_list() {
|
||||
curl \
|
||||
--silent --show-error -L -n \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
$ktx_repo_url/releases
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
get_release_list
|
||||
exit 0
|
||||
elif [ $# -eq 1 ]; then
|
||||
case $1 in
|
||||
--help | -h)
|
||||
usage 0 ;;
|
||||
--latest-draft | -d)
|
||||
release_url=$(jq -r 'map(select(.draft)) | first | .url' <<< $(get_release_list))
|
||||
;;
|
||||
--latest-pre | -p)
|
||||
release_url=$(jq -r 'map(select(.prerelease)) | first | .url' <<< $(get_release_list))
|
||||
;;
|
||||
--latest | -l)
|
||||
release_url=$ktx_repo_url/releases/latest
|
||||
;;
|
||||
*) usage 1 ;;
|
||||
esac
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
||||
curl \
|
||||
--silent --show-error -L -n \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
$release_url
|
||||
Executable
+271
@@ -0,0 +1,271 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Copyright 2020, Mark Callow
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Generate release notes from git log.
|
||||
#
|
||||
# mkrelnotes [-b] [-c] [-d] [-e] [-l] [-p <preface> [-t] <previous release tag> <release name>
|
||||
#
|
||||
# <previous release tag> is the name of the tag identifying the previous
|
||||
# release. <this release> is the name to be given to the tag for the upcoming
|
||||
# release. N.B. this tag cannot be created until after ther release notes
|
||||
# have been generated and checked in. The release notes will include changes
|
||||
# in the two-dot commit range <previous release tag>..HEAD.
|
||||
#
|
||||
# <preface> is inserted between the title and the detailed change list
|
||||
# that is extracted with git log. It should be used to summarize
|
||||
# new features and known issues using level 3 (###) headings for those
|
||||
# sections.
|
||||
#
|
||||
# If -b is specified build system changes will be included in the
|
||||
# release notes.
|
||||
#
|
||||
# If -c is specified any previous $RELNOTES_FILE will be appended, with the
|
||||
# title lines stripped, to the release notes generated here, thus enabling
|
||||
# cumulative release notes. Otherwise any previous $RELNOTES_FILE file is
|
||||
# replaced.
|
||||
#
|
||||
# If -d is specified details of the changes will be included, otherwise only
|
||||
# the summary is shown.
|
||||
#
|
||||
# If -e is specified changes to `external` packages will be included in the
|
||||
# release notes.
|
||||
#
|
||||
# If -l is specified changes to the load test apps will be included in the
|
||||
# release notes.
|
||||
#
|
||||
# If -i is specified the release notes will be built interactively. That is,
|
||||
# for each change the user will be asked if it should be included.
|
||||
#
|
||||
# If -t is specified changes to the tests will be included in the release notes
|
||||
# otherwise they are omitted.
|
||||
|
||||
# Depth of this script relative to the project root
|
||||
depth=..
|
||||
|
||||
RELNOTES_FILE="RELEASE_NOTES.md"
|
||||
|
||||
# The author name in a commit message comes from whatever the user
|
||||
# has set as user.name in their git config. It usually has no relation
|
||||
# to their GitHub username so putting an @ before it has no meaning.
|
||||
#
|
||||
SUMMARY_FORMAT_W_AUTH="* %s (%h) (%an)"
|
||||
SUMMARY_FORMAT="* %s (%h)"
|
||||
|
||||
function commit_summary() {
|
||||
local hash=$1
|
||||
local summary
|
||||
local prjson
|
||||
pr=$(git log --oneline -n 1 $hash | grep -o -E "\(#[0-9]+\)" | grep -o -E "[0-9]+")
|
||||
# Even in PR's the commit has the full name of the user as known to GitHub,
|
||||
# not their GitHub username. We want to use the GitHub username so there will
|
||||
# be a link back to the person. We can retrieve this by requesting detailed
|
||||
# info from GitHub via HTTPS.
|
||||
summary=$(git log --pretty="$SUMMARY_FORMAT" -n 1 $hash)
|
||||
if [ -z "$pr" ]; then
|
||||
cmtjson="$(curl --netrc https://api.github.com/repos/KhronosGroup/KTX-Software/commits/$hash 2>/dev/null)"
|
||||
author="$(echo $cmtjson | jq -r -e '.author.login')"
|
||||
else
|
||||
prjson="$(curl --netrc https://api.github.com/repos/KhronosGroup/KTX-Software/pulls/$pr 2>/dev/null)"
|
||||
author="$(echo $prjson | jq -r -e '.user.login')"
|
||||
fi
|
||||
summary+=" (@$author)"
|
||||
# \_ avoids confusion with _ for italics.
|
||||
echo "$summary" | sed -e 's/_/\\_/g'
|
||||
if [ -n "$includeDetails" ]; then
|
||||
body="$(git log --pretty="%b" -n 1 $hash | sed -E 's/^(.+)/ \1/')"
|
||||
if [ -n "$body" ]; then
|
||||
echo ""
|
||||
# Remove CR which some multi-line commit bodies contain for unknown
|
||||
# reasons.
|
||||
echo "$body" | tr -d \\r | sed -e 's/_/\\_/g'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function revisions_in () {
|
||||
local range=$1; shift
|
||||
git rev-list $range $*
|
||||
}
|
||||
|
||||
function log() {
|
||||
local part=$1; shift
|
||||
local log
|
||||
for rev in $(revisions_in "$range" $*); do
|
||||
if [ -n "$interactive" ]; then
|
||||
git log -1 $rev > /dev/tty
|
||||
|
||||
processed=0
|
||||
while [ $processed -eq 0 ]; do
|
||||
echo "Include this change? [d,i,s,?] ?" > /dev/tty
|
||||
read -n 1 opt
|
||||
echo "" > /dev/tty
|
||||
|
||||
case $opt in
|
||||
d)
|
||||
git show --pretty=oneline $rev > /dev/tty
|
||||
;;
|
||||
[is])
|
||||
processed=1
|
||||
;;
|
||||
?)
|
||||
echo "d - show diff of this commit" > /dev/tty
|
||||
echo "i - include this commit." > /dev/tty
|
||||
echo "s - skip this commit." > /dev/tty
|
||||
echo "? - display this help message." > /dev/tty
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $opt. Try again." > /dev/tty
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case $opt in
|
||||
i)
|
||||
log+="$(commit_summary $rev)"
|
||||
;;
|
||||
esac
|
||||
|
||||
else
|
||||
log+="$(commit_summary $rev)"
|
||||
fi
|
||||
# For reasons I do not understand I have been completely unable to prevent
|
||||
# trailing newlines from being removed from the output of commit_summary
|
||||
# so resorting to ANSI-C quoting to insert some new lines between summaries.
|
||||
log+=$'\n\n'
|
||||
done
|
||||
if [ -n "$log" ]; then
|
||||
echo "### $part"
|
||||
echo
|
||||
echo "$log"
|
||||
echo
|
||||
fi
|
||||
}
|
||||
|
||||
function usage() {
|
||||
cat << EOU
|
||||
Usage: $0 [-b] [-c] [-d] [-i] [-p <preface>] [-t] <previous release tag> <release name>"
|
||||
Options:
|
||||
-b Include build system changes.
|
||||
-c Make cumulative release notes.
|
||||
-d Include details of changes. If absent only the summary is shown.
|
||||
-e Include changes to `external` packages.
|
||||
-i Interactively select the changes to include.
|
||||
-l Include changes to load test apps. Ignored if -t specified.
|
||||
-p <preface>
|
||||
Include the file <preface> before the list of changes.
|
||||
-t Include test changes.
|
||||
EOU
|
||||
}
|
||||
|
||||
while true; do
|
||||
case $1 in
|
||||
-b) includeBuildSystem="true"; shift ;;
|
||||
-c) cumulative="true"; shift;;
|
||||
-d) includeDetails="true"; shift ;;
|
||||
-e) includeExternal="true"; shift ;;
|
||||
-i) interactive="true"; shift;;
|
||||
-l) includeLoadtests="true"; shift ;;
|
||||
-p) preface=$2; shift 2 ;;
|
||||
-t) includeTests="true"; shift ;;
|
||||
-*) usage; exit 1 ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "$0: Need previous release tag and this release name, e.g. 'v4.0.0 v4.0.1'."
|
||||
exit 1
|
||||
else
|
||||
range=$1..
|
||||
lastrel=$1
|
||||
thisrel=$2
|
||||
fi
|
||||
|
||||
#if [ $# -ne 1 ]; then
|
||||
# echo '$0: Need a two-dot revision range, e.g, `v4.0.0..v4.0.1`.'
|
||||
# exit 1
|
||||
#else
|
||||
# range=$1
|
||||
# if ! [[ $range =~ ([[:alnum:][:punct:]]+)\.\.([[:alnum:]][[:alnum:][:punct:]]*)? ]]; then
|
||||
# echo "$0: <revision range> is not a two-dot range."
|
||||
# exit 1
|
||||
# else
|
||||
# lastrel=${BASH_REMATCH[1]}
|
||||
# thisrel=${BASH_REMATCH[2]}
|
||||
# if [ -z "$lastrel" ]; then
|
||||
# lastrel=HEAD
|
||||
# fi
|
||||
# fi
|
||||
#fi
|
||||
|
||||
# Change to the project root
|
||||
cd $(dirname $0)/$depth
|
||||
|
||||
SAVED_RELNOTES_FILE="${RELNOTES_FILE%.md}-$lastrel.md"
|
||||
|
||||
# Save or remove old relnotes.
|
||||
if [ -f $RELNOTES_FILE ]; then
|
||||
if [ -z "$cumulative" ]; then
|
||||
rm $RELNOTES_FILE;
|
||||
else
|
||||
mv $RELNOTES_FILE $SAVED_RELNOTES_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
# Read preface file before cd.
|
||||
if [ -n "$preface" ]; then
|
||||
PREFACE=$(cat $preface)
|
||||
fi
|
||||
|
||||
lib=$(log libktx lib)
|
||||
tools=$(log Tools tools)
|
||||
js_binding=$(log "JS Bindings" interface/js_binding)
|
||||
java_binding=$(log "Java Bindings" interface/java_binding)
|
||||
python_binding=$(log "Python Bindings" interface/python_binding)
|
||||
|
||||
if [ -n "$includeBuildSystem" ]; then
|
||||
build=$(log "Build Scripts and CMake files" scripts $(find . \( -path ./build -o -path ./.git -o -path ./external -o -path ./other_include \) -prune -false -o -name CMakeLists.txt -o -name '*.cmake'))
|
||||
fi
|
||||
if [ -n "$includeExternal" ]; then
|
||||
external=$(log "External Package Dependencies" external)
|
||||
fi
|
||||
if [ -n "$includeTests" ]; then
|
||||
tests=$(log "Tests" tests)
|
||||
elif [ -n "$includeLoadtests" ]; then
|
||||
loadtests=$(log "Load test apps" tests/loadtests)
|
||||
fi
|
||||
|
||||
cat > $RELNOTES_FILE <<- EOF
|
||||
$(date '+<!-- Copyright %Y, The Khronos Group Inc. -->')
|
||||
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
||||
Release Notes
|
||||
=============
|
||||
## Version ${thisrel#v}
|
||||
$PREFACE
|
||||
|
||||
### Changes since $lastrel (by part)
|
||||
$lib
|
||||
|
||||
$tools
|
||||
|
||||
$js_binding
|
||||
|
||||
$java_binding
|
||||
|
||||
$python_binding
|
||||
|
||||
$external
|
||||
|
||||
$tests
|
||||
|
||||
$loadtests
|
||||
|
||||
$build
|
||||
EOF
|
||||
|
||||
if [ -f $SAVED_RELNOTES_FILE ]; then
|
||||
awk '! /Release Notes/ && ! /======/ && ! /<!-- Copyright/ && ! /<!-- SPDX/ {print}' $SAVED_RELNOTES_FILE >> $RELNOTES_FILE
|
||||
rm $SAVED_RELNOTES_FILE
|
||||
fi
|
||||
Executable
+153
@@ -0,0 +1,153 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
# Copyright 2020, Mark Callow
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Script to generate version number files using the output of git
|
||||
# describe.
|
||||
|
||||
# A file of this name will be created in the subdir (object) for which a
|
||||
# version number is being generated.
|
||||
VF=version.h
|
||||
DEF_VER=v4.0
|
||||
|
||||
LF='
|
||||
'
|
||||
|
||||
# Change directory the root of the Git repo.
|
||||
depth=..
|
||||
cd $(dirname $0)/$depth
|
||||
|
||||
function genversion() {
|
||||
# Try git-describe, then default.
|
||||
if [ -d ${GIT_DIR:-.git} -o -f .git ]; then
|
||||
if [ -z "$1" ]; then
|
||||
# Get version number for HEAD revision of repo.
|
||||
VN=$(git describe --match "v[0-9]*" HEAD 2>/dev/null)
|
||||
else
|
||||
# Get release tag containing the object identified in # $1.
|
||||
VN=$(git describe --contains --match "v[0-9]*" --exclude "*-beta*" --exclude "*-rc[0-9]*" $(git rev-list -1 HEAD $1) 2>/dev/null)
|
||||
if [ -z "$VN" ]; then
|
||||
# No containing release tag. Look for an RC tag.
|
||||
VN=$(git describe --contains --match "v[0-9]*" --exclude "*-beta*" $(git rev-list -1 HEAD $1) 2>/dev/null)
|
||||
fi
|
||||
if [ -z "$VN" ]; then
|
||||
# No containing RC tag. Look for a beta tag.
|
||||
VN=$(git describe --contains --match "v[0-9]*" $(git rev-list -1 HEAD $1) 2>/dev/null)
|
||||
fi
|
||||
if [ -z "$VN" ]; then
|
||||
# No containing tag. Get version number a previous tag.
|
||||
VN=$(git describe --match "v[0-9]*" $(git rev-list -1 HEAD $1) 2>/dev/null)
|
||||
fi
|
||||
if [ -z "$VN" ]; then
|
||||
# No tags at all, best we can do is tag the commit.
|
||||
VN="$DEF_VER-$(git rev-parse --short HEAD 2>/dev/null)"
|
||||
fi
|
||||
fi
|
||||
case "$VN" in
|
||||
*$LF*) (exit 1) ;;
|
||||
v[0-9]*)
|
||||
git update-index -q --refresh
|
||||
test -z "$(git diff-index --name-only HEAD --)" ||
|
||||
VN="$VN-dirty" ;;
|
||||
esac
|
||||
else
|
||||
VN="$DEF_VER"
|
||||
fi
|
||||
}
|
||||
|
||||
# Write the version file, if the new version is different than the
|
||||
# existing one.
|
||||
function setfile() {
|
||||
local VC
|
||||
local verstring=$1_VERSION
|
||||
if [ $dry_run -eq 1 ]; then
|
||||
echo $verstring $VN
|
||||
return
|
||||
fi
|
||||
if [ -r $2 ]; then
|
||||
VC=$(grep $verstring $2 | sed -e "s/^#define $verstring //")
|
||||
else
|
||||
VC=unset
|
||||
fi
|
||||
if [ $force -eq 1 -o "$VN" != "$VC" ]; then
|
||||
echo "/*" > $2
|
||||
if [ "$1" = "LIBKTX" ]; then
|
||||
(echo "// [API version]"
|
||||
echo "@par API Version"
|
||||
echo "$DEF_VER"
|
||||
echo "// [API version]") >> $2
|
||||
fi
|
||||
(echo "// [Code version]"
|
||||
echo "$VN"
|
||||
echo "// [Code version]"
|
||||
echo "*/"
|
||||
echo "#define $verstring $VN"
|
||||
echo "#define $1_DEFAULT_VERSION $DEF_VER.__default__") >> $2
|
||||
fi
|
||||
}
|
||||
|
||||
# Figure out the object name and write its version file.
|
||||
function writeversion() {
|
||||
# Extract version from git if it is not passed via command line
|
||||
if [ -z "$VN" ]; then
|
||||
genversion $1
|
||||
fi
|
||||
local vfp;
|
||||
if [ -z "$1" ]; then
|
||||
vfp=$VF
|
||||
else
|
||||
vfp=$1/$VF
|
||||
fi
|
||||
if [ "$1" = "lib" ]; then
|
||||
ON=LIBKTX
|
||||
setfile $ON $1/$VF
|
||||
else
|
||||
ON=$(basename $1)
|
||||
ON=$(echo $ON | tr [:lower:] [:upper:])
|
||||
setfile $ON $1/$VF
|
||||
fi
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "Usage: $0 [-a] [-f] [-n] [-v version] [-o <outfile>] [<object>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
force=0
|
||||
dry_run=0
|
||||
write_all=0;
|
||||
args=$(getopt afnv:o: $*)
|
||||
|
||||
set -- $args
|
||||
for i; do
|
||||
case "$i" in
|
||||
-a) write_all=1;
|
||||
shift;;
|
||||
-f) force=1;
|
||||
shift;;
|
||||
-n) dry_run=1;
|
||||
shift;;
|
||||
-v) VN=$2; shift; shift;;
|
||||
-o) VF=$2; shift; shift;;
|
||||
--) shift; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) if [ $write_all -ne 1 ]; then usage; fi;;
|
||||
1) OBJ=$1;;
|
||||
2) usage;;
|
||||
esac
|
||||
|
||||
if [ $write_all -eq 1 ]; then
|
||||
for i in lib tools/*; do
|
||||
if [ -d $i -a "$i" != "tools/package" ]; then
|
||||
writeversion $i
|
||||
fi
|
||||
done
|
||||
else
|
||||
writeversion $OBJ
|
||||
fi
|
||||
|
||||
# vim:ai:ts=4:sts=4:sw=2:expandtab:textwidth=70
|
||||
Executable
+363
@@ -0,0 +1,363 @@
|
||||
#! /usr/bin/env -S awk -f
|
||||
# Copyright 2019-2024 Mark Callow
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Usage: mkvkformatfiles [output-dir path/to/vulkan_core]
|
||||
#
|
||||
# output_dir defaults to the current directory.
|
||||
# path/to/vulkan_core defaults to ENVIRON["Vulkan_INCLUDE_DIR"]. If not
|
||||
# set, default is external/dfdutils/vulkan/vulkan_core.h.
|
||||
#
|
||||
# When specifying path/to/vulkan_core, output-dir must also be
|
||||
# specified.
|
||||
|
||||
# This script creates 6 files from vulkan/vulkan_core.h:
|
||||
#
|
||||
# - lib/vkformat_enum.h: the VkFormat enum declaration for those who don't
|
||||
# want to include vulkan_core.h. extension token names for
|
||||
# extensions that have been moved to core are omitted.
|
||||
#
|
||||
# - lib/vkformat_str.c: a switch statement for converting VkFormat enums to
|
||||
# to strings corresponding to the format names.
|
||||
# - lib/vkformat_typesize.c, function to return the type-size for each
|
||||
# format.
|
||||
#
|
||||
# - lib/vkformat_check.c: 3 functions: 1 to check if a format is prohibited in
|
||||
# KTX2, one to see if a format is a valid Vulkan format and one to see
|
||||
# if it is an sRGB format.
|
||||
#
|
||||
# - interface/java_binding/src/main/java/org/khronos/ktx/VkFormat.java,
|
||||
# VkFormat enumerators for Java.
|
||||
#
|
||||
# - interface/js_binding/vk_format.inl,
|
||||
# VkFormat enumeration body for ktx_wrapper.cpp.
|
||||
#
|
||||
# - interface/python_binding/pyktx/vk_format.py, VkFormat enumerators for
|
||||
# Python.
|
||||
#
|
||||
# - tests/unittests/vkformat_list.inl, a list of VkFormat enum names for use in
|
||||
# initializing tables, etc.
|
||||
#
|
||||
# KTX v2 prohibited formats are excluded from the last three files.
|
||||
|
||||
BEGIN {
|
||||
if (index(tolower(ENVIRON["OS"]), "windows") > 0) {
|
||||
ORS = "\r\n";
|
||||
}
|
||||
# ARGV[0] is "awk".
|
||||
if (ARGC > 1) {
|
||||
output_dir = ARGV[1] "/";
|
||||
delete ARGV[1];
|
||||
} else {
|
||||
output_dir = "./";
|
||||
}
|
||||
# awk reads files whose names are found in the positional parameters,
|
||||
# hence setting ARGV[1] here and deleting a possible ARGV[1] above.
|
||||
if (ARGC == 1) {
|
||||
if (ENVIRON["Vulkan_INCLUDE_DIR"]) {
|
||||
ARGV[1] = ENVIRON["Vulkan_INCLUDE_DIR"] "/vulkan/vulkan_core.h"; ARGC = 2
|
||||
} else {
|
||||
# Use local vulkan_core.h until ASTC 3D texture extension is released.
|
||||
# ARGV[1] = "/usr/include";
|
||||
ARGV[1] = "external/dfdutils/vulkan/vulkan_core.h"; ARGC = 2
|
||||
}
|
||||
}
|
||||
|
||||
# Hard-coded paths are somewhat unfortunate but major changes in
|
||||
# the source code organization are unlikely.
|
||||
format_hdr = output_dir "lib/vkformat_enum.h"
|
||||
format_typesize = output_dir "lib/vkformat_typesize.c"
|
||||
format_inl = output_dir "tests/unittests/vkformat_list.inl"
|
||||
format_strings = output_dir "lib/vkformat_str.c"
|
||||
format_check = output_dir "lib/vkformat_check.c"
|
||||
format_java = output_dir "interface/java_binding/src/main/java/org/khronos/ktx/VkFormat.java"
|
||||
format_js = output_dir "interface/js_binding/vk_format.inl"
|
||||
format_python = output_dir "interface/python_binding/pyktx/vk_format.py"
|
||||
|
||||
vulkan_core = "vulkan_core.h"
|
||||
processing_core_formats = 0
|
||||
processing_extension_formats = 0
|
||||
# Range pattern matches 2nd line to avoid other comments so need
|
||||
# comment opening.
|
||||
copyright = "/*" ORS
|
||||
banner = ""
|
||||
format_decl = ""
|
||||
format_name_list = ""
|
||||
core_formats = ""
|
||||
extension_formats = ""
|
||||
end_range = ""
|
||||
max_std_format_enum = 0
|
||||
java = "package org.khronos.ktx;" ORS "public class VkFormat {" ORS
|
||||
prohibited = "#include <stdint.h>" ORS "#include <stdbool.h>" ORS ORS
|
||||
prohibited = prohibited "#include \"vkformat_enum.h\"" ORS ORS
|
||||
prohibited = prohibited "bool" ORS "isProhibitedFormat(VkFormat format)" ORS "{" ORS
|
||||
prohibited = prohibited " switch (format) {" ORS;
|
||||
python = "from enum import IntEnum" ORS ORS "class VkFormat(IntEnum):" ORS
|
||||
python = python " \"\"\"Vulkan texture format constants.\"\"\"" ORS ORS
|
||||
srgb = "bool" ORS "isSrgbFormat(VkFormat format)" ORS "{" ORS
|
||||
srgb = srgb " switch(format) {" ORS
|
||||
valid = "bool" ORS "isValidFormat(VkFormat format)" ORS "{" ORS
|
||||
valid = valid " // On MSVC VkFormat can be a signed integer" ORS
|
||||
valid = valid " if ((uint32_t) format <= VK_FORMAT_MAX_STANDARD_ENUM)" ORS
|
||||
valid = valid " return true;" ORS " else switch(format) {" ORS
|
||||
}
|
||||
|
||||
# A range pattern to extract the copyright message.
|
||||
/\*\* Copyright*/,/\*\// { copyright = copyright $0 ORS; }
|
||||
|
||||
$2 == "VK_HEADER_VERSION" {
|
||||
banner = ORS
|
||||
banner = banner "/***************************** Do not edit. *****************************" ORS
|
||||
banner = banner " Automatically generated from " vulkan_core " version " $3 " by mkvkformatfiles." ORS
|
||||
banner = banner " *************************************************************************/" ORS
|
||||
}
|
||||
|
||||
# Extract VkFlags definition.
|
||||
/typedef .* VkFlags/ {
|
||||
format_decl = format_decl "#if defined(_MSC_VER) && _MSC_VER < 1900 // Older than VS 2015." ORS
|
||||
format_decl = format_decl "typedef unsigned __int32 VkFlags;" ORS "#else" ORS
|
||||
format_decl = format_decl "#include <stdint.h>" ORS
|
||||
format_decl = format_decl $0 ORS "#endif" ORS ORS
|
||||
}
|
||||
|
||||
# A range pattern to extract the VkFormat declaration.
|
||||
/^typedef enum VkFormat {/,/^} VkFormat;/ {
|
||||
if ($3 !~ /VK_FORMAT_.*/) { # Avoid values defined as existing values.
|
||||
format_decl = format_decl $0 ORS
|
||||
if ($1 ~ /VK_FORMAT/ && $1 !~ /.*MAX_ENUM/ && $3 !~ /1000....../) {
|
||||
# I don't understand why but if I apply the sub to $3 here, it
|
||||
# breaks extraction of VK_FORMAT token names below. It is like
|
||||
# this $3 becomes the $3 seen down there.
|
||||
enum_val = $3;
|
||||
sub(/,$/, "", enum_val);
|
||||
if (enum_val+0 > max_std_format_enum) {
|
||||
max_std_format_enum = enum_val+0;
|
||||
}
|
||||
if ($1 !~ /UNDEFINED/) {
|
||||
format_name_list = format_name_list $1 "," ORS
|
||||
}
|
||||
if ($1 !~ /SCALED/ && $1) {
|
||||
java = java " public static final int " $1 " = " enum_val ";" ORS
|
||||
js = js " .value(\"" removePrefix($1, "VK_FORMAT_") "\", " $1 ")" ORS
|
||||
python = python " " $1 " = " enum_val ORS
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($1 ~ /}/) {
|
||||
end_range = "#define VK_FORMAT_MAX_STANDARD_ENUM " max_std_format_enum ORS;
|
||||
}
|
||||
}
|
||||
|
||||
/.*SCALED/ { prohibited = prohibited " case " $1 ":" ORS; }
|
||||
#/A8B8G8R8_.*_PACK32/ { prohibited = prohibited " case " $1 ":" ORS; }
|
||||
# Multiplane formats.
|
||||
/VK_FORMAT_[^F]/ && (/PLANE/ || /420/) {
|
||||
# Avoid values defined as existing values and avoid the MAX_ENUM value.
|
||||
if ($3 !~ /VK_FORMAT_.*/ && $1 !~ /.*MAX_ENUM/) {
|
||||
prohibited = prohibited " case " $1 ":" ORS;
|
||||
}
|
||||
}
|
||||
|
||||
# Extract srgb formats
|
||||
/VK_FORMAT_.*SRGB/ && !/PLANE/ && !/420/ {
|
||||
srgb = srgb " case " $1 ":" ORS;
|
||||
}
|
||||
|
||||
# Extract valid formats with values > VK_FORMAT_END_RANGE.
|
||||
/VK_FORMAT_[^F].* = 1000/ && !/PLANE/ && !/420/ {
|
||||
valid = valid " case " $1 ":" ORS;
|
||||
format_name_list = format_name_list $1 "," ORS
|
||||
enum_val = $3;
|
||||
sub(/,$/, "", enum_val);
|
||||
java = java " public static final int " $1 " = " enum_val ";" ORS
|
||||
js = js " .value(\"" removePrefix($1, "VK_FORMAT_") "\", " $1 ")" ORS
|
||||
python = python " " $1 " = " enum_val ORS
|
||||
}
|
||||
|
||||
function removePrefix(string, prefix) {
|
||||
sub("^" prefix, "", string)
|
||||
return string
|
||||
}
|
||||
|
||||
function genTypeSize(format) {
|
||||
size = format
|
||||
if (format ~ /^VK_FORMAT_UNDEFINED$/) {
|
||||
size = 1
|
||||
} else if (format ~ /.*PACK[0-9]+($|_)/) {
|
||||
sub("^.*PACK", "", size)
|
||||
sub("_.*$", "", size)
|
||||
size = size / 8
|
||||
} else if (format ~ /.*BLOCK/) {
|
||||
size = 1
|
||||
} else if (format ~ /D16_UNORM_S8_UINT/) {
|
||||
size = 2
|
||||
} else if (format ~ /D24_UNORM_S8_UINT/) {
|
||||
size = 4
|
||||
} else {
|
||||
sub("^[^0-9]+", "", size)
|
||||
sub("[^0-9].*$", "", size)
|
||||
size = size / 8
|
||||
}
|
||||
return " case " format ":" ORS " return " size ";" ORS
|
||||
}
|
||||
|
||||
# Extract VK_FORMAT token names. [^F] avoids the VK_FORMAT_FEATURE* tokens.
|
||||
/ VK_FORMAT_[^F]/ {
|
||||
switch_value = ""
|
||||
if ($1 !~ /.*MAX_ENUM/) { # Avoid the MAX_ENUM value.
|
||||
if ($3 !~ /VK_FORMAT_.*/) { # Avoid values defined as existing values.
|
||||
switch_body_vk2str = switch_body_vk2str " case " $1 ":" ORS " return \"" $1 "\";" ORS
|
||||
switch_value = $1 # Use symbolic not numeric value.
|
||||
switch_body_vktypesize = switch_body_vktypesize genTypeSize($1)
|
||||
} else {
|
||||
switch_value = $3 # Use symbol for existing value.
|
||||
sub(/,.*$/, "", switch_value)
|
||||
}
|
||||
switch_body_str2vk = switch_body_str2vk " if (ktx_strcasecmp(str, \"" removePrefix($1, "VK_FORMAT_") "\") == 0)" ORS " return " switch_value ";" ORS
|
||||
}
|
||||
}
|
||||
|
||||
function write_header_file(guard1, guard2, body, filename) {
|
||||
print "// clang-format off: CI is complicated if formatting checks on generated files are enforced." > filename
|
||||
if (guard2) {
|
||||
print "#if !defined("guard1") && !defined("guard2")" > filename
|
||||
} else {
|
||||
print "#ifndef "guard1 > filename
|
||||
}
|
||||
print "#define "guard1 > filename
|
||||
print banner > filename
|
||||
print copyright > filename
|
||||
print body > filename
|
||||
print "#endif /* "guard1" */" > filename
|
||||
print "// clang-format on" > filename
|
||||
}
|
||||
|
||||
function write_source_file(body, filename) {
|
||||
print banner > filename
|
||||
print copyright > filename
|
||||
# write_source_file used for both java and c sources
|
||||
if (filename ~ /\.(h|c)$/) {
|
||||
print "// clang-format off: CI is complicated if formatting checks on generated files are enforced." > filename
|
||||
}
|
||||
print body > filename
|
||||
if (filename ~ /\.(h|c)$/) {
|
||||
print "// clang-format on" > filename
|
||||
}
|
||||
}
|
||||
|
||||
function write_python_source_file(body, filename) {
|
||||
pybanner = banner;
|
||||
sub(/\/\*/, "#***", pybanner);
|
||||
sub(/\*\//, "****", pybanner);
|
||||
sub(/ Auto/, "# Auto", pybanner);
|
||||
regexp = ORS " \\*";
|
||||
sub(regexp, ORS "#", pybanner);
|
||||
|
||||
pycopyright = copyright;
|
||||
regexp = "/\\*" ORS;
|
||||
sub(regexp, "", pycopyright);
|
||||
gsub(/\*\*/, "#", pycopyright);
|
||||
regexp = "\\*/" ORS;
|
||||
sub(regexp, "", pycopyright);
|
||||
|
||||
print pybanner > filename
|
||||
print pycopyright > filename
|
||||
print body > filename
|
||||
}
|
||||
|
||||
END {
|
||||
# vkformat_enum.h
|
||||
write_header_file("_VKFORMAT_ENUM_H_", "VULKAN_CORE_H_", format_decl ORS end_range, format_hdr);
|
||||
|
||||
# vkformat_list.inl
|
||||
write_source_file(format_name_list ORS, format_inl)
|
||||
|
||||
# vkformat_typesize.c
|
||||
begin_vktypesize = ORS
|
||||
begin_vktypesize = begin_vktypesize "#include <stdint.h>" ORS;
|
||||
begin_vktypesize = begin_vktypesize ORS;
|
||||
begin_vktypesize = begin_vktypesize "#include \"vkformat_enum.h\"" ORS;
|
||||
begin_vktypesize = begin_vktypesize ORS;
|
||||
begin_vktypesize = begin_vktypesize "uint32_t" ORS "vkFormatTypeSize(VkFormat format)" ORS "{" ORS;
|
||||
begin_vktypesize = begin_vktypesize " switch (format) {" ORS;
|
||||
end_vktypesize = " default:" ORS
|
||||
end_vktypesize = end_vktypesize " return 0;" ORS;
|
||||
end_vktypesize = end_vktypesize " }" ORS
|
||||
end_vktypesize = end_vktypesize "}"
|
||||
write_source_file(begin_vktypesize switch_body_vktypesize end_vktypesize, format_typesize);
|
||||
|
||||
# vkformat_check.c
|
||||
prohibited = prohibited " return true;" ORS
|
||||
prohibited = prohibited " default:" ORS " return false;" ORS " }" ORS "}" ORS;
|
||||
srgb = srgb " return true;" ORS
|
||||
srgb = srgb " default:" ORS " return false;" ORS " }" ORS "}" ORS;
|
||||
valid = valid " return true;" ORS
|
||||
valid = valid " default:" ORS " return false;" ORS " }" ORS "}" ORS;
|
||||
write_source_file(prohibited ORS srgb ORS valid, format_check)
|
||||
|
||||
# vkformat_str.c
|
||||
prelude = ORS;
|
||||
prelude = prelude "#include <stdint.h>" ORS;
|
||||
prelude = prelude "#include <ctype.h>" ORS;
|
||||
prelude = prelude ORS;
|
||||
prelude = prelude "#include \"vkformat_enum.h\"" ORS;
|
||||
prelude = prelude ORS;
|
||||
prelude = prelude "const char*" ORS "vkFormatString(VkFormat format)" ORS "{" ORS;
|
||||
prelude = prelude " switch (format) {" ORS;
|
||||
postscript = " default:" ORS " return \"VK_UNKNOWN_FORMAT\";" ORS;
|
||||
postscript = postscript " }" ORS;
|
||||
postscript = postscript "}" ORS;
|
||||
begin_str2vk = ORS
|
||||
begin_str2vk = begin_str2vk "static int ktx_strcasecmp(const char* s1, const char* s2) {" ORS
|
||||
begin_str2vk = begin_str2vk " const unsigned char* us1 = (const unsigned char*) s1;" ORS
|
||||
begin_str2vk = begin_str2vk " const unsigned char* us2 = (const unsigned char*) s2;" ORS
|
||||
begin_str2vk = begin_str2vk ORS
|
||||
begin_str2vk = begin_str2vk " while (tolower(*us1) == tolower(*us2)) {" ORS
|
||||
begin_str2vk = begin_str2vk " if (*us1 == '\\0')" ORS
|
||||
begin_str2vk = begin_str2vk " return 0;" ORS
|
||||
begin_str2vk = begin_str2vk " ++us1;" ORS
|
||||
begin_str2vk = begin_str2vk " ++us2;" ORS
|
||||
begin_str2vk = begin_str2vk " }" ORS
|
||||
begin_str2vk = begin_str2vk " return tolower(*us1) - tolower(*us2);" ORS
|
||||
begin_str2vk = begin_str2vk "}" ORS
|
||||
begin_str2vk = begin_str2vk ORS
|
||||
begin_str2vk = begin_str2vk "static int ktx_strncasecmp(const char* s1, const char* s2, int length) {" ORS
|
||||
begin_str2vk = begin_str2vk " const unsigned char* us1 = (const unsigned char*) s1;" ORS
|
||||
begin_str2vk = begin_str2vk " const unsigned char* us2 = (const unsigned char*) s2;" ORS
|
||||
begin_str2vk = begin_str2vk ORS
|
||||
begin_str2vk = begin_str2vk " while (length > 0 && tolower(*us1) == tolower(*us2)) {" ORS
|
||||
begin_str2vk = begin_str2vk " if (*us1 == '\\0')" ORS
|
||||
begin_str2vk = begin_str2vk " return 0;" ORS
|
||||
begin_str2vk = begin_str2vk " ++us1;" ORS
|
||||
begin_str2vk = begin_str2vk " ++us2;" ORS
|
||||
begin_str2vk = begin_str2vk " --length;" ORS
|
||||
begin_str2vk = begin_str2vk " }" ORS
|
||||
begin_str2vk = begin_str2vk " if (length == 0)" ORS
|
||||
begin_str2vk = begin_str2vk " return 0;" ORS
|
||||
begin_str2vk = begin_str2vk " return tolower(*us1) - tolower(*us2);" ORS
|
||||
begin_str2vk = begin_str2vk "}" ORS
|
||||
begin_str2vk = begin_str2vk ORS
|
||||
begin_str2vk = begin_str2vk "/// Parses a VkFormat. VK_FORMAT_ prefix is optional. Case insensitive." ORS
|
||||
begin_str2vk = begin_str2vk "VkFormat" ORS
|
||||
begin_str2vk = begin_str2vk "stringToVkFormat(const char* str)" ORS
|
||||
begin_str2vk = begin_str2vk "{" ORS
|
||||
begin_str2vk = begin_str2vk " if (ktx_strncasecmp(str, \"VK_FORMAT_\", sizeof(\"VK_FORMAT_\") - 1) == 0)" ORS
|
||||
begin_str2vk = begin_str2vk " str += sizeof(\"VK_FORMAT_\") - 1;" ORS
|
||||
begin_str2vk = begin_str2vk ORS
|
||||
end_str2vk = " return VK_FORMAT_UNDEFINED;" ORS;
|
||||
end_str2vk = end_str2vk "}"
|
||||
write_source_file(prelude switch_body_vk2str postscript begin_str2vk switch_body_str2vk end_str2vk, format_strings);
|
||||
|
||||
# VkFormat.java
|
||||
end_java = "}" ORS
|
||||
write_source_file(java end_java, format_java);
|
||||
|
||||
# vk_format.inl (js)
|
||||
write_source_file(js, format_js);
|
||||
|
||||
# vk_format.py
|
||||
write_python_source_file(python, format_python);
|
||||
}
|
||||
|
||||
# vim:ai:ts=4:sts=4:sw=2:expandtab:textwidth=70
|
||||
|
||||
Executable
+122
@@ -0,0 +1,122 @@
|
||||
#!/bin/zsh
|
||||
# Copyright 2020 Mark Callow
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# notarize.sh
|
||||
|
||||
# Checks pkg for a valid signature. If valid, uploads the pkg for
|
||||
# notarization and waits for the notarization status
|
||||
|
||||
# Usage: notarize.sh <path/to/pkg> <appleid> <devteam> <password>
|
||||
# path/to/pkg - path a signed .pkg file to be notarized.
|
||||
# appleid - Apple developer login.
|
||||
# devteam - 10 character development team identifier. Use Khronos dev
|
||||
# team id when notarizing apps signed with Khronos cert.
|
||||
# password - app-specific password for to use when logging in to
|
||||
# <appleid>. The same app-specific password can be used
|
||||
# for both altool and notarytool. If the password is stored
|
||||
# in the keychain then this argument should be of the form
|
||||
# @keychain:<pw_label> where <pw_label> is the label of the
|
||||
# password in the keychain.
|
||||
#
|
||||
# Retrieving this password from the keychain during a Travis-CI build was
|
||||
# not working for altool for reasons that are not clear. altool would hang.
|
||||
# Likely macOS security is asking for permission for altool to access the
|
||||
# keychain, even though this was set up. This has not been tried with
|
||||
# notarytool.
|
||||
|
||||
# Thanks to Armin Briegel for the script that inspired this one.
|
||||
|
||||
# Code starts here
|
||||
|
||||
if [[ $# != 4 ]]; then
|
||||
echo "Usage: $0: <path/to/pkg> <appleid> <devteam> <password>"
|
||||
exit 1
|
||||
else
|
||||
pkg=$1
|
||||
appleid=$2
|
||||
devteam=$3
|
||||
passwd=$4
|
||||
fi
|
||||
|
||||
logfile=notarization.json
|
||||
|
||||
# functions
|
||||
notarizefile() { # $1: path to file to notarize
|
||||
# upload file
|
||||
echo "## Sending $1 for notarization."
|
||||
echo "## Will await result. This may take some time..."
|
||||
if nt_out=$(xcrun notarytool submit "$1" \
|
||||
--wait \
|
||||
--apple-id "$appleid" \
|
||||
--password "$passwd" \
|
||||
--team-id "$devteam")
|
||||
then
|
||||
# N.B. notarytool outputs 2 lines starting with "status:". The first
|
||||
# initially says "In Progress" and is later overwritten with the
|
||||
# final status. This is done by sending a CR followed by the new text.
|
||||
# The second "status:" line is output at the end. All interim and
|
||||
# final messages are recorded in $nt_out. To avoid matching any interim
|
||||
# messages - "In" is a particular problem - use entire status response
|
||||
# words in this RE.
|
||||
#
|
||||
# A big thank to Apples, NOT :-(, for failing to document in the
|
||||
# command help or even the TechNotes about notarization, the output
|
||||
# from notarytool during --wait or to give any example of use.
|
||||
if [[ "$nt_out" =~ "status: (Accepted|Invalid|Rejected)" ]]; then
|
||||
ntz_status=$match[1]
|
||||
# There are many "id:" lines in the output. Fortunately they
|
||||
# all have the same value.
|
||||
[[ $nt_out =~ "id: ([0-9a-f\-]+)" ]] && id=$match[1]
|
||||
if ! xcrun notarytool log $id $logfile \
|
||||
--apple-id "$appleid" \
|
||||
--password "$passwd" \
|
||||
--team-id "$devteam"
|
||||
then
|
||||
echo "$0: Retrieval of notarization log for id $id failed."
|
||||
exit 1
|
||||
fi
|
||||
echo "## Notarization status: $ntz_status. Log:"
|
||||
cat $logfile
|
||||
echo
|
||||
rm $logfile
|
||||
else
|
||||
echo "$0: \"status:\" not found in notarytool output."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "$0: Error while attempting to notarize $1."
|
||||
echo $nt_out
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $ntz_status != "Accepted" ]]; then
|
||||
echo "## $1 not notarized. Exiting"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if pkg exists where we expect it
|
||||
if [[ ! -f $pkg ]]; then
|
||||
echo "$0: Couldn't find pkg $pkg"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check the package is signed
|
||||
if ! pkgutil --check-signature $pkg > /dev/null; then
|
||||
echo "$0: Package $pkg does not have a valid signature."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Upload for notarization
|
||||
notarizefile "$pkg"
|
||||
|
||||
# staple result
|
||||
echo "## Stapling $pkg"
|
||||
xcrun stapler staple "$pkg"
|
||||
|
||||
echo '## Done!'
|
||||
|
||||
exit 0
|
||||
|
||||
# vim:ai:ts=4:sts=2:sw=2:expandtab
|
||||
@@ -0,0 +1,29 @@
|
||||
# Copyright 2022 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if ($args[0]) { $repo_root = $args[0] } else { $repo_root = "." }
|
||||
if ($args[1]) { $build_dir = $args[1] } else { $build_dir = "build" }
|
||||
|
||||
# In Github Actions, this is called only when there is a failed test step.
|
||||
# In Appveyor we use the Phase environment variable.
|
||||
echo "Phase = $env:Phase"
|
||||
if ($env:GITHUB_ACTIONS -or $env:Phase) {
|
||||
pushd $repo_root
|
||||
echo "Now uploading the failed tests"
|
||||
$image_list = "tests/testimages/ktx2ktx2*", "tests/testimages/ktxsc*", "tests/testimages/toktx*"
|
||||
ls $image_list
|
||||
echo "Current directory is"
|
||||
pwd
|
||||
if (tar -cvf failed-images.tar $image_list) {
|
||||
# N.B. In PS, "curl" is an alias for Invoke-WebRequest. Uploading a
|
||||
# file via that looks like a p.i.t.a so use the real curl command.
|
||||
curl.exe --upload-file failed-images.tar https://transfer.sh/ktx-failed-images.tar
|
||||
}
|
||||
# Even if there are no failed images and tar exits with false it creates
|
||||
# the output file.
|
||||
rm failed-images.tar
|
||||
|
||||
echo "`r`nNow uploading the test log"
|
||||
curl.exe --upload-file $build_dir/Testing/Temporary/LastTest.log https://transfer.sh/ktx-last-test.log
|
||||
popd
|
||||
}
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2022 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if [ $# -ge 1 ]; then
|
||||
repo_root=$1
|
||||
else
|
||||
repo_root=$TRAVIS_BUILD_DIR
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
build_dir=$2
|
||||
else
|
||||
build_dir=$TRAVIS_BUILD_DIR/$BUILD_DIR
|
||||
fi
|
||||
|
||||
echo "Now checking for and uploading any failed tests"
|
||||
image_list="$repo_root/tests/testimages/ktx2ktx2* $repo_root/tests/testimages/ktxsc*, $repo_root/tests/testimages/toktx*"
|
||||
if tar -cvf failed-tests.tar $image_list
|
||||
then
|
||||
# curl/transfer.sh prints the retrieval URL on completion. As the output
|
||||
# is not terminated with a new-line it does not show up in Travis-CI's
|
||||
# cooked output, only the raw. Workaround by saving to variable.
|
||||
rurl=$(curl --upload-file failed-tests.tar https://transfer.sh/toktx-failed-tests.tar)
|
||||
echo $rurl
|
||||
fi
|
||||
echo "Now uploading the test log"
|
||||
rurl=$(curl --upload-file $build_dir/Testing/Temporary/LastTest.log https://transfer.sh/ktx-failed-tests.log)
|
||||
echo $rurl
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2022 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# aaaaargh! macOS readlink did not support `-f` until macOS 12.3.
|
||||
# CI has yet to catch up - latest is 12.2 - so this script finds
|
||||
# the canonical file using just `readlink`.
|
||||
libdir=$(dirname $1)
|
||||
prev_target=$1
|
||||
|
||||
until target="$(readlink $prev_target)"; [ -z $target ]; do
|
||||
prev_target=$libdir/$target;
|
||||
done
|
||||
|
||||
echo $prev_target
|
||||
@@ -0,0 +1,24 @@
|
||||
# Copyright 2023 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Smudge all files with proper $Date$ values.
|
||||
|
||||
# Make sure we're in the repo root
|
||||
$path=(split-path $MyInvocation.MyCommand.Path -Parent)
|
||||
echo $path
|
||||
cd $path/..
|
||||
|
||||
$target_files = @(
|
||||
'pkgdoc/pages.md'
|
||||
'lib/libktx_mainpage.md'
|
||||
'tools/ktxtools_mainpage.md'
|
||||
'interface/js_binding/ktx_wrapper.cpp'
|
||||
)
|
||||
|
||||
#foreach ($file in $target_files) {
|
||||
# rm $file
|
||||
# git checkout $file
|
||||
#}
|
||||
rm $target_files
|
||||
git checkout $target_files
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#! /usr/bin/env bash
|
||||
# Copyright 2023 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Smudge all files with proper $Date$ values.
|
||||
|
||||
# Exit if any command fails.
|
||||
set -e
|
||||
|
||||
# Make sure we're in the repo root
|
||||
cd $(dirname $0)/..
|
||||
|
||||
|
||||
target_files=(pkgdoc/pages.md
|
||||
lib/libktx_mainpage.md
|
||||
tools/ktxtools_mainpage.md
|
||||
interface/js_binding/ktx_wrapper.cpp
|
||||
)
|
||||
|
||||
#for file in "${target_files[@]}"; do
|
||||
# rm $file
|
||||
# git checkout $file
|
||||
#done
|
||||
rm "${target_files[@]}"
|
||||
git checkout "${target_files[@]}"
|
||||
|
||||
Reference in New Issue
Block a user