Compare commits
21 Commits
401cab7da0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 2cdfcde5a3 | |||
| ef12ba03d8 | |||
| a425166018 | |||
| f253b6f683 | |||
| 2fb5eb1dd7 | |||
| 09239c0cda | |||
| 44a34ed0a2 | |||
| e8a40e04a9 | |||
| 26ab321641 | |||
| 19e7382ff7 | |||
| 49b9f5778a | |||
| 2b1ba018ab | |||
| c87a0fa78a | |||
| 7857833620 | |||
| 13fa90a0e9 | |||
| 14bd1a9271 | |||
| 9461db6ae7 | |||
| d2c901f4e4 | |||
| e3195c9b12 | |||
| 33fd5389aa | |||
| 063b9a2adf |
@@ -1,3 +1,5 @@
|
||||
.cache
|
||||
main
|
||||
compile_commands.json
|
||||
vendor
|
||||
ktx/build
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/* Copyright (c) 2025-2026, Sascha Willems
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
struct VSInput {
|
||||
float3 Pos;
|
||||
float3 Normal;
|
||||
float2 UV;
|
||||
};
|
||||
|
||||
Sampler2D textures[];
|
||||
|
||||
struct ShaderData {
|
||||
float4x4 projection;
|
||||
float4x4 view;
|
||||
float4x4 model[3];
|
||||
float4 lightPos;
|
||||
uint32_t selected;
|
||||
};
|
||||
|
||||
struct VSOutput {
|
||||
float4 Pos : SV_POSITION;
|
||||
float3 Normal;
|
||||
float2 UV;
|
||||
float3 Factor;
|
||||
float3 LightVec;
|
||||
float3 ViewVec;
|
||||
uint32_t InstanceIndex;
|
||||
};
|
||||
|
||||
[shader("vertex")]
|
||||
VSOutput main(VSInput input, uniform ShaderData *shaderData, uint instanceIndex : SV_VulkanInstanceID) {
|
||||
VSOutput output;
|
||||
float4x4 modelMat = shaderData->model[instanceIndex];
|
||||
output.Normal = mul((float3x3)mul(shaderData->view, modelMat), input.Normal);
|
||||
output.UV = input.UV;
|
||||
output.Pos = mul(shaderData->projection, mul(shaderData->view, mul(modelMat, float4(input.Pos.xyz, 1.0))));
|
||||
output.Factor = (shaderData->selected == instanceIndex ? 3.0f : 1.0f);
|
||||
output.InstanceIndex = instanceIndex;
|
||||
// Calculate view vectors required for lighting
|
||||
float4 fragPos = mul(mul(shaderData->view, modelMat), float4(input.Pos.xyz, 1.0));
|
||||
output.LightVec = shaderData->lightPos.xyz - fragPos.xyz;
|
||||
output.ViewVec = -fragPos.xyz;
|
||||
return output;
|
||||
}
|
||||
|
||||
[shader("fragment")]
|
||||
float4 main(VSOutput input) {
|
||||
// Phong lighting
|
||||
float3 N = normalize(input.Normal);
|
||||
float3 L = normalize(input.LightVec);
|
||||
float3 V = normalize(input.ViewVec);
|
||||
float3 R = reflect(-L, N);
|
||||
float3 diffuse = max(dot(N, L), 0.0025);
|
||||
float3 specular = pow(max(dot(R, V), 0.0), 16.0) * 0.75;
|
||||
// Sample from texture
|
||||
float3 color = textures[NonUniformResourceIndex(input.InstanceIndex)].Sample(input.UV).rgb * input.Factor;
|
||||
return float4(diffuse * color.rgb + specular, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
# Blender 5.0.1 MTL File: 'suzanne4.blend'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Material
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl Material.001
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.127605 0.127605 0.127605
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl Material.002
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.000000 0.000000 0.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl Material.003
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl Material.004
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800007 0.200800 0.327761
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
|
||||
newmtl Material.005
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.500000
|
||||
d 1.000000
|
||||
illum 2
|
||||
@@ -1,6 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
bear -- clang++ -g -c -Wno-nullability-completeness -DVK_NO_PROTOTYPES -I$VULKAN_SDK/include vulkan_profiles/vulkan_profiles.cpp main.cpp
|
||||
bear -a -- clang -g -c -DVK_NO_PROTOTYPES -Ivulkan_profiles -I$VULKAN_SDK/include $VULKAN_SDK/include/volk/volk.c wapp/wapp.c
|
||||
bear -a -- clang++ -g -DVK_NO_PROTOTYPES -lSDL3 -lglm -o main *.o
|
||||
rm *.o
|
||||
build_ktx () {
|
||||
cmake ktx -B ktx/build \
|
||||
-D KTX_FEATURE_LOADTEST_APPS=ON \
|
||||
-D KTX_FEATURE_DOC=ON \
|
||||
-D CMAKE_EXPORT_COMPILE_COMMANDS=1 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D CMAKE_INSTALL_PREFIX=$(realpath vendor) \
|
||||
-D CMAKE_CXX_STANDARD=17 \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D CMAKE_CXX_FLAGS="-msse4.1" \
|
||||
-G Ninja
|
||||
cmake --build ktx/build --config Release
|
||||
cmake --install ktx/build
|
||||
}
|
||||
|
||||
build_app () {
|
||||
bear -- clang++ -g -c -Wno-nullability-completeness -DVK_NO_PROTOTYPES -I$VULKAN_SDK/include -Ivendor/include vulkan_profiles/vulkan_profiles.cpp main.cpp
|
||||
bear -a -- clang -g -c -DVK_NO_PROTOTYPES -Ivulkan_profiles -I$VULKAN_SDK/include $VULKAN_SDK/include/volk/volk.c wapp/wapp.c
|
||||
bear -a -- clang++ -g -DVK_NO_PROTOTYPES -L$VULKAN_SDK/lib -Lvendor/lib -lSDL3 -lglm -ltinyobjloader -lktx -lslang -Wl,-rpath,./vendor/lib -Wl,-rpath,$VULKAN_SDK/lib -o main *.o
|
||||
}
|
||||
|
||||
clean_obj () {
|
||||
rm *.o
|
||||
}
|
||||
|
||||
build_ktx
|
||||
build_app
|
||||
clean_obj
|
||||
|
||||
@@ -0,0 +1,718 @@
|
||||
<!-- Copyright 2013-2020 Mark Callow -->
|
||||
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
||||
|
||||
Building KTX
|
||||
============
|
||||
|
||||
KTX uses the the [CMake](https://cmake.org) build system. Depending on your
|
||||
platform and how you configure it, it will create project/build files (e.g. an Xcode project, a Visual Studio solution or Make files) that allow you to
|
||||
build the software and more (See [CMake generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)).
|
||||
|
||||
KTX consist of the following parts
|
||||
|
||||
- The `libktx` main library
|
||||
- Command line tools (for Linux / macOS / Windows)
|
||||
- Load test applications (for [OpenGL<sup>®</sup> 3](https://www.khronos.org/opengl), [OpenGLES<sup>®</sup>](https://www.khronos.org/opengles) or [Vulkan<sup>®</sup>](https://www.khronos.org/vulkan))
|
||||
- Documentation
|
||||
|
||||
Supported platforms (please see their specific requirements first)
|
||||
|
||||
- [GNU/Linux](#gnulinux)
|
||||
- [Apple macOS/iOS](#apple-macosios)
|
||||
- [Web/Emscripten](#webemscripten)
|
||||
- [Windows](#windows)
|
||||
- [Android](#android)
|
||||
|
||||
The minimal way to a build is to clone this repository and run the following in a terminal
|
||||
|
||||
```bash
|
||||
# Navigate to the root of your KTX-Software clone (replace with
|
||||
# your actual path)
|
||||
cd /path/to/KTX-Software
|
||||
|
||||
# This generates build/project files in the sub-folder `build`
|
||||
cmake . -B build
|
||||
|
||||
# Compile the project
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
This creates the `libktx` library and the command line tools. To create the complete project generate the project like this:
|
||||
|
||||
```bash
|
||||
cmake . -B build -D KTX_FEATURE_LOADTEST_APPS=ON -D KTX_FEATURE_DOC=ON
|
||||
```
|
||||
|
||||
If you need the library to be static, add `-D BUILD_SHARED_LIBS=OFF` to the CMake configure command (always disabled on iOS and Emscripten).
|
||||
|
||||
> **Note:**
|
||||
>
|
||||
> When linking to the static library, make sure to
|
||||
> define `KHRONOS_STATIC` before including KTX header files.
|
||||
> This is especially important on Windows.
|
||||
|
||||
If you want to run the CTS tests (recommended only during KTX development)
|
||||
add `-D KTX_FEATURE_TOOLS_CTS=ON` to the CMake configure command and fetch
|
||||
the CTS submodule. For more information see [Conformance Test Suite](#conformance-test-suite).
|
||||
|
||||
If you want the Basis Universal encoders in `libktx` to use OpenCL
|
||||
add `-D BASISU_SUPPORT_OPENCL=ON` to the CMake configure command.
|
||||
|
||||
> **Note:**
|
||||
>
|
||||
> There is very little advantage to using OpenCL in the context
|
||||
> of `libktx`. It is disabled in the default build configuration.
|
||||
|
||||
> **Note:**
|
||||
>
|
||||
> When building from a source `tar.gz` and not from the git repository directly,
|
||||
> it is recommended to set the variable `KTX_GIT_VERSION_FULL` to the
|
||||
> associated git tag (e.g `v4.3.2`)
|
||||
>
|
||||
> ```bash
|
||||
> cmake . -G Ninja -B build -DKTX_GIT_VERSION_FULL=v4.3.2
|
||||
> ```
|
||||
> Use with caution.
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
### GNU/Linux
|
||||
|
||||
You need to install the following
|
||||
|
||||
- [CMake](https://cmake.org)
|
||||
- gcc and g++ from the [GNU Compiler Collection](https://gcc.gnu.org)
|
||||
- [GNU Make](https://www.gnu.org/software/make) or [Ninja](https://ninja-build.org) (recommended)
|
||||
- [Doxygen](#doxygen) and [dot](#dot-\(graphviz\)) (only if generating documentation)
|
||||
|
||||
To build `libktx` such that the Basis Universal encoders will use
|
||||
OpenCL you need
|
||||
|
||||
- OpenCL headers
|
||||
- OpenCL driver
|
||||
|
||||
On Ubuntu and Debian these can be installed via
|
||||
|
||||
```bash
|
||||
sudo apt install build-essential cmake libzstd-dev ninja-build doxygen graphviz opencl-c-headers mesa-opencl-icd
|
||||
```
|
||||
|
||||
`mesa-opencl-icd` should be replaced by the appropriate package for your GPU.
|
||||
|
||||
On Fedora and RedHat these can be installed via
|
||||
|
||||
```bash
|
||||
sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libzstd-devel ninja-build doxygen graphviz mesa-libOpenCL
|
||||
```
|
||||
|
||||
|
||||
To build the load test applications you also need to install the following
|
||||
|
||||
- [vcpkg](#vcpkg) (which will automatically install the actual dependencies: [SDL3](sdl3) and [assimp](assimp))
|
||||
- OpenGL development libraries
|
||||
- Vulkan development libraries
|
||||
- [Vulkan SDK](#vulkan-sdk)
|
||||
- zlib development library
|
||||
|
||||
On Ubuntu and Debian these can be installed via
|
||||
|
||||
```bash
|
||||
sudo apt install libsdl3-dev libgl1-mesa-glx libgl1-mesa-dev libvulkan1 libvulkan-dev libassimp-dev
|
||||
```
|
||||
|
||||
On Fedora and RedHat these can be installed via
|
||||
|
||||
```bash
|
||||
sudo dnf install SDL3-devel mesa-libGL mesa-libGL-devel mesa-vulkan-drivers assimp-devel
|
||||
```
|
||||
|
||||
KTX requires `glslc`, which comes with [Vulkan SDK](#vulkan-sdk) (in sub-
|
||||
folder `x86_64/bin/glslc`). Make sure the complete path to the tool is in
|
||||
in your environment's `PATH` variable. If you've followed Vulkan SDK
|
||||
install instructions for your platform this should already be set up. You
|
||||
can test it by running
|
||||
|
||||
```bash
|
||||
# Should output version number.
|
||||
glslc --version
|
||||
# If it fails, try this then repeat the above.
|
||||
export PATH=$PATH:/path/to/vulkansdk/x86_64/bin
|
||||
```
|
||||
|
||||
You should be able then to build like this
|
||||
|
||||
```bash
|
||||
# First either configure a debug build of libktx and the tools
|
||||
cmake . -G Ninja -B build
|
||||
# ...or alternatively a release build including all targets
|
||||
cmake . -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -D KTX_FEATURE_LOADTEST_APPS=ON -D KTX_FEATURE_DOC=ON
|
||||
|
||||
# Compile the project
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
### Apple macOS/iOS
|
||||
|
||||
You need to install the following
|
||||
|
||||
- CMake
|
||||
- Xcode or, if using a different build system, the Xcode command line tools.
|
||||
- [Doxygen](#doxygen) and [dot](#dot-\(graphviz\)) (only if generating documentation)
|
||||
|
||||
To build the load test applications you also need to install
|
||||
|
||||
- [vcpkg](#vcpkg) (which will automatically install the actual dependencies: [SDL3](sdl3) and [assimp](assimp))
|
||||
- [Vulkan SDK](#vulkan-sdk)
|
||||
|
||||
Other dependencies (like OpenGL) come with Xcode.
|
||||
|
||||
For the load test applications you must also set these environment variables:
|
||||
|
||||
- `VCPKG_ROOT` to the location where you installed [vcpkg](#vcpkg).
|
||||
- `VULKAN_SDK` to the `macOS` folder in your VulkanSDK installation. This can be set with the command `. /path/to/your/vulkansdk/setenv.sh`.
|
||||
|
||||
> **Note:** If using the CMake GUI or Xcode IDE you must ensure `VULKAN_SDK` is
|
||||
> made available to them.
|
||||
|
||||
> **Note:** `VULKAN_SDK` is essential when bulding for iOS. When building for
|
||||
> macOS it is not necessary if you selected _System Global Installation_ when
|
||||
> installing the SDK.
|
||||
|
||||
> **Note:** the `iphoneos` or `MacOSX` SDK version gets hardwired into the
|
||||
> generated projects. After installing an Xcode update that has the SDK for a
|
||||
> new version of iOS, builds will fail. The only way to remedy this is to delete
|
||||
> the CMake cache and reconfigure and regenerate from scratch. Use of a
|
||||
> [`CMakeUserPresets.json`](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html)
|
||||
> file to capture unchanging settings is recommended.
|
||||
|
||||
#### macOS
|
||||
|
||||
To build for macOS:
|
||||
|
||||
```bash
|
||||
# This creates an Xcode project at `build/mac/KTX-Software.xcodeproj`
|
||||
# containing the libktx and tools targets.
|
||||
mkdir build
|
||||
cmake -G Xcode -B build/mac
|
||||
|
||||
# If you want to build the load test apps as well, set the
|
||||
# `KTX_FEATURE_LOADTEST_APPS` and `CMAKE_TOOLCHAIN_FILE`
|
||||
# parameters. vcpkg will automatically install the dependencies.
|
||||
cmake -GXcode -Bbuild/mac -D KTX_FEATURE_LOADTEST_APPS=ON -D CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
|
||||
|
||||
# Compile the project
|
||||
cmake --build build/mac
|
||||
```
|
||||
##### Apple Silicon and Universal Binaries
|
||||
|
||||
Macs are either based on Intel or the newer Apple Silicon architecture. By default CMake configures to build for your host's platform, whichever it is. If you want to cross compile universal binaries (that support both platforms), add the parameter `-DCMAKE_OSX_ARCHITECTURES="\$(ARCHS_STANDARD)"` to cmake.
|
||||
|
||||
> **Known limitations:**
|
||||
> - Intel Macs have support for SSE, but if you're building universal binaries,
|
||||
> you have to disable SSE or the build will fail
|
||||
|
||||
Example how to build universal binaries
|
||||
|
||||
```bash
|
||||
# Configure universal binaries and disable SSE
|
||||
cmake -G Xcode -B build-macos-universal -D CMAKE_OSX_ARCHITECTURES="\$(ARCHS_STANDARD)" -D BASISU_SUPPORT_SSE=OFF
|
||||
# Build
|
||||
cmake --build build-macos-universal
|
||||
# Easy way to check if the resulting binaries are universal
|
||||
|
||||
file build-macos-universal/Debug/libktx.dylib
|
||||
# outputs:
|
||||
# build-macos-universal/Debug/libktx.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64]
|
||||
# build-macos-universal/Debug/libktx.dylib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
|
||||
# build-macos-universal/Debug/libktx.dylib (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64
|
||||
|
||||
file build-macos-universal/Debug/ktx
|
||||
# outputs:
|
||||
# build-macos-universal/Debug/ktx: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
|
||||
# build-macos-universal/Debug/ktx (for architecture x86_64): Mach-O 64-bit executable x86_64
|
||||
# build-macos-universal/Debug/ktx (for architecture arm64): Mach-O 64-bit executable arm64
|
||||
```
|
||||
|
||||
To explicity build for one or the other architecture use
|
||||
`-D CMAKE_OSX_ARCHITECTURES=arm64` or `-D CMAKE_OSX_ARCHITECTURES=x86_64`
|
||||
|
||||
##### macOS signing
|
||||
|
||||
To sign the applications you need to set the following CMake variables:
|
||||
|
||||
| Name | Value |
|
||||
| :--: | ----- |
|
||||
| XCODE\_CODE\_SIGN\_IDENTITY | Owner* of the _Developer ID Application_ certificate to use for signing. |
|
||||
| XCODE\_DEVELOPMENT\_TEAM | Development team of the certificate owner.
|
||||
|
||||
To sign the installation package you need to set the following variables:
|
||||
|
||||
| Name | Value |
|
||||
| :--: | ----- |
|
||||
| PRODUCTBUILD\_IDENTITY\_NAME | Owner* of the _Developer ID Installer_ certificate to use for signing. |
|
||||
| PRODUCTBUILD\_KEYCHAIN\_PATH | Path to the keychain file with the certificate. Blank if its in the default keychain.
|
||||
|
||||
#### iOS
|
||||
|
||||
To build for iOS:
|
||||
|
||||
```bash
|
||||
# This creates an Xcode project at `build/ios/KTX-Software.xcodeproj`
|
||||
# containing the libktx targets.
|
||||
mkdir build # if it does not exist
|
||||
cmake -G Xcode -B build/ios -D CMAKE_SYSTEM_NAME=iOS
|
||||
|
||||
# This creates a project to build the load test apps as well.
|
||||
cmake -G Xcode -B build/ios -D KTX_FEATURE_LOADTEST_APPS=ON -D CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
|
||||
|
||||
# Compile the project
|
||||
cmake --build build -- -sdk iphoneos
|
||||
```
|
||||
|
||||
If using the CMake GUI, when it asks you to specify the generator for the project, you need to check _Specify options for cross-compiling_ and on the next screen make sure _Operating System_ is set to `iOS`.
|
||||
|
||||
##### iOS signing
|
||||
|
||||
To sign the applications you need to set the following CMake variables:
|
||||
|
||||
| Name | Value |
|
||||
| :---: | ----- |
|
||||
| XCODE\_CODE\_SIGN\_IDENTITY | Owner* of the _Apple Development_ certificate to use for signing. |
|
||||
| XCODE\_DEVELOPMENT\_TEAM | Development team used to create the Provisioning Profile. This may not be the same as the team of the _Apple Development_ certificate owner.
|
||||
| XCODE\_PROVISIONING\_PROFILE | Name of the profile to use.
|
||||
|
||||
\* _Owner_ is what is formally known as the _Subject Name_ of a certificate. It
|
||||
is the string displayed by the Keychain Access app in the list of installed
|
||||
certificates and shown as the value of the _Common Name_ field of the _Subject
|
||||
Name_ section of the details shown after double-clicking the certificate.
|
||||
|
||||
### Web/Emscripten
|
||||
|
||||
There are two ways to build the Web version of the software: using Docker or using your own Emscripten installation.
|
||||
|
||||
#### Using Docker
|
||||
|
||||
Install [Docker Desktop](https://www.docker.com/products/docker-desktop) which is available for GNU/Linux, macOS and Windows.
|
||||
|
||||
In the repo root run
|
||||
|
||||
```bash
|
||||
scripts/build_wasm_docker.sh
|
||||
```
|
||||
|
||||
This will build both Debug and Release configurations and will include the load test application. Builds are done with the official Emscripten Docker image. Output will be written to the folders `build/web-{debug,release}`.
|
||||
|
||||
If you are using Windows you will need a Unix-like shell such as the one with _Git for Windows_ or one in Windows Subsystem for Linux (WSL) to run this script.
|
||||
|
||||
#### Using Your Own Emscripten Installation
|
||||
|
||||
Install [Emscripten](https://emscripten.org) and follow the [install instructions](https://emscripten.org/docs/getting_started/downloads.html) closely. After you've set up your emscripten environment in a terminal, run the following:
|
||||
|
||||
**Debug:**
|
||||
|
||||
```bash
|
||||
# Configure
|
||||
emcmake cmake -B build-web-debug . -D CMAKE_BUILD_TYPE=Debug
|
||||
|
||||
# Build
|
||||
cmake --build build-web-debug --config Debug
|
||||
```
|
||||
|
||||
**Release:**
|
||||
|
||||
```bash
|
||||
# Configure
|
||||
emcmake cmake -B build-web .
|
||||
|
||||
# Build
|
||||
cmake --build build-web
|
||||
```
|
||||
|
||||
To include the load test application into the build add `-DKTX_FEATURE_LOADTEST_APPS=ON` to either of the above configuration steps.
|
||||
|
||||
Web builds create three additional targets:
|
||||
|
||||
- `ktx_js` (libktx javascript wrapper - with write support)
|
||||
- `ktx_js_read` (libktx_read javascript wrapper - read-only)
|
||||
- `msc_basis_transcoder_js` (transcoder wrapper)
|
||||
|
||||
> **Note:** The libktx wrappers do not use the transcoder wrapper. They directly uses the underlying c++ transcoder.
|
||||
|
||||
### Windows
|
||||
|
||||
You need to install the following
|
||||
|
||||
- CMake
|
||||
- Visual Studio 2022. VS2025 will likely work but is untested.
|
||||
- [Doxygen](#doxygen) and [dot](#dot\(graphviz\)) (only if generating documentation)
|
||||
|
||||
To build the load test applications you also need to install
|
||||
|
||||
- [vcpkg](#vcpkg) (which will automatically install the actual dependencies: [SDL3](sdl3) and [assimp](assimp))
|
||||
- [Vulkan SDK](#vulkan-sdk)
|
||||
|
||||
For the load test applications you must also set these environment variables:
|
||||
|
||||
- `VCPKG_ROOT` to the location where you installed [vcpkg](#vcpkg).
|
||||
- `VULKAN_SDK` to the location where you installed VulkanSDK. Normally this is set during installation of the SDK.
|
||||
|
||||
Additional requirement for the OpenGL ES version of the load tests application
|
||||
|
||||
- [OpenGL ES emulator](#opengl-es-emulator-for-windows).
|
||||
|
||||
CMake can create solutions for Microsoft Visual Studio.
|
||||
|
||||
> **Note:** x86 (32-bit) Windows is not supported.
|
||||
|
||||
To build for Windows
|
||||
|
||||
```powershell
|
||||
# This creates a solution at `build/KTX-Software.sln`
|
||||
# containing the libktx and tools targets.
|
||||
cmake -B build .
|
||||
|
||||
# If you want to build the load test apps as well, set the
|
||||
# `KTX_FEATURE_LOADTEST_APPS` and `CMAKE_TOOLCHAIN_FILE`
|
||||
# parameters. vcpkg will automatically install the dependencies.
|
||||
cmake -B build . -D KTX_FEATURE_LOADTEST_APPS=ON -D CMAKE_TOOLCHAIN_FILE=$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
|
||||
|
||||
# Compile the project
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
To configure for Universal Windows Platform (Windows Store) you have to
|
||||
|
||||
- Set the platform to `x64`, `ARM` or `ARM64` (depending on your target device/platform)
|
||||
- Set the system name to `WindowsStore`
|
||||
- Provide a system version (e.g. `10.0`)
|
||||
|
||||
> **Note:** Support is currently limited to `ktx` and `libktx_read` (no tools, tests or load tests apps)
|
||||
|
||||
Example UWP configuration
|
||||
|
||||
```powershell
|
||||
cmake . -A ARM64 -B build_uwp_arm64 -D CMAKE_SYSTEM_NAME:String=WindowsStore -D CMAKE_SYSTEM_VERSION:String="10.0"
|
||||
# Build `ktx.dll` only
|
||||
cmake -B build_uwp_arm64 --target ktx
|
||||
```
|
||||
|
||||
A `bash` shell is needed by the `mkversion` script used during the build. If you installed your `git` via the
|
||||
[Git for Windows](https://gitforwindows.org/) package you are good to go.
|
||||
Alternatives are
|
||||
[Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install) plus a Linux distribution or [Cygwin](https://www.cygwin.com/). A contribution of a PowerShell equivalent script will be welcomed.
|
||||
|
||||
The NSIS compiler is needed if you intend to build packages.
|
||||
|
||||
CMake can include OpenGL ES versions of the KTX loader tests in the
|
||||
generated solution. To build and run these you need to install an
|
||||
OpenGL ES emulator. See [below](#opengl-es-emulator-for-windows).
|
||||
|
||||
##### Windows signing
|
||||
|
||||
To sign applications and the NSIS installer you need to import your certificate to an Azure Key Vault or to the Current User or Local Machine certificate store.
|
||||
The latter can be done interactively with Windows' commands `certmgr` and
|
||||
`certlm` respectively. You need to set the following CMake variables to
|
||||
turn on signing:
|
||||
|
||||
| Name | Value |
|
||||
| ---: | ----- |
|
||||
| CODE\_SIGN\_KEY\_VAULT | Where the signing certificate is stored. One of _Azure_, _Machine_, _User_. |
|
||||
| CODE\_SIGN\_TIMESTAMP\_URL | URL of the timestamp server to use. Usually provided by the issuer of your certificate. Timestamping is required as it keeps the signatures valid even after certificate expiration.
|
||||
|
||||
The following additional variables must be set if using Azure:
|
||||
|
||||
| Name | Value |
|
||||
| ---: | ----- |
|
||||
| AZURE\_KEY\_VAULT\_CERTIFICATE | Name of the certificate in Azure Key Vault.
|
||||
| AZURE\_KEY\_VAULT\_CLIENT\_ID | Id of an application (Client) registered with Azure that has permission to access the certificate.
|
||||
| AZURE\_KEY\_VAULT\_CLIENT\_SECRET | Secret to authenticate access to the Client.
|
||||
| AZURE\_KEY\_VAULT\_TENANT\_ID | Id of the Azure Active Directory (Tenant) holding the Client.
|
||||
| AZURE\_KEY\_VAULT\_URL | URL of the key vault
|
||||
|
||||
If using a local certificate store the following variables must be set instead:
|
||||
|
||||
| Name | Value |
|
||||
| ---: | ----- |
|
||||
| LOCAL\_KEY\_VAULT\_SIGNING\_IDENTITY | Subject Name of code signing certificate. Displayed in 'Issued To' field of cert{lm,mgr}. Overriden by LOCAL\_KEY\_VAULT\_CERTIFICATE\_THUMBPRINT.
|
||||
| LOCAL\_KEY\_VAULT\_CERTIFICATE\_THUMBPRINT | Thumbprint of the certificate to use. Use this instead of LOCAL\_KEY\_VAULT\_SIGNING\_IDENTITY when you have multiple certificates with the same identity.
|
||||
|
||||
#### OpenGL ES Emulator for Windows
|
||||
|
||||
The `es1loadtests` and `es3loadtests` targets on Windows require an
|
||||
OpenGL ES emulator.
|
||||
[Imagination Technologies PowerVR](https://community.imgtec.com/developers/powervr/graphics-sdk/).
|
||||
emulator is recommended. Any of the other major emulators listed below could also be used:
|
||||
|
||||
* [Qualcomm Adreno](https://developer.qualcomm.com/software/adreno-gpu-sdk/tools)
|
||||
* [Google ANGLE](https://chromium.googlesource.com/angle/angle/)<sup>*</sup>
|
||||
* [ARM Mali](http://malideveloper.arm.com/resources/tools/opengl-es-emulator/)
|
||||
|
||||
If you want to run the `es1loadtests` you will need to use
|
||||
Imagination Technologies' PowerVR emulator as that alone supports OpenGL ES
|
||||
1.1. You must set the CMake configuration variable `OPENGL_ES_EMULATOR` to the directory containing the .lib files of your chosen emulator and ensure the .dlls are in your `$env:PATH` or co-located with `es1loadtests`.
|
||||
|
||||
<sup>*</sup>You will need to build ANGLE yourself.
|
||||
|
||||
#### OpenCL for Windows
|
||||
|
||||
To build `libktx` such that the Basis Universal encoders will use
|
||||
OpenCL you need an OpenCL driver, which is typically included in the driver for your GPU, and an OpenCL SDK. If no SDK is present, the build will use the headers and library that are included in this repo.
|
||||
|
||||
### Android
|
||||
|
||||
Support is currently limited to libktx and libktx_read (no tools, tests or loadtest apps)
|
||||
|
||||
Requirements:
|
||||
|
||||
- [CMake](https://cmake.org)
|
||||
- [Android NDK](https://developer.android.com/ndk)
|
||||
|
||||
The path to the NDK, a CMake toolchain file (that comes with the NDK), the desired Android ABI and minimum API level have to be provided when configuring with CMake (see [Android NDK CMake guide](https://developer.android.com/ndk/guides/cmake) for more details/settings). Example:
|
||||
|
||||
```bash
|
||||
export ANDROID_NDK=/path/to/Android_NDK #This is the location of Android NDK
|
||||
# Configure
|
||||
cmake . -B "build-android" \
|
||||
-DANDROID_PLATFORM=android-24 \ # API level 24 equals Android 7.0
|
||||
-DANDROID_ABI="arm64-v8a" \ # target platform
|
||||
-DANDROID_NDK="$ANDROID_NDK" \
|
||||
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ # Toolchain file in a subfolder of the NDK
|
||||
-DBASISU_SUPPORT_SSE=OFF # Disable SSE
|
||||
|
||||
# Build
|
||||
cmake --build "build-android"
|
||||
```
|
||||
|
||||
> Note: SSE has to be disabled currently (for ABIs x86 and x86_64) due to [an issue](https://github.com/BinomialLLC/basis_universal/pull/233).
|
||||
|
||||
Conformance Test Suite
|
||||
------------
|
||||
|
||||
The submodule of [CTS Repository](https://github.com/KhronosGroup/KTX-Software-CTS/) is optional and
|
||||
only required for running the CTS tests during KTX development. If the CTS test suit is desired it
|
||||
can be fetched during cloning with the additional `--recurse-submodules` git clone flag:
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules git@github.com:KhronosGroup/KTX-Software.git
|
||||
```
|
||||
|
||||
If the repository was already cloned or whenever the submodule ref changes the submodule has to be
|
||||
updated with:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive tests/cts
|
||||
```
|
||||
|
||||
(For more information on submodules see the [git documentation](https://git-scm.com/book/en/v2/Git-Tools-Submodules).)
|
||||
|
||||
Once the submodule is fetched the CTS tests can be enabled with the `KTX_FEATURE_TOOLS_CTS`
|
||||
cmake option during cmake configuration. Please note that for `KTX_FEATURE_TOOLS_CTS` to take
|
||||
effect both `KTX_FEATURE_TESTS` and `KTX_FEATURE_TOOLS` has to be also enabled.
|
||||
The CTS integrates into `ctest` so running `ctest` will also execute the CTS tests too.
|
||||
The test cases can be limited to the CTS tests with `ctest -R ktxToolsTest`.
|
||||
|
||||
Example for development workflow with CTS testing:
|
||||
|
||||
```bash
|
||||
# Git clone and submodule fetch
|
||||
git clone git@github.com:KhronosGroup/KTX-Software.git
|
||||
cd KTX-Software/
|
||||
git submodule update --init --recursive tests/cts
|
||||
# Configure
|
||||
mkdir build
|
||||
cmake -B build . -DKTX_FEATURE_DOC=ON -DBUILD_SHARED_LIBS=OFF -DKTX_FEATURE_TOOLS=ON -DKTX_FEATURE_TESTS=ON -DKTX_FEATURE_TOOLS_CTS=ON
|
||||
# Build everything (depending on workflow its better to build the specific target like 'ktxtools'):
|
||||
cmake --build build --target all
|
||||
# Run every test case:
|
||||
ctest --test-dir build
|
||||
# Run only the CTS test cases:
|
||||
ctest --test-dir build -R ktxToolsTest
|
||||
```
|
||||
|
||||
To create and update CTS test cases and about their specific features and usages
|
||||
see the [CTS documentation](https://github.com/KhronosGroup/KTX-Software-CTS/blob/main/README.md).
|
||||
|
||||
Generated Source Files (project developers only)
|
||||
------------
|
||||
All but a few project developers can ignore this section. The files discussed here only need to be re-generated when formats are added to Vulkan or errors are discovered. These will be rare occurrences.
|
||||
|
||||
The following files related to the the VkFormat enum are generated from `vulkan_core.h`:
|
||||
|
||||
- lib/vkformat_check.c
|
||||
- lib/vkformat_enum.h
|
||||
- lib/vkformat_list.inl
|
||||
- lib/vkformat_str.c
|
||||
- lib/vkformat_typesize.c
|
||||
- lib/dfd/dfd2vk.inl
|
||||
- lib/dfd/vk2dfd.inl
|
||||
- interface/java\_binding/src/main/java/org/khronos/ktxVkFormat.java
|
||||
- interface/python\_binding/pyktx/vk\_format.py
|
||||
- interface/js\_binding/vk\_format.inl
|
||||
|
||||
|
||||
The following files are generated from the mapping database in the KTX-Specification repo by `generate_format_switches.rb`:
|
||||
|
||||
- lib/vkFormat2glFormat.inl
|
||||
- lib/vkFormat2glInternalFormat.inl
|
||||
- lib/vkFormat2glType.inl
|
||||
|
||||
All are generated by the `mkvk` target which is only configured if `KTX_GENERATE_VK_FILES` is set to `ON` at the time of CMake configuration. Since this setting is labelled *Advanced* it will not be visible in the CMake GUI unless `Advanced` is set.
|
||||
|
||||
Configuring this target adds some dependencies which are discussed below.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
### awk
|
||||
|
||||
Needed if you are [regenerating source files](#generatedsourcefiles(projectdevelopersonly)).
|
||||
|
||||
Standard on GNU/Linux and macOS. Available on Windows as part of Git for
|
||||
Windows, WSL (Windows Subsystem for Linux) or Cygwin. Note that no CMake
|
||||
`AWK_EXECUTABLE` cache variable is used because *awk* is standard on GNU/Linux
|
||||
and macOS and on Windows *awk* tends to be available when *bash* is and there
|
||||
the *awk* script is invoked via *bash*.
|
||||
|
||||
### bash
|
||||
|
||||
Needed for the script that creates the version numbers from `git describe` output. Also needed if you are [regenerating source files](#generatedsourcefiles(projectdevelopersonly)).
|
||||
|
||||
Standard on GNU/Linux and macOS. Available on Windows as part of Git for
|
||||
Windows, WSL (Windows Subsystem for Linux) or Cygwin.
|
||||
|
||||
#### vcpkg
|
||||
|
||||
This package manager is needed to install the [SDL3](#sdl3) and [assimp](assimp)
|
||||
dependencies of the KTX load test applications on macOS and Windows. Since
|
||||
KTX-Software uses vcpkg's manifest mode, installation of the dependencies is
|
||||
automatic.
|
||||
|
||||
Clone the [vcpkg](https://github.com/microsoft/vcpkg) repo and run its
|
||||
bootstrap:
|
||||
|
||||
```bash
|
||||
cd /place/to/clone/vcpkg
|
||||
git clone https://github.com/microsoft/vcpkg
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.sh -disableMetrics
|
||||
# On Windows use ./bootstrap-vcpkg.bat
|
||||
```
|
||||
|
||||
For more information see the
|
||||
[vcpkg with CMake](https://learn.microsoft.com/vcpkg/get_started/get-started)
|
||||
Getting Started guide. Ignore all but the installation instructions. Set the
|
||||
environment variable `VCPKG_ROOT` to where you have installed _vcpkg_ and set
|
||||
`CMAKE_TOOLCHAIN_FILE` to `$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake` when
|
||||
using CMake to configure your project.
|
||||
|
||||
### SDL3
|
||||
|
||||
Simple Direct Media Layer. Needed if you want to build the KTX load tests.
|
||||
|
||||
On GNU_Linx, iOS, macOS and Windows it will be automatically installed by
|
||||
[vcpkg](#vcpkg). Libraries installed by other package managers are typically
|
||||
not redistributable or bundle-able.
|
||||
|
||||
Canonical source is at https://github.com/libsdl-org/SDL/tree/SDL3.
|
||||
|
||||
### assimp
|
||||
|
||||
Open Asset Import Library. Needed if you want to build the KTX load tests.
|
||||
|
||||
On GNU/Linux install `libassimp-dev` using your package manager. On
|
||||
iOS. macOS and Windows it will be automatically installed by [vcpkg](#vcpkg).
|
||||
|
||||
Canonical source is at https://github.com/assimp/assimp.
|
||||
|
||||
### Vulkan SDK
|
||||
|
||||
Needed if you want to build the KTX Vulkan load tests, `vkloadtests`. The minimum required version is 1.3.283.0.
|
||||
|
||||
Download the [Vulkan SDK from Lunar G](https://vulkan.lunarg.com/sdk/home).
|
||||
|
||||
For Ubuntu (20.04 and 22.04) install packages are available. See [Getting
|
||||
Started - Ubuntu](https://vulkan.lunarg.com/doc/sdk/1.3.290.0/linux/getting_started_ubuntu.html) for detailed instructions.
|
||||
|
||||
For other GNU/Linux distributions a `.tar.gz` file is available. See
|
||||
[Getting Started - Tarball](https://vulkan.lunarg.com/doc/sdk/1.3.290.0/linux/getting_started.html) for detailed instructions.
|
||||
|
||||
For Windows install the Vulkan SDK via the installer.
|
||||
|
||||
For iOS and macOS, install the Vulkan SDK by downloading the macOS installer and double-clicking _install_ in the mounted `.dmg`. This SDK contains MoltenVK (Vulkan Portability on Metal) for both iOS and macOS.
|
||||
|
||||
### Doxygen
|
||||
|
||||
Needed if you want to generate _libktx_, _ktxtools_ and other documentation.
|
||||
|
||||
You need a minimum of version 1.8.14 to generate the documentation correctly.
|
||||
You can download binaries and also find instructions for building it from source
|
||||
at [Doxygen downloads](http://www.stack.nl/~dimitri/doxygen/download.html). Make
|
||||
sure the directory containing the `doxygen` executable is in your `$PATH`.
|
||||
|
||||
### dot (Graphviz)
|
||||
|
||||
Needed if you want Doxygen to generate include dependency, inverse include
|
||||
dependency, inheritance and other graphs in the generated documentation.
|
||||
|
||||
You can download binaries from
|
||||
[Graphviz downloads](https://graphviz.org/download/).
|
||||
|
||||
Optional. If not present documentation will be generated minus graphs.
|
||||
|
||||
### OpenCL
|
||||
|
||||
Needed if you want to enable the Basis Universal encoders to use OpenCL when
|
||||
building _libktx_.
|
||||
|
||||
On GNU/Linux and Windows you need to install an OpenCL SDK and OpenCL driver. Drivers are standard on macOS & iOS and Xcode includes the SDK. On GNU/Linux the SDK can be installed using your package manager. On Windows, the place from which to download the SDK depends on your GPU vendor. In both cases, the GPU driver typically includes an OpenCL driver.
|
||||
|
||||
### Python
|
||||
|
||||
*If you are building pyktx*, review the requirements in the [pyktx](interface/python_binding/README.md) README.
|
||||
|
||||
### Perl
|
||||
|
||||
Needed if you are [regenerating source files](#generatedsourcefiles(projectdevelopersonly)).
|
||||
|
||||
On GNU/Linux install `perl` using your package manager. On macOS Perl is still
|
||||
included as of macOS Sonoma. In future you may need to install an additional
|
||||
package. On Windows, you need a Perl that writes Windows line endings (CRLF).
|
||||
Strawberry Perl via Chocolatey is recommended.
|
||||
|
||||
```powershell
|
||||
choco install strawberryperl
|
||||
```
|
||||
|
||||
### Ruby
|
||||
|
||||
Needed if you are [regenerating source files](#generatedsourcefiles(projectdevelopersonly)).
|
||||
|
||||
Ruby version 3 or later is required. On GNU/Linux install `ruby` using your
|
||||
package manager. On macOS install using a package manager such as Brew or with
|
||||
[RVM (Ruby Version Manager)](https://rvm.io/rvm/install). Note that Ruby is included in the Xcode command line tools but as of Xcode 15.3 is still version
|
||||
2.6. On Windows use [RubyInstaller](https://rubyinstaller.org/).
|
||||
|
||||
### KTX Specification Source
|
||||
|
||||
Needed if you are [regenerating source files](#generatedsourcefiles(projectdevelopersonly)).
|
||||
|
||||
`git clone https://github.com/KhronosGroup/KTX-Specification` to a peer
|
||||
directory of your KTX-Software workarea or set the value of the
|
||||
`KTX_SPECIFICATION` CMake cache variable to the location of your specification
|
||||
clone.
|
||||
|
||||
Formatting
|
||||
------------
|
||||
|
||||
The KTX repository is transitioning to enforcing a set of formatting guides, checked during CI.
|
||||
The tool used for this is [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html).
|
||||
To minimize friction, it is advised that one configure their environment to run ClangFormat in an automated fashion,
|
||||
minimally before committing to source control, ideally on every save.
|
||||
|
||||
### Visual Studio Code
|
||||
|
||||
Set the [`editor.formatOnSave`](https://code.visualstudio.com/docs/editor/codebasics#_formatting) option and use one of the C/C++ formatting extensions available, most notably [ms-vscode.cpptools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) or [llvm-vs-code-extensions.vscode-clangd](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd).
|
||||
|
||||
|
||||
{# vim: set ai ts=4 sts=4 sw=2 expandtab textwidth=75:}
|
||||
@@ -0,0 +1,4 @@
|
||||
Copyright 2013-2020 Mark Callow
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
A reminder that this issue tracker is managed by the Khronos Group. Interactions here should follow the Khronos Code of Conduct (https://www.khronos.org/developers/code-of-conduct), which prohibits aggressive or derogatory language. Please keep the discussion friendly and civil.
|
||||
@@ -0,0 +1,16 @@
|
||||
<!-- Copyright 2013-2020 Mark Callow -->
|
||||
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
||||
|
||||
## How to contribute to the KTX library and tools.
|
||||
|
||||
1. Make sure you have a GitHub account.
|
||||
2. Fork the repository on GitHub.
|
||||
3. Make changes to your clone of the repository.
|
||||
4. Update or supplement the tests as necessary in this
|
||||
repository and in the [Conformance Test Suite](https://github.com/KhronosGroup/KTX-Software-CTS/).
|
||||
5. Submit a pull request against _main_.
|
||||
|
||||
If you will be generating documentation with or preparing
|
||||
distribution archives, you **must** follow
|
||||
[these instructions](README.md#kwexpansion) to install a
|
||||
smudge/clean filter for expanding keywords.
|
||||
@@ -0,0 +1,36 @@
|
||||
LICENSE file for the KhronosGroup/KTX-Software project {#license}
|
||||
======================================================
|
||||
|
||||
<!--
|
||||
Can't put at start. Doxygen requires page title on first line.
|
||||
Copyright 2013-2020 Mark Callow
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
Files unique to this repository generally fall under the Apache 2.0 license
|
||||
with copyright holders including Mark Callow, the KTX-Software author; The
|
||||
Khronos Group Inc., which has supported KTX development; and other
|
||||
contributors to the KTX project.
|
||||
|
||||
Because KTX-Software incorporates material and contributions from many other
|
||||
projects, which often have their own licenses, there are many other licenses
|
||||
in use in this repository. While there are many licenses in this repository,
|
||||
with rare exceptions all are open source licenses that we believe to be
|
||||
mutually compatible.
|
||||
|
||||
The complete text of each of the licenses used in this repository is found
|
||||
in LICENSES/*.txt . Additionally, we have updated the repository to pass the
|
||||
REUSE compliance checker tool (see https://reuse.software/). REUSE verifies
|
||||
that every file in a git repository either incorporates a license, or that
|
||||
the license is present in auxiliary files such as .reuse/dep5 . To obtain a
|
||||
bill of materials for the repository identifying the license for each file,
|
||||
install the REUSE tool and run
|
||||
|
||||
reuse spdx
|
||||
|
||||
inside the repository.
|
||||
|
||||
## Special Cases
|
||||
|
||||
The file lib/etcdec.cxx is not open source. It is made available under the
|
||||
terms of an Ericsson license, found in the file itself.
|
||||
@@ -0,0 +1,208 @@
|
||||
Apache License
|
||||
|
||||
Version 2.0, January 2004
|
||||
|
||||
http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION,
|
||||
AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution
|
||||
as defined by Sections 1 through 9 of this document.
|
||||
|
||||
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct
|
||||
or indirect, to cause the direction or management of such entity, whether
|
||||
by contract or otherwise, or (ii) ownership of fifty percent (50%) or more
|
||||
of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions
|
||||
granted by this License.
|
||||
|
||||
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation
|
||||
or translation of a Source form, including but not limited to compiled object
|
||||
code, generated documentation, and conversions to other media types.
|
||||
|
||||
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form,
|
||||
made available under the License, as indicated by a copyright notice that
|
||||
is included in or attached to the work (an example is provided in the Appendix
|
||||
below).
|
||||
|
||||
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form,
|
||||
that is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative
|
||||
Works shall not include works that remain separable from, or merely link (or
|
||||
bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative
|
||||
Works thereof, that is intentionally submitted to Licensor for inclusion in
|
||||
the Work by the copyright owner or by an individual or Legal Entity authorized
|
||||
to submit on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication
|
||||
sent to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor
|
||||
for the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently incorporated
|
||||
within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this
|
||||
License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||
no-charge, royalty-free, irrevocable copyright license to reproduce, prepare
|
||||
Derivative Works of, publicly display, publicly perform, sublicense, and distribute
|
||||
the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License,
|
||||
each Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
|
||||
no-charge, royalty-free, irrevocable (except as stated in this section) patent
|
||||
license to make, have made, use, offer to sell, sell, import, and otherwise
|
||||
transfer the Work, where such license applies only to those patent claims
|
||||
licensable by such Contributor that are necessarily infringed by their Contribution(s)
|
||||
alone or by combination of their Contribution(s) with the Work to which such
|
||||
Contribution(s) was submitted. If You institute patent litigation against
|
||||
any entity (including a cross-claim or counterclaim in a lawsuit) alleging
|
||||
that the Work or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses granted to You
|
||||
under this License for that Work shall terminate as of the date such litigation
|
||||
is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or
|
||||
Derivative Works thereof in any medium, with or without modifications, and
|
||||
in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy
|
||||
of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that
|
||||
You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source
|
||||
form of the Work, excluding those notices that do not pertain to any part
|
||||
of the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution,
|
||||
then any Derivative Works that You distribute must include a readable copy
|
||||
of the attribution notices contained within such NOTICE file, excluding those
|
||||
notices that do not pertain to any part of the Derivative Works, in at least
|
||||
one of the following places: within a NOTICE text file distributed as part
|
||||
of the Derivative Works; within the Source form or documentation, if provided
|
||||
along with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works
|
||||
that You distribute, alongside or as an addendum to the NOTICE text from the
|
||||
Work, provided that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction,
|
||||
or distribution of Your modifications, or for any such Derivative Works as
|
||||
a whole, provided Your use, reproduction, and distribution of the Work otherwise
|
||||
complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any
|
||||
Contribution intentionally submitted for inclusion in the Work by You to the
|
||||
Licensor shall be under the terms and conditions of this License, without
|
||||
any additional terms or conditions. Notwithstanding the above, nothing herein
|
||||
shall supersede or modify the terms of any separate license agreement you
|
||||
may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names,
|
||||
trademarks, service marks, or product names of the Licensor, except as required
|
||||
for reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to
|
||||
in writing, Licensor provides the Work (and each Contributor provides its
|
||||
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied, including, without limitation, any warranties
|
||||
or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness
|
||||
of using or redistributing the Work and assume any risks associated with Your
|
||||
exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether
|
||||
in tort (including negligence), contract, or otherwise, unless required by
|
||||
applicable law (such as deliberate and grossly negligent acts) or agreed to
|
||||
in writing, shall any Contributor be liable to You for damages, including
|
||||
any direct, indirect, special, incidental, or consequential damages of any
|
||||
character arising as a result of this License or out of the use or inability
|
||||
to use the Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all other commercial
|
||||
damages or losses), even if such Contributor has been advised of the possibility
|
||||
of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work
|
||||
or Derivative Works thereof, You may choose to offer, and charge a fee for,
|
||||
acceptance of support, warranty, indemnity, or other liability obligations
|
||||
and/or rights consistent with this License. However, in accepting such obligations,
|
||||
You may act only on Your own behalf and on Your sole responsibility, not on
|
||||
behalf of any other Contributor, and only if You agree to indemnify, defend,
|
||||
and hold each Contributor harmless for any liability incurred by, or claims
|
||||
asserted against, such Contributor by reason of your accepting any such warranty
|
||||
or additional liability. END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "[]" replaced with your own identifying
|
||||
information. (Don't include the brackets!) The text should be enclosed in
|
||||
the appropriate comment syntax for the file format. We also recommend that
|
||||
a file or class name and description of purpose be included on the same "printed
|
||||
page" as the copyright notice for easier identification within third-party
|
||||
archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
See the License for the specific language governing permissions and
|
||||
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,17 @@
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
|
||||
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,23 @@
|
||||
Copyright (c) <year> <owner>. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright (c) <year> <owner>. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,23 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,59 @@
|
||||
Creative Commons Attribution 3.0 Unported
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE.
|
||||
|
||||
License
|
||||
|
||||
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
|
||||
|
||||
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
|
||||
|
||||
1. Definitions
|
||||
|
||||
"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
|
||||
"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License.
|
||||
"Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership.
|
||||
"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
|
||||
"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
|
||||
"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
|
||||
"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
|
||||
"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
|
||||
"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
|
||||
2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
|
||||
|
||||
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
|
||||
|
||||
to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
|
||||
to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";
|
||||
to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
|
||||
to Distribute and Publicly Perform Adaptations.
|
||||
For the avoidance of doubt:
|
||||
|
||||
Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
|
||||
Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
|
||||
Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License.
|
||||
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved.
|
||||
|
||||
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
|
||||
|
||||
You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(b), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(b), as requested.
|
||||
If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4 (b) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
|
||||
Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.
|
||||
5. Representations, Warranties and Disclaimer
|
||||
|
||||
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
||||
|
||||
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
7. Termination
|
||||
|
||||
This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
|
||||
Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
|
||||
8. Miscellaneous
|
||||
|
||||
Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
|
||||
Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
|
||||
If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
|
||||
No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
|
||||
This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
|
||||
The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
|
||||
@@ -0,0 +1,96 @@
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
||||
|
||||
Section 1 – Definitions.
|
||||
|
||||
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
||||
Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
||||
Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
||||
Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
||||
Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
||||
Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
||||
Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
||||
Licensor means the individual(s) or entity(ies) granting rights under this Public License.
|
||||
Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
||||
Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
||||
You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
||||
|
||||
Section 2 – Scope.
|
||||
|
||||
License grant.
|
||||
Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
||||
reproduce and Share the Licensed Material, in whole or in part; and
|
||||
produce, reproduce, and Share Adapted Material.
|
||||
Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
||||
Term. The term of this Public License is specified in Section 6(a).
|
||||
Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
||||
Downstream recipients.
|
||||
Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
||||
No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
||||
No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
Other rights.
|
||||
Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
||||
Patent and trademark rights are not licensed under this Public License.
|
||||
To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
|
||||
|
||||
Section 3 – License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
||||
|
||||
Attribution.
|
||||
|
||||
If You Share the Licensed Material (including in modified form), You must:
|
||||
retain the following if it is supplied by the Licensor with the Licensed Material:
|
||||
identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
||||
a copyright notice;
|
||||
a notice that refers to this Public License;
|
||||
a notice that refers to the disclaimer of warranties;
|
||||
a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
||||
indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
||||
indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
||||
You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
||||
If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
||||
If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
|
||||
|
||||
Section 4 – Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
||||
|
||||
for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
|
||||
if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
|
||||
You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
||||
|
||||
Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
|
||||
To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
|
||||
|
||||
The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
||||
|
||||
Section 6 – Term and Termination.
|
||||
|
||||
This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
||||
|
||||
Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
||||
automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
||||
upon express reinstatement by the Licensor.
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
||||
For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
||||
Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
||||
|
||||
Section 7 – Other Terms and Conditions.
|
||||
|
||||
The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
||||
Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
||||
|
||||
Section 8 – Interpretation.
|
||||
|
||||
For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
||||
To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
||||
No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
||||
Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
|
||||
i. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
|
||||
4. Limitations and Disclaimers.
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
|
||||
@@ -0,0 +1,39 @@
|
||||
The following text is copied and pasted from https://github.com/AnalyticalGraphicsInc/cesium/wiki/CesiumTrademark.pdf, which are the "Trademark Terms and Conditions" under which an image in this repository was contributed by AGI. Please refer to the original link as the authoritative text; this file exists only for REUSE license-checker compliance.
|
||||
|
||||
Trademark Terms and Conditions
|
||||
|
||||
Analytical Graphics®, Cesium®, and Cesium Pro™ are trademarks owned by AGI. AGI uses these
|
||||
trademarks/logos to identify AGI as a company and also AGI’s products, services and activities. AGI maintains
|
||||
control over the usage of its trademarks, and this document sets forth who may use these trademarks, and under what
|
||||
terms and conditions these trademarks may be used.
|
||||
Fair Use
|
||||
AGI’s trademarks/logos may be used in instances when the use of such falls under a category of fair use. Examples
|
||||
of fair use include research, teaching, and educational purposes. If you use AGI’s trademarks/logos for this purpose,
|
||||
you must give AGI proper credit and identify AGI as the owner of the trademarks/logos.
|
||||
Do not use AGI’s trademarks/logos in any of your products or services that compete with any of AGI’s products or
|
||||
services. Use of AGI’s trademark/logos in your competing product or service is trademark infringement, and AGI
|
||||
will take legal action against you for violating this provision.
|
||||
Laymen’s Terms: You are not allowed to use the Cesium trademark to compete with AGI. If you do, AGI will take
|
||||
you to court. You can use the trademark without our permission for socially productive purposes, such as presenting
|
||||
Cesium in a conference. If you do so, make sure you identify AGI as the owner of the trademark.
|
||||
Usage Guidelines
|
||||
Avoid mistakes when reproducing AGI’s trademarks/logos. Do not separate the elements of the logo or alter the
|
||||
logo in any way. Do not rotate or animate it, and do not use any part of the logo as a graphic element, background,
|
||||
or pattern in any way that competes with AGI.
|
||||
Do not translate or localize the logos, and do not add anything to the logos. Do not attempt to set the logotype,
|
||||
change the font, or alter the size, proportions, or space between letters. You must use AGI’s trademarks/logos
|
||||
exactly as they are provided by AGI.
|
||||
Laymen’s Terms: When using our trademark(s), do not modify or change them in any way.
|
||||
Other Uses
|
||||
For any uses other than those identified in this document, you must contact AGI for express written permission. AGI
|
||||
reserves the right to reject your request to use AGI’s trademarks/logos for any reason. AGI’s contact information is
|
||||
below.
|
||||
Laymen’s Terms: You need our permission to use our trademarks for any reasons not stated above. If you send us a
|
||||
request to use our trademarks, we can say no for any reason.
|
||||
|
||||
Corporate Contact Info:
|
||||
Analytical Graphics, Inc.
|
||||
220 Valley Creek Blvd.
|
||||
Exton, Pennsylvania 19341
|
||||
1.610.981-8000
|
||||
contracts@agi.com
|
||||
@@ -0,0 +1,109 @@
|
||||
(C) Ericsson AB 2013. All Rights Reserved.
|
||||
|
||||
Software License Agreement
|
||||
|
||||
PLEASE REVIEW THE FOLLOWING TERMS AND CONDITIONS PRIOR TO USING THE
|
||||
ERICSSON TEXTURE COMPRESSION CODEC SOFTWARE (THE "SOFTWARE"). THE USE
|
||||
OF THE SOFTWARE IS SUBJECT TO THE TERMS AND CONDITIONS OF THE
|
||||
FOLLOWING SOFTWARE LICENSE AGREEMENT (THE "SLA"). IF YOU DO NOT ACCEPT
|
||||
SUCH TERMS AND CONDITIONS YOU MAY NOT USE THE SOFTWARE.
|
||||
|
||||
Subject to the terms and conditions of the SLA, the licensee of the
|
||||
Software (the "Licensee") hereby, receives a non-exclusive,
|
||||
non-transferable, limited, free-of-charge, perpetual and worldwide
|
||||
license, to copy, use, distribute and modify the Software, but only
|
||||
for the purpose of developing, manufacturing, selling, using and
|
||||
distributing products including the Software in binary form, which
|
||||
products are used for compression and/or decompression according to
|
||||
the Khronos standard specifications OpenGL, OpenGL ES and
|
||||
WebGL. Notwithstanding anything of the above, Licensee may distribute
|
||||
[etcdec.cxx] in source code form provided (i) it is in unmodified
|
||||
form; and (ii) it is included in software owned by Licensee.
|
||||
|
||||
If Licensee institutes, or threatens to institute, patent litigation
|
||||
against Ericsson or Ericsson's affiliates for using the Software for
|
||||
developing, having developed, manufacturing, having manufactured,
|
||||
selling, offer for sale, importing, using, leasing, operating,
|
||||
repairing and/or distributing products (i) within the scope of the
|
||||
Khronos framework; or (ii) using software or other intellectual
|
||||
property rights owned by Ericsson or its affiliates and provided under
|
||||
the Khronos framework, Ericsson shall have the right to terminate this
|
||||
SLA with immediate effect. Moreover, if Licensee institutes, or
|
||||
threatens to institute, patent litigation against any other licensee
|
||||
of the Software for using the Software in products within the scope of
|
||||
the Khronos framework, Ericsson shall have the right to terminate this
|
||||
SLA with immediate effect. However, should Licensee institute, or
|
||||
threaten to institute, patent litigation against any other licensee of
|
||||
the Software based on such other licensee's use of any other software
|
||||
together with the Software, then Ericsson shall have no right to
|
||||
terminate this SLA.
|
||||
|
||||
This SLA does not transfer to Licensee any ownership to any Ericsson
|
||||
or third party intellectual property rights. All rights not expressly
|
||||
granted by Ericsson under this SLA are hereby expressly
|
||||
reserved. Furthermore, nothing in this SLA shall be construed as a
|
||||
right to use or sell products in a manner which conveys or purports to
|
||||
convey whether explicitly, by principles of implied license, or
|
||||
otherwise, any rights to any third party, under any patent of Ericsson
|
||||
or of Ericsson's affiliates covering or relating to any combination of
|
||||
the Software with any other software or product (not licensed
|
||||
hereunder) where the right applies specifically to the combination and
|
||||
not to the software or product itself.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS". ERICSSON MAKES NO REPRESENTATIONS OF
|
||||
ANY KIND, EXTENDS NO WARRANTIES OR CONDITIONS OF ANY KIND, EITHER
|
||||
EXPRESS, IMPLIED OR STATUTORY; INCLUDING, BUT NOT LIMITED TO, EXPRESS,
|
||||
IMPLIED OR STATUTORY WARRANTIES OR CONDITIONS OF TITLE,
|
||||
MERCHANTABILITY, SATISFACTORY QUALITY, SUITABILITY, AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE SOFTWARE IS WITH THE LICENSEE. SHOULD THE SOFTWARE PROVE
|
||||
DEFECTIVE, THE LICENSEE ASSUMES THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION. ERICSSON MAKES NO WARRANTY THAT THE MANUFACTURE,
|
||||
SALE, OFFERING FOR SALE, DISTRIBUTION, LEASE, USE OR IMPORTATION UNDER
|
||||
THE SLA WILL BE FREE FROM INFRINGEMENT OF PATENTS, COPYRIGHTS OR OTHER
|
||||
INTELLECTUAL PROPERTY RIGHTS OF OTHERS, AND THE VALIDITY OF THE
|
||||
LICENSE AND THE SLA ARE SUBJECT TO LICENSEE'S SOLE RESPONSIBILITY TO
|
||||
MAKE SUCH DETERMINATION AND ACQUIRE SUCH LICENSES AS MAY BE NECESSARY
|
||||
WITH RESPECT TO PATENTS, COPYRIGHT AND OTHER INTELLECTUAL PROPERTY OF
|
||||
THIRD PARTIES.
|
||||
|
||||
THE LICENSEE ACKNOWLEDGES AND ACCEPTS THAT THE SOFTWARE (I) IS NOT
|
||||
LICENSED FOR; (II) IS NOT DESIGNED FOR OR INTENDED FOR; AND (III) MAY
|
||||
NOT BE USED FOR; ANY MISSION CRITICAL APPLICATIONS SUCH AS, BUT NOT
|
||||
LIMITED TO OPERATION OF NUCLEAR OR HEALTHCARE COMPUTER SYSTEMS AND/OR
|
||||
NETWORKS, AIRCRAFT OR TRAIN CONTROL AND/OR COMMUNICATION SYSTEMS OR
|
||||
ANY OTHER COMPUTER SYSTEMS AND/OR NETWORKS OR CONTROL AND/OR
|
||||
COMMUNICATION SYSTEMS ALL IN WHICH CASE THE FAILURE OF THE SOFTWARE
|
||||
COULD LEAD TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL, MATERIAL OR
|
||||
ENVIRONMENTAL DAMAGE. LICENSEE'S RIGHTS UNDER THIS LICENSE WILL
|
||||
TERMINATE AUTOMATICALLY AND IMMEDIATELY WITHOUT NOTICE IF LICENSEE
|
||||
FAILS TO COMPLY WITH THIS PARAGRAPH.
|
||||
|
||||
IN NO EVENT SHALL ERICSSON BE LIABLE FOR ANY DAMAGES WHATSOEVER,
|
||||
INCLUDING BUT NOT LIMITED TO PERSONAL INJURY, ANY GENERAL, SPECIAL,
|
||||
INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING
|
||||
BUT NOT LIMITED TO LOSS OF PROFITS, BUSINESS INTERUPTIONS, OR ANY
|
||||
OTHER COMMERCIAL DAMAGES OR LOSSES, LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY THE LICENSEE OR THIRD
|
||||
PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER
|
||||
SOFTWARE) REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT, OR
|
||||
OTHERWISE), EVEN IF THE LICENSEE OR ANY OTHER PARTY HAS BEEN ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
Licensee acknowledges that "ERICSSON ///" is the corporate trademark
|
||||
of Telefonaktiebolaget LM Ericsson and that both "Ericsson" and the
|
||||
figure "///" are important features of the trade names of
|
||||
Telefonaktiebolaget LM Ericsson. Nothing contained in these terms and
|
||||
conditions shall be deemed to grant Licensee any right, title or
|
||||
interest in the word "Ericsson" or the figure "///". No delay or
|
||||
omission by Ericsson to exercise any right or power shall impair any
|
||||
such right or power to be construed to be a waiver thereof. Consent by
|
||||
Ericsson to, or waiver of, a breach by the Licensee shall not
|
||||
constitute consent to, waiver of, or excuse for any other different or
|
||||
subsequent breach.
|
||||
|
||||
This SLA shall be governed by the substantive law of Sweden. Any
|
||||
dispute, controversy or claim arising out of or in connection with
|
||||
this SLA, or the breach, termination or invalidity thereof, shall be
|
||||
submitted to the exclusive jurisdiction of the Swedish Courts.
|
||||
@@ -0,0 +1,5 @@
|
||||
The HI logo textures are copyright by & trademarks of HI Corporation and are
|
||||
provided for use only in testing the KTX loader. Any other use requires
|
||||
specific prior written permission from HI. Furthermore the name HI may
|
||||
not be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
@@ -0,0 +1,7 @@
|
||||
This LICENSES file applies to images from the Kodak Lossless True Color
|
||||
Image Suite, and exists only for REUSE compliance. According to
|
||||
http://r0k.us/graphics/kodak/ , for such images:
|
||||
|
||||
"It is my understanding they have been released by the Eastman Kodak Company
|
||||
for unrestricted usage. Many sites use them as a standard test suite for
|
||||
compression testing, etc."
|
||||
@@ -0,0 +1,14 @@
|
||||
The following text is copied and pasted from
|
||||
http://www.schaik.com/pngsuite/PngSuite.LICENSE , which is the license under
|
||||
which an image from the PngSuite project is used. Please refer to the
|
||||
original link as the authoritative text; this file exists only for REUSE
|
||||
license-checker compliance.
|
||||
|
||||
PngSuite
|
||||
--------
|
||||
|
||||
Permission to use, copy, modify and distribute these images for any
|
||||
purpose and without fee is hereby granted.
|
||||
|
||||
|
||||
(c) Willem van Schaik, 1996, 2011
|
||||
@@ -0,0 +1,27 @@
|
||||
Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
--- Optional exception to the license ---
|
||||
|
||||
As an exception, if, as a result of your compiling your source code, portions
|
||||
of this Software are embedded into a machine-executable object form of such
|
||||
source code, you may redistribute such embedded portions in such object form
|
||||
without including the above copyright and permission notices.
|
||||
@@ -0,0 +1,19 @@
|
||||
MIT License Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,20 @@
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
@@ -0,0 +1 @@
|
||||
LICENSE.md
|
||||
@@ -0,0 +1,165 @@
|
||||
<!-- Copyright 2013-2020 Mark Callow -->
|
||||
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
||||
|
||||
<img src="https://www.khronos.org/assets/images/api_logos/khronos.svg" width="300"/>
|
||||
|
||||
## The Official Khronos KTX Software Repository
|
||||
|
||||
|
||||
| GNU/Linux | iOS, macOS | Web / wasm | Windows | Android | Mingw |
|
||||
| :-------: | :--------: | :--------: | :-----: | :-----: | :---: |
|
||||
|  |  |  |  |  |  |
|
||||
|
||||
| Documentation | Check-reuse | Check-mkvk |
|
||||
| :-----------: | :---------: | :--------: |
|
||||
|  |  | 
|
||||
|
||||
This is the official home of the source code for the Khronos KTX library and tools.
|
||||
|
||||
KTX (Khronos Texture) is a lightweight container for textures for OpenGL<sup>®</sup>, Vulkan<sup>®</sup> and other GPU APIs. KTX files contain all the parameters needed for texture loading. A single file can contain anything from a simple base-level 2D texture through to a cubemap array texture with mipmaps. Contained textures can be in a Basis Universal format, in any of the block-compressed formats supported by OpenGL family and Vulkan APIs and extensions or in an uncompressed single-plane format. Basis Universal currently encompasses two formats that can be quickly transcoded to any GPU-supported format: LZ/ETC1S, which combines block-compression and supercompression, and UASTC, a block-compressed format. Formats other than LZ/ETC1S can be supercompressed with Zstd and ZLIB.
|
||||
|
||||
Download [KTX Software Releases](https://github.com/KhronosGroup/KTX-Software/releases)
|
||||
to get binary packages of the tools, library and development headers
|
||||
described below. The [Releases](https://github.com/KhronosGroup/KTX-Software/releases)
|
||||
page also has packages with the Javascript wrappers and .wasm binaries.
|
||||
|
||||
See the Doxygen generated [live documentation](https://github.khronos.org/KTX-Software/)
|
||||
for API and tool usage information.
|
||||
|
||||
The software consists of: (links are to source folders in the KhronosGroup repo)
|
||||
|
||||
- *libktx* - a small library of functions for writing and reading KTX
|
||||
files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures
|
||||
from them. [`lib`](https://github.com/KhronosGroup/KTX-Software/tree/main/lib)
|
||||
- *libktx.{js,wasm}* - Web assembly version of libktx and
|
||||
Javascript wrapper. [`interface/js_binding`](https://github.com/KhronosGroup/KTX-Software/tree/main/interface/js_binding)
|
||||
- *msc\_basis\_transcoder.{js,wasm}* - Web assembly transcoder and
|
||||
Javascript wrapper for Basis Universal formats. For use with KTX parsers written in Javascript. [`interface/js_binding`](https://github.com/KhronosGroup/KTX-Software/tree/main/interface/js_binding)
|
||||
- *libktx.jar, libktx-jni* - Java wrapper and native interface library.
|
||||
[`interface/java_binding`](https://github.com/KhronosGroup/KTX-Software/tree/main/interface/java_binding)
|
||||
- *ktx* - a generic command line tool for managing KTX2 files with subcommands.[`tools/ktx`](https://github.com/KhronosGroup/KTX-Software/tree/main/tools/ktx)
|
||||
- *ktx compare* - Compare two KTX2 files
|
||||
- *ktx create* - Create a KTX2 file from various input files
|
||||
- *ktx deflate* - Deflate a KTX2 file with zstd or ZLIB
|
||||
- *ktx extract* - Export selected images from a KTX2 file
|
||||
- *ktx encode* - Encode a KTX2 file
|
||||
- *ktx transcode* - Transcode a KTX2 file
|
||||
- *ktx info* - Prints information about a KTX2 file
|
||||
- *ktx validate* - Validate a KTX2 file
|
||||
- *ktx help* - Display help information about the ktx tools
|
||||
- *ktx2check* - a tool for validating KTX Version 2 format files. [`tools/ktx2check`](https://github.com/KhronosGroup/KTX-Software/tree/main/tools/ktx2check)
|
||||
- *ktx2ktx2* - a tool for converting a KTX Version 1 file to a KTX
|
||||
Version 2 file. [`tools/ktx2ktx2`](https://github.com/KhronosGroup/KTX-Software/tree/main/tools/ktx2ktx2)
|
||||
- *ktxinfo* - a tool to display information about a KTX file in
|
||||
human readable form. [`tools/ktxinfo`](https://github.com/KhronosGroup/KTX-Software/tree/main/tools/ktxinfo)
|
||||
- *ktxsc* - a tool to supercompress a KTX Version 2 file that
|
||||
contains uncompressed images.[`tools/ktxsc`](https://github.com/KhronosGroup/KTX-Software/tree/main/tools/ktxsc)
|
||||
- *pyktx* - Python wrapper
|
||||
- *toktx* - a tool to create KTX files from PNG, Netpbm or JPEG format images. It supports mipmap generation, encoding to
|
||||
Basis Universal formats and Zstd supercompression.[`tools/toktx`](https://github.com/KhronosGroup/KTX-Software/tree/main/tools/toktx)
|
||||
|
||||
See [CONTRIBUTING](CONTRIBUTING.md) for information about contributing.
|
||||
|
||||
See [LICENSE](LICENSE.md) for information about licensing.
|
||||
|
||||
See [BUILDING](BUILDING.md) for information about building the code.
|
||||
|
||||
<!--
|
||||
More information about KTX and links to tools that support it can be
|
||||
found on the
|
||||
[KTX page](http://www.khronos.org/opengles/sdk/tools/KTX/) of
|
||||
the [OpenGL ES SDK](http://www.khronos.org/opengles/sdk) on
|
||||
[khronos.org](http://www.khronos.org).
|
||||
-->
|
||||
|
||||
If you need help with using the KTX library or KTX tools, please use GitHub
|
||||
[Discussions](https://github.com/KhronosGroup/KTX-Software/discussions).
|
||||
To report problems use GitHub [issues](https://github.com/KhronosGroup/KTX/issues).
|
||||
|
||||
**IMPORTANT:** you **must** install the [Git LFS](https://github.com/github/git-lfs)
|
||||
command line extension in order to fully checkout this repository after cloning. You
|
||||
need at least version 1.1. If you did not have Git LFS installed at first checkout
|
||||
then, after installing it, you **must** run
|
||||
|
||||
```bash
|
||||
git lfs checkout
|
||||
```
|
||||
|
||||
### KTX-Software-CTS - Conformance Test Suite
|
||||
|
||||
The tests and test files for the generic command line `ktx` tool can be found in a separate
|
||||
[CTS Repository](https://github.com/KhronosGroup/KTX-Software-CTS/). To save space and bandwidth this repository
|
||||
is included with git submodule and by default it is not required for building the libraries or the tools.
|
||||
For more information about building, running and extending the CTS tests see [BUILDING](BUILDING.md#Conformance-Test-Suite)
|
||||
and [CTS README](https://github.com/KhronosGroup/KTX-Software-CTS/blob/main/README.md).
|
||||
|
||||
### <a id="kwexpansion"></a>$Date$ keyword expansion
|
||||
|
||||
A few files have `$Date$` keywords. If you care about having the proper
|
||||
dates shown or will be generating the documentation or preparing
|
||||
distribution archives, you **must** follow the instructions below.
|
||||
|
||||
$Date$ keywords are expanded via smudge & clean filters. To install
|
||||
the filters, issue the following commands in the root of your clone.
|
||||
|
||||
On Unix (Linux, Mac OS X, etc.) platforms and Windows using Git for
|
||||
Windows' Git Bash or Cygwin's bash terminal:
|
||||
|
||||
```bash
|
||||
./install-gitconfig.sh
|
||||
./scripts/smudge_date.sh
|
||||
|
||||
```
|
||||
|
||||
On Windows PowerShell (requires `git.exe` in a directory
|
||||
on your %PATH%):
|
||||
|
||||
```ps1
|
||||
install-gitconfig.ps1
|
||||
./scripts/smudge_date.ps1
|
||||
```
|
||||
|
||||
The first command adds an [include] of the repo's `.gitconfig` to the
|
||||
local git config file `.git/config`, i.e. the one in your clone of the repo.
|
||||
`.gitconfig` contains the config of the "keyworder" filter. The script in
|
||||
the second command forces a new checkout of the affected files to smudge them
|
||||
with their last modified date. This is unnecessary if you plan to edit
|
||||
these files.
|
||||
|
||||
### Useful Tools
|
||||
|
||||
#### scripts/gk
|
||||
|
||||
For finding strings within the KTX-Software source. Type `scripts/gk -h` for help. `gk` avoids looking in any build directories, `.git`, `external` or `tests/cts`.
|
||||
|
||||
#### scripts/ktx-compare-git
|
||||
|
||||
Wrapper that allows use of `ktx compare` when using `git diff` on KTX2 files.
|
||||
Together with this, `.gitconfig` now includes a *ktx-compare* diff command.
|
||||
Those wishing to use this must run, or have run, install-gitconfig.{ps1,sh}
|
||||
as described above for keyword expansion so that `.gitconfig` is
|
||||
included by your local `.git/config`.
|
||||
|
||||
You need to have the `ktx` command installed in a directory on your $PATH.
|
||||
|
||||
You need to add the line
|
||||
|
||||
```
|
||||
*.ktx2 binary diff=ktx-compare
|
||||
```
|
||||
|
||||
to your repo clone's `.git/info/attributes`. This is not included in the repo's
|
||||
`.gitattributes` because not everyone will have the `ktx` command installed nor have `.gitconfig` included by `.git/config`.
|
||||
|
||||
*NOTE:* This line in a user-global or system-global Git attributes file will not
|
||||
work because those are lower priority than `.gitattributes` so are read first
|
||||
and `.gitattributes` already has an entry for *.ktx2, indicating binary, which
|
||||
overrides anything from the global files.
|
||||
|
||||
To set up your `tests/cts` submodule to use this, copy the *ktx-compare* diff
|
||||
command to `.git/modules/tests/cts/config`. Depending on when you set up the
|
||||
submodule and when you ran `install-gitconfig.sh`, it may already be there.
|
||||
Add the attribute line to `.git/modules/tests/cts/info/attributes`.
|
||||
|
||||
We will be happy to accept a PR to add a .ps1 equivalent script.
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
<!-- Copyright 2025, The Khronos Group Inc. -->
|
||||
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
||||
Release Notes
|
||||
=============
|
||||
## Version 4.4.2
|
||||
### Notice
|
||||
v4.4.2 is an emergency release that replaces v4.4.1 which has been withdrawn. It
|
||||
fixes the version number in the release assets. There are no other changes
|
||||
compared to v4.4.1.
|
||||
|
||||
### Summary
|
||||
|
||||
* `ktxTexture2_DecodeAstc` now exposed in _libktx\_read_ on all platforms and in
|
||||
the JS bindings.
|
||||
* `ktx info` can now show info about KTX v1 files. It and the underlying _libktx_
|
||||
function now display GL type and format token names instead of hex values.
|
||||
* Many bugs and robustness issues have been fixed. Many of these address changes
|
||||
in CI runner images and the latest compilers.
|
||||
* ASTC encoder updated to 5.3.0.
|
||||
* LodePNG updated to 20250506.
|
||||
* Building with Visual Studio 2019 is no longer supported.
|
||||
|
||||
__The legacy tools will be removed in Release 4.5. Adjust your workflows accordingly.__
|
||||
|
||||
### New Features in v4.4.2
|
||||
#### libktx functions
|
||||
|
||||
* `ktxTexture2_DecodeAstc`, which decodes an ASTC format texture to an
|
||||
uncompressed format, is now available in _libktx\_read_ on all platforms and in
|
||||
both the _libktx_ and _libktx\_read_ JS bindings.
|
||||
* `ktxPrintKTX1InfoTextForStream`, which prints information about a KTX v1 file
|
||||
and was previously internal, is now exposed.
|
||||
|
||||
### Notable Fixes in v4.4.2
|
||||
|
||||
* A bug in mipmap generation in `ktx create` that led to sRGB images being
|
||||
resampled without first decoding to linear has been fixed. If you have affected
|
||||
KTX files you should regenerate your textures from their source images.
|
||||
* _libktx\_read_ no longer includes the ASTC encode functions, only the decode
|
||||
functions.
|
||||
* A bug that caused a hang in `ktx create`, when the source image is an RGB PNG
|
||||
file with an sBIT chunk and an alpha component is being added to the texture
|
||||
being created, has been fixed.
|
||||
|
||||
|
||||
### Known Issues
|
||||
|
||||
* Files deflated with zlib using *libktx* compiled with GCC and run on x86\_64 may not be bit-identical with those using *libktx* compiled with GCC and run on arm64.
|
||||
|
||||
* Users making Basis Universal encoded or GPU block compressed textures for WebGL must be aware of WebGL restrictions with regard to texture size and may need to resize input images appropriately before using the `ktx create` tool, or use the `--resize` feature to produce an appropriately sized texture. In general, the dimensions of block compressed textures must be a multiple of the block size in WebGL and for WebGL 1.0 textures must have power-of-two dimensions. Additional portability restrictions apply for glTF per the _KHR\_texture\_basisu_ extension which can be verified using the `--gltf-basisu` command-line option of `ktx validate`.
|
||||
|
||||
* Basis Universal encoding results (both ETC1S/LZ and UASTC) are non-deterministic across platforms. Results are valid but level sizes and data will differ slightly. See [issue #60](https://github.com/BinomialLLC/basis_universal/issues/60) in the basis_universal repository.
|
||||
|
||||
* UASTC RDO results differ from run to run unless multi-threading or RDO multi-threading is disabled. In `toktx` use `--threads 1` for the former or `--uastc_rdo_m` for the latter. As with the preceeding issue results are valid but level sizes will differ slightly. See [issue #151](https://github.com/BinomialLLC/basis_universal/issues/151) in the basis_universal repository.
|
||||
|
||||
* Neither the Vulkan nor GL loaders support depth/stencil textures.
|
||||
|
||||
### Changes since v4.4.0 (by part)
|
||||
### libktx
|
||||
|
||||
* 4.4.1 release prep (#1063) (0b10eb17e) (@MarkCallow)
|
||||
|
||||
* Add v1 support to ktx info (#1060) (3cd9e3447) (@MarkCallow)
|
||||
|
||||
* Remove mentions of retired edgewise-consulting.com. (#1058) (0306d6a61) (@MarkCallow)
|
||||
|
||||
* Export ktxTexture2\_DecodeAstc in JS bindings (#1034) (64a69009b) (@MarkCallow)
|
||||
|
||||
* Restore rotted bits: update vcpkg caching and pyktx to latest Python (#1033) (f753fcabe) (@MarkCallow)
|
||||
|
||||
* Fix for Emscripten 4.0.9 (#1026) (1a983763c) (@MarkCallow)
|
||||
|
||||
* Fix memory leaks. (#1007) (504b96247) (@MarkCallow)
|
||||
|
||||
### Tools
|
||||
|
||||
* Add v1 support to ktx info (#1060) (3cd9e3447) (@MarkCallow)
|
||||
|
||||
* Remove mentions of retired edgewise-consulting.com. (#1058) (0306d6a61) (@MarkCallow)
|
||||
|
||||
* Document that --generated-mipmap can't be used with --raw. (#1057) (1d7d44465) (@MarkCallow)
|
||||
|
||||
* Update fmt to latest release (v11.2) (#1056) (f5654c2b0) (@MarkCallow)
|
||||
|
||||
* Fix hang when adding alpha and PNG input has sBIT chunk. (#1054) (d9a0c2bd5) (@MarkCallow)
|
||||
|
||||
* Set color space in input image prior to resample. (#1051) (1daca0cdc) (@MarkCallow)
|
||||
|
||||
* Use relative rpaths to find installed library on macOS (#1046) (d47320c24) (@MarkCallow)
|
||||
|
||||
* Shut up warnings clang with libstdc++ emits about non-virtual destructors (#1012) (fbb5412f5) (@DanielGibson)
|
||||
|
||||
* Fix CLI error handling for --normalize. (#1016) (17d206239) (@MarkCallow)
|
||||
|
||||
* Update LodePNG to version 20241228, (#1015) (6d1fc82ca) (@MarkCallow)
|
||||
|
||||
### JS Bindings
|
||||
|
||||
* Export ktxTexture2\_DecodeAstc in JS bindings (#1034) (64a69009b) (@MarkCallow)
|
||||
|
||||
* Fix for Emscripten 4.0.9 (#1026) (1a983763c) (@MarkCallow)
|
||||
|
||||
### Java Bindings
|
||||
|
||||
* Use relative rpaths to find installed library on macOS (#1046) (d47320c24) (@MarkCallow)
|
||||
|
||||
### Python Bindings
|
||||
|
||||
* Restore rotted bits: update vcpkg caching and pyktx to latest Python (#1033) (f753fcabe) (@MarkCallow)
|
||||
|
||||
* Add option to use virtual environment for Python. (#1029) (b167e968c) (@MarkCallow)
|
||||
|
||||
* Bump setuptools from 70.0.0 to 78.1.1 in /interface/python\_binding (#1025) (94d0c3a81) (@dependabot[bot])
|
||||
|
||||
* Fix python deprecation warning. (#1018) (dac48df00) (@MarkCallow)
|
||||
|
||||
### External Package Dependencies
|
||||
|
||||
* Remove mentions of retired edgewise-consulting.com. (#1058) (0306d6a61) (@MarkCallow)
|
||||
|
||||
* Update fmt to latest release (v11.2) (#1056) (f5654c2b0) (@MarkCallow)
|
||||
|
||||
* Migrate loadtest apps to SDL3 (#1055) (443e12238) (@MarkCallow)
|
||||
|
||||
* Update ASTC encoder to 5.3.0 (#1036) (f6f0b9a1d) (@MarkCallow)
|
||||
|
||||
* Update lodepng to version 20250506 (#1035) (f9c73388a) (@MarkCallow)
|
||||
|
||||
* GCC14/C++23 compatibility fix (#1014) (f3f6b3b69) (@alexge50)
|
||||
|
||||
* Update LodePNG to version 20241228, (#1015) (6d1fc82ca) (@MarkCallow)
|
||||
|
||||
### Tests
|
||||
|
||||
* Add v1 support to ktx info (#1060) (3cd9e3447) (@MarkCallow)
|
||||
|
||||
* Remove mentions of retired edgewise-consulting.com. (#1058) (0306d6a61) (@MarkCallow)
|
||||
|
||||
* Update CTS ref to merged tests. (65b0031d7) (@MarkCallow)
|
||||
|
||||
* Document that --generated-mipmap can't be used with --raw. (#1057) (1d7d44465) (@MarkCallow)
|
||||
|
||||
* Update fmt to latest release (v11.2) (#1056) (f5654c2b0) (@MarkCallow)
|
||||
|
||||
* Migrate loadtest apps to SDL3 (#1055) (443e12238) (@MarkCallow)
|
||||
|
||||
* Fix hang when adding alpha and PNG input has sBIT chunk. (#1054) (d9a0c2bd5) (@MarkCallow)
|
||||
|
||||
* Set color space in input image prior to resample. (#1051) (1daca0cdc) (@MarkCallow)
|
||||
|
||||
* Use relative rpaths to find installed library on macOS (#1046) (d47320c24) (@MarkCallow)
|
||||
|
||||
* Clarify platforms where unit tests not supported. (#1040) (f9f36940b) (@MarkCallow)
|
||||
|
||||
* Minor build fixes (#1039) (8dfb89507) (@MarkCallow)
|
||||
|
||||
* Update for Vulkan SDK 1.4.313. (#1037) (d72218c6a) (@MarkCallow)
|
||||
|
||||
* Export ktxTexture2\_DecodeAstc in JS bindings (#1034) (64a69009b) (@MarkCallow)
|
||||
|
||||
* Restore rotted bits: update vcpkg caching and pyktx to latest Python (#1033) (f753fcabe) (@MarkCallow)
|
||||
|
||||
* Fix handling of multiple files with spaces in names. (#1030) (b2f4da2aa) (@MarkCallow)
|
||||
|
||||
* Update CTS ref for merged test updates. (b9218bc50) (@MarkCallow)
|
||||
|
||||
* Fix CLI error handling for --normalize. (#1016) (17d206239) (@MarkCallow)
|
||||
|
||||
* Linux and MacOS workflows (#1004) (520dc8f89) (@MathiasMagnus)
|
||||
|
||||
|
||||
|
||||
### Build Scripts and CMake files
|
||||
|
||||
* Add force-fetch-provoking-tag-annotation workaround (e5c085b51) (@MarkCallow)
|
||||
|
||||
* Add options. (16a24e087) (@MarkCallow)
|
||||
|
||||
* Add v1 support to ktx info (#1060) (3cd9e3447) (@MarkCallow)
|
||||
|
||||
* Migrate loadtest apps to SDL3 (#1055) (443e12238) (@MarkCallow)
|
||||
|
||||
* Fix hang when adding alpha and PNG input has sBIT chunk. (#1054) (d9a0c2bd5) (@MarkCallow)
|
||||
|
||||
* Use relative rpaths to find installed library on macOS (#1046) (d47320c24) (@MarkCallow)
|
||||
|
||||
* Clarify platforms where unit tests not supported. (#1040) (f9f36940b) (@MarkCallow)
|
||||
|
||||
* Minor build fixes (#1039) (8dfb89507) (@MarkCallow)
|
||||
|
||||
* Update for Vulkan SDK 1.4.313. (#1037) (d72218c6a) (@MarkCallow)
|
||||
|
||||
* Export ktxTexture2\_DecodeAstc in JS bindings (#1034) (64a69009b) (@MarkCallow)
|
||||
|
||||
* Restore rotted bits: update vcpkg caching and pyktx to latest Python (#1033) (f753fcabe) (@MarkCallow)
|
||||
|
||||
* Add option to use virtual environment for Python. (#1029) (b167e968c) (@MarkCallow)
|
||||
|
||||
* Fix: Install graphviz if FEATURE\_DOCS ON (#1028) (e69101917) (@MarkCallow)
|
||||
|
||||
* Fix for Emscripten 4.0.9 (#1026) (1a983763c) (@MarkCallow)
|
||||
|
||||
* Enable use of Ninja Multi-Config generator for Linux builds (#1017) (161878025) (@MarkCallow)
|
||||
|
||||
* Update LodePNG to version 20241228, (#1015) (6d1fc82ca) (@MarkCallow)
|
||||
|
||||
* Fix issues in CMakeLists.txt (see #996) (#998) (c033ac8fa) (@DanielGibson)
|
||||
|
||||
* Linux and MacOS workflows (#1004) (520dc8f89) (@MathiasMagnus)
|
||||
@@ -0,0 +1,276 @@
|
||||
# SPDX-FileCopyrightText: 2024 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
version = 1
|
||||
SPDX-PackageName = "KTX-Software"
|
||||
SPDX-PackageDownloadLocation = "https://github.com/KhronosGroup/KTX-Software"
|
||||
|
||||
[[annotations]]
|
||||
path = ["**/**.basis", "**/**.bmp", "**/**.ico", "**/**.icns", "**/**.jpg", "**/**.ktx", "**/**.ktx2", "**/**.pam", "**/**.pgm", "**/**.ppm", "**/**.png", "**/**.pspimage", "**/**.svg"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2015-2022 The Khronos Group Inc."
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["tests/srcimages/ccwn2c08.png", "tests/srcimages/g03n2c08.png", "tests/srcimages/tbrn2c08.png", "tests/srcimages/tbyn3p08.png", "tests/srcimages/tm3n3p02.png"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "1996, 2011 Willem van Schaik"
|
||||
SPDX-License-Identifier = "LicenseRef-PNGSuite"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/srcimages/kodim17.png"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Eastman Kodak Company"
|
||||
SPDX-License-Identifier = "LicenseRef-Kodak"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/srcimages/color_grid.png"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Unknown"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/srcimages/camera_camera_BaseColor_16bit.png"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "UX3D"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/srcimages/FlightHelmet_baseColor.png"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Microsoft"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/srcimages/CesiumLogoFlat_palette.png"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Analytical Graphics"
|
||||
SPDX-License-Identifier = "CC-BY-4.0 WITH LicenseRef-Cesium-Trademark-Terms"
|
||||
|
||||
[[annotations]]
|
||||
path = ["tests/testimages/hi_mark.ktx", "tests/testimages/hi_mark_sq.ktx"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "HI Corporation"
|
||||
SPDX-License-Identifier = "LicenseRef-HI-Trademark"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/srcimages/Iron_Bars/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Katsuagi https://3dtextures.me"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["tests/srcimages/GoldenGateBridge3/**", "tests/srcimages/Yokohama3/**"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "Emil Persson http://www.humus.name"
|
||||
SPDX-License-Identifier = "CC-BY-3.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["tests/testimages/skybox.ktx2", "tests/testimages/skybox_zstd.ktx2"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "HDRIHaven"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/astc-encoder/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2020-2023 Arm Limited"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/etcdec/etcdec.cxx"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2013 Ericsson AB"
|
||||
SPDX-License-Identifier = "LicenseRef-ETCSLA"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/fmt/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2012-present Victor Zverovich and {fmt} contributors"
|
||||
SPDX-License-Identifier = "LicenseRef-fmt"
|
||||
|
||||
[[annotations]]
|
||||
path = "**/**.json"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2017-2020 Mark Callow"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["external/basisu/Docs/**", "external/basisu/Test/**", "external/basisu/jenkins/**", "external/basisu/.gitattributes", "external/basisu/.gitignore", "external/basisu/.gitmodules", "external/basisu/.pylintrc", "external/basisu/README.md", "external/basisu/Utils/Example/README.md"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2020-2021 Arm Limited"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/basisu/.gitrepo"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2021 Mark Callow"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/basisu/Source/stb_image**.h"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2017 Sean Barrett"
|
||||
SPDX-License-Identifier = "MIT"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/basisu/Source/tinyexr.h"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2014-2019 Syoyo Fujita and many contributors"
|
||||
SPDX-License-Identifier = "BSD-3-Clause"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/basisu/Source/wuffs-v0.3.c"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2022 The Wuffs Authors."
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/basisu/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2019-2020 Binomial LLC"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["external/basisu/apg_bmp.**", "external/basisu/CMakeLists.txt", "external/basisu/webgl/transcoder/CMakeLists.txt"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2019 Anton Gerdelan"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/basisu/basisu_astc_decomp.**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2016 The Android Open Source Project"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/lodepng/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2005-2025 Lode Vandevenne"
|
||||
SPDX-License-Identifier = "Zlib"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/dfdutils/vulkan/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2015-2020 The Khronos Group Inc."
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/dfdutils/.gitrepo"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2019-2020 The Khronos Group Inc"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/SDL_gesture/SDL_gesture.h"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "1997-2022 Sam Lantinga <slouken@libsdl.org>"
|
||||
SPDX-License-Identifier = "Zlib"
|
||||
|
||||
[[annotations]]
|
||||
path = "cmake/modules/FindVulkan.cmake"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = ["Copyright 2000-2024 Kitware, Inc. and Contributors", "Updates for iOS Copyright (c) 2024, Holochip Inc"]
|
||||
SPDX-License-Identifier = "BSD-3-Clause"
|
||||
|
||||
[[annotations]]
|
||||
path = ["cmake/modules/NSIS.InstallOptions.ini.in", "cmake/**.rtf"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2017-2020 Andreas Atteneder"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["other_include/zstd**"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2016-present Facebook, Inc."
|
||||
SPDX-License-Identifier = "BSD-3-Clause"
|
||||
|
||||
[[annotations]]
|
||||
path = ["other_include/EGL/**.h", "other_include/GL**/**.h", "other_include/KHR/khrplatform.h"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2007-2020 The Khronos Group Inc."
|
||||
SPDX-License-Identifier = "MIT"
|
||||
|
||||
[[annotations]]
|
||||
path = "pkgdoc/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2018-2023 The Khronos Group Inc."
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/webgl/libktx-gltf/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2020 Don McCurdy, Austin Eng, Shrek Shao, and Mark Callow"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["tests/webgl/libktx-webgl/**", "tests/webgl/libktx-read-webgl/**"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2020 Mark Callow"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/webgl/llt-three/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2020 Mark Callow"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/gtest/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2008, Google Inc."
|
||||
SPDX-License-Identifier = "BSD-3-Clause"
|
||||
|
||||
[[annotations]]
|
||||
path = "tools/package/mac/summary.rtfd/TXT.rtf"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2019 Mark Callow"
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "other_include/glm/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2005 G-Truc Creation"
|
||||
SPDX-License-Identifier = "MIT"
|
||||
|
||||
[[annotations]]
|
||||
path = "lib/etcdec.cxx"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2013 Ericsson AB 2013. All Rights Reserved."
|
||||
SPDX-License-Identifier = "LicenseRef-ETCSLA"
|
||||
|
||||
[[annotations]]
|
||||
path = "tests/**/**loadtests.rc"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2020 The Khronos Group Inc."
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "other_include/stb/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2017 Sean Barrett"
|
||||
SPDX-License-Identifier = "MIT"
|
||||
|
||||
[[annotations]]
|
||||
path = "the_khronos_group_inc.p12.enc"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2022 The Khronos Group Inc."
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "external/cxxopts/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2014-2022 Jarryd Beck"
|
||||
SPDX-License-Identifier = "MIT"
|
||||
|
||||
[[annotations]]
|
||||
path = "NOTICE.md"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2024 The Khronos Group Inc."
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = ["vcpkg.json", "vcpkg-configuration.json"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "2024 The Khronos Group Inc."
|
||||
SPDX-License-Identifier = "Apache-2.0"
|
||||
@@ -0,0 +1,7 @@
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# include(CMakeFindDependencyMacro)
|
||||
# find_dependency()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/KtxTargets.cmake")
|
||||
@@ -0,0 +1,19 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf2822
|
||||
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;}
|
||||
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
|
||||
{\*\expandedcolortbl;;\cssrgb\c0\c0\c0;}
|
||||
\paperw11900\paperh16840\margl1440\margr1440\vieww10020\viewh19580\viewkind0
|
||||
\deftab720
|
||||
\pard\pardeftab720\partightenfactor0
|
||||
|
||||
\f0\fs26 \cf2 \expnd0\expndtw0\kerning0
|
||||
Copyright 2010-2020 The Khronos Group Inc.\
|
||||
SPDX-License-Identifier: Apache-2.0\
|
||||
\
|
||||
This is open source software. The majority of the source is licensed under {\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/LICENSE-2.0"}}{\fldrslt Apache 2.0.}} Follow the link for the full license text. Exceptions and full details of contributors are listed in {\field{\*\fldinst{HYPERLINK "https://github.com/KhronosGroup/KTX-Software/blob/master/LICENSE.md"}}{\fldrslt LICENSE.md}} in the KTX-Software repository.\
|
||||
\
|
||||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the {\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/LICENSE-2.0"}}{\fldrslt License}} for the specific language governing permissions and limitations under the License.\
|
||||
\pard\pardeftab720\sa140\partightenfactor0
|
||||
\cf2 \
|
||||
\pard\pardeftab720\sa280\partightenfactor0
|
||||
\cf2 libktx is the work of Mark Callow based on work by Georg Kolling and Jacob Str\'f6m with contributions borrowed from Troy Hanson, Johannes van Waveren, Lode Vandevenne and Rich Geldreich. The KTX tool suite is the work of RasterGrid Kft. The legacy tools are the work of Mark Callow. The CMake-based build setup used to produce this installer is the work of Andreas Atteneder.}
|
||||
@@ -0,0 +1,2 @@
|
||||
SPDX-FileCopyrightText: 2010-2020 The Khronos Group Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
@@ -0,0 +1,43 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf2822
|
||||
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;\f1\fnil\fcharset0 LucidaGrande;\f2\fnil\fcharset0 HelveticaNeue-Italic;
|
||||
\f3\fnil\fcharset0 HelveticaNeue-Bold;}
|
||||
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;}
|
||||
{\*\expandedcolortbl;;\cssrgb\c0\c0\c0\cname textColor;}
|
||||
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid1\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid2\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid1}
|
||||
{\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{square\}}{\leveltext\leveltemplateid101\'01\uc0\u9642 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid102\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li1440\lin1440 }{\listname ;}\listid2}}
|
||||
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}}
|
||||
\paperw11900\paperh16840\margl1440\margr1440\vieww19120\viewh13180\viewkind0
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
|
||||
|
||||
\f0\fs26 \cf2 This will install the following:\
|
||||
\
|
||||
\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural\partightenfactor0
|
||||
|
||||
\f1 \cf2 \uc0\u9642
|
||||
\f0 ktx - Unified front end for the KTX tool suite:\
|
||||
\pard\tx940\tx1440\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li1440\fi-1440\pardirnatural\partightenfactor0
|
||||
\ls1\ilvl1\cf2 {\listtext \uc0\u8259 }create - Create KTX v2 files.\
|
||||
{\listtext \uc0\u8259 }compare - Compare KTX v2 files.\
|
||||
{\listtext \uc0\u8259 }deflate - Apply Zstd or ZLIB compression to a KTX v2 file.\
|
||||
{\listtext \uc0\u8259 }encode - Encode a KTX v2 file to Basis Universal or ASTC.\
|
||||
{\listtext \uc0\u8259 }extract - Extract an image from a KTX v2 file.\
|
||||
{\listtext \uc0\u8259 }info - Display info about a KTX file.\
|
||||
{\listtext \uc0\u8259 }transcode - Transcode a KTX v2 file.\
|
||||
{\listtext \uc0\u8259 }validate - Validate a KTX v2 file.\
|
||||
\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural\partightenfactor0
|
||||
|
||||
\f1 \cf2 \uc0\u9642
|
||||
\f0 Legacy tools which will be removed in the next release:\
|
||||
\pard\tx940\tx1440\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li1440\fi-1440\pardirnatural\partightenfactor0
|
||||
\ls2\ilvl1\cf2 {\listtext \uc0\u8259 }ktx2check - Check KTX v2 files for validity.\
|
||||
{\listtext \uc0\u8259 }ktxinfo - Print info about a KTX file in human-readable form.\
|
||||
{\listtext \uc0\u8259 }ktx2ktx2 - Convert a KTX v1 file to a KTX v2 file.\
|
||||
{\listtext \uc0\u8259 }ktxsc - Supercompress a KTX v2 file.\
|
||||
{\listtext \uc0\u8259 }toktx - Create a KTX v1 or v2 file from .jpg, .png or Netpbm images.\
|
||||
\pard\tx566\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
|
||||
\cf2 \
|
||||
By clicking the
|
||||
\f2\i Customize
|
||||
\f0\i0 button at the bottom of the
|
||||
\f3\b Installation Type
|
||||
\f0\b0 screen you can add installation of the resources needed for developing applications using the KTX library.}
|
||||
@@ -0,0 +1,12 @@
|
||||
Copyright 2015-2020 The Khronos Group Inc.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
This will install the following KTX tools along with libktx:
|
||||
|
||||
- ktx2check - Check KTX v2 files for validity.
|
||||
- ktxinfo - Print info about a KTX file in human-readable form.
|
||||
- ktx2ktx2 - Convert a KTX v1 file to a KTX v2 file.
|
||||
- ktxsc - Supercompress a KTX v2 file.
|
||||
- toktx - Create a KTX v1 or v2 file from .jpg, .png or Netpbm images.
|
||||
|
||||
It also installs the header files for development.
|
||||
@@ -0,0 +1,8 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf2513
|
||||
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
{\*\expandedcolortbl;;}
|
||||
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0
|
||||
|
||||
\f0\fs26 \cf0 This program will guide you through installation of the KTX tools and the optional KTX development resources on your system.}
|
||||
@@ -0,0 +1,160 @@
|
||||
# Copyright 2020 Andreas Atteneder
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Macro for setting up code signing on targets
|
||||
macro (set_code_sign target)
|
||||
if(APPLE)
|
||||
set_target_properties(${target} PROPERTIES
|
||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${XCODE_CODE_SIGN_IDENTITY}"
|
||||
XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "${XCODE_DEVELOPMENT_TEAM}"
|
||||
XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS "--timestamp"
|
||||
XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS $<IF:$<CONFIG:Debug>,YES,NO>
|
||||
)
|
||||
if(IOS)
|
||||
set(set_pps FALSE)
|
||||
if(${ARGC} EQUAL 1)
|
||||
set(set_pps TRUE)
|
||||
elseif (NOT ${ARGV1} STREQUAL "NOPPS")
|
||||
set(set_pps TRUE)
|
||||
endif()
|
||||
if (${set_pps})
|
||||
set_property(TARGET ${target}
|
||||
PROPERTY XCODE_ATTRIBUTE_PROVISIONING_PROFILE_SPECIFIER ${XCODE_PROVISIONING_PROFILE_SPECIFIER}
|
||||
)
|
||||
endif()
|
||||
unset(set_pps)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32 AND CODE_SIGN_KEY_VAULT)
|
||||
configure_windows_sign_params()
|
||||
if(SIGN_PARAMS)
|
||||
add_custom_command( TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${signtool_EXECUTABLE} sign ${SIGN_PARAMS} $<TARGET_FILE:${target}>
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endmacro (set_code_sign)
|
||||
|
||||
function(configure_windows_sign_params)
|
||||
if(NOT SIGN_PARAMS)
|
||||
if(CODE_SIGN_KEY_VAULT STREQUAL "Azure")
|
||||
# Use EV certificate in Azure key vault
|
||||
find_program(signtool_EXECUTABLE azuresigntool REQUIRED)
|
||||
if(signtool_EXECUTABLE)
|
||||
configure_azuresigntool_params()
|
||||
endif()
|
||||
else()
|
||||
# Use standard OV certificate in local certificate store.
|
||||
find_package(signtool REQUIRED)
|
||||
if(signtool_EXECUTABLE)
|
||||
configure_signtool_params()
|
||||
endif()
|
||||
endif()
|
||||
set(SIGN_PARAMS ${SIGN_PARAMS} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(configure_azuresigntool_params)
|
||||
if(NOT SIGN_PARAMS)
|
||||
foreach(param AZURE_KEY_VAULT_CERTIFICATE AZURE_KEY_VAULT_URL AZURE_KEY_VAULT_CLIENT_ID AZURE_KEY_VAULT_CLIENT_SECRET AZURE_KEY_VAULT_TENANT_ID)
|
||||
if(NOT ${param})
|
||||
message(SEND_ERROR "CODE_SIGN_KEY_VAULT set to \"Azure\" but necessary parameter ${param} is not set.")
|
||||
endif()
|
||||
endforeach()
|
||||
configure_common_params()
|
||||
set(SIGN_PARAMS ${SIGN_PARAMS}
|
||||
--azure-key-vault-url ${AZURE_KEY_VAULT_URL}
|
||||
--azure-key-vault-client-id ${AZURE_KEY_VAULT_CLIENT_ID}
|
||||
--azure-key-vault-client-secret ${AZURE_KEY_VAULT_CLIENT_SECRET}
|
||||
--azure-key-vault-tenant-id ${AZURE_KEY_VAULT_TENANT_ID}
|
||||
--azure-key-vault-certificate ${AZURE_KEY_VAULT_CERTIFICATE}
|
||||
#--verbose # Include additional output.
|
||||
#--quiet # Do not print any output to the console.
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(configure_signtool_params)
|
||||
if(NOT SIGN_PARAMS)
|
||||
# User store is preferred because importing the cert. does not need
|
||||
# admin elevation. However problems were encountered on Appveyor,
|
||||
# see comment at begin_build phase in .appveyor.yml, so use of local
|
||||
# machine store is also supported.
|
||||
if(CODE_SIGN_KEY_VAULT STREQUAL Machine)
|
||||
# Search in local machine certificate store
|
||||
set(store "/sm")
|
||||
elseif(CODE_SIGN_KEY_VAULT STREQUAL User)
|
||||
# Search in user's certificate store.
|
||||
unset(store)
|
||||
else()
|
||||
message(FATAL_ERROR "Unrecognized CODE_SIGN_KEY_VAULT value \"${CODE_SIGN_KEY_VAULT}\"")
|
||||
endif()
|
||||
if(LOCAL_KEY_VAULT_CERTIFICATE_THUMBPRINT)
|
||||
set(certopt /sha1)
|
||||
set(certid ${LOCAL_KEY_VAULT_CERTIFICATE_THUMBPRINT})
|
||||
elseif(LOCAL_KEY_VAULT_SIGNING_IDENTITY)
|
||||
set(certopt /n)
|
||||
set(certid ${LOCAL_KEY_VAULT_SIGNING_IDENTITY})
|
||||
else()
|
||||
message(FATAL_ERROR "CODE_SIGN_KEY_VAULT set to ${CODE_SIGN_KEY_VAULT} but neither LOCAL_KEY_VAULT_CERTIFICATE_THUMBPRINT nor LOCAL_KEY_VAULT_SIGNING_IDENTITY is set.")
|
||||
endif()
|
||||
configure_common_params()
|
||||
set(SIGN_PARAMS ${SIGN_PARAMS} ${store} ${certopt} ${certid}
|
||||
#/debug
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(configure_common_params)
|
||||
if (CODE_SIGN_TIMESTAMP_URL)
|
||||
set(SIGN_PARAMS ${SIGN_PARAMS}
|
||||
-fd sha256
|
||||
-td sha256 -tr ${CODE_SIGN_TIMESTAMP_URL}
|
||||
-d KTX-Software -du https://github.com/KhronosGroup/KTX-Software
|
||||
PARENT_SCOPE)
|
||||
else()
|
||||
message(FATAL_ERROR "CODE_SIGN_KEY_VAULT is set but CODE_SIGN_TIMESTAMP_URL is not set.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(set_nsis_installer_codesign_cmd)
|
||||
# To make calls to the above macro and this order independent ...
|
||||
if(WIN32 AND CODE_SIGN_KEY_VAULT)
|
||||
if(NOT SIGN_PARAMS)
|
||||
configure_windows_sign_params()
|
||||
endif()
|
||||
if(SIGN_PARAMS)
|
||||
# CPACK_NSIS_FINALIZE_CMD is a variable whose value is to be substituted
|
||||
# into the !finalize and !uninstfinalize commands in
|
||||
# cmake/modules/NSIS.template.in. This variable is ours. It is not a
|
||||
# standard CPACK variable. The name MUST start with CPACK otherwise
|
||||
# it will not be defined when cpack runs its configure_file step.
|
||||
foreach(param IN LISTS SIGN_PARAMS)
|
||||
# Quote the parameters because at least one of them,
|
||||
# WIN_CODE_SIGN_IDENTITY, has spaces. It is easier to quote
|
||||
# all of them than determine which have spaces.
|
||||
#
|
||||
# Insane escaping is needed due to the 2-step process used to
|
||||
# configure the final output. First cpack creates CPackConfig.cmake
|
||||
# in which the value set here appears, inside quotes, as the
|
||||
# argument to a cmake `set` command. That variable's value
|
||||
# is then substituted into the output.
|
||||
string(APPEND NSIS_SIGN_PARAMS "\\\"${param}\\\" ")
|
||||
endforeach()
|
||||
|
||||
# Note 1: cpack/NSIS does not show any output when running signtool,
|
||||
# whether it succeeds or fails.
|
||||
#
|
||||
# Note 2: Do not move the %1 to NSIS.template.in. We need an empty
|
||||
# command there when we aren't signing. %1 is replaced by the name
|
||||
# of the installer or uninstaller during NSIS compilation.
|
||||
set(CPACK_NSIS_FINALIZE_CMD "\\\"${signtool_EXECUTABLE}\\\" sign ${NSIS_SIGN_PARAMS} %1"
|
||||
PARENT_SCOPE
|
||||
)
|
||||
unset(NSIS_SIGN_PARAMS)
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,170 @@
|
||||
# Copyright 2016, Simon Werta (@webmaster128).
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(cputypetest_code "
|
||||
//
|
||||
// https://gist.github.com/webmaster128/e08067641df1dd784eb195282fd0912f
|
||||
//
|
||||
// The resulting values must not be defined as macros, which
|
||||
// happens e.g. for 'i386', which is a macro in clang.
|
||||
// For safety reasons, we undefine everything we output later
|
||||
//
|
||||
// For CMake literal compatibility, this file must have no double quotes
|
||||
//
|
||||
|
||||
#if defined(__x86_64__) || defined(_M_X64)
|
||||
x86_64
|
||||
#elif defined(i386) || defined(__i386__) || defined(__i386) || defined(_M_IX86)
|
||||
x86_32
|
||||
#elif defined(__ARM_ARCH_2__)
|
||||
armv2
|
||||
#elif defined(__ARM_ARCH_3__) || defined(__ARM_ARCH_3M__)
|
||||
armv3
|
||||
#elif defined(__ARM_ARCH_4T__) || defined(__TARGET_ARM_4T)
|
||||
armv4T
|
||||
#elif defined(__ARM_ARCH_5_) || defined(__ARM_ARCH_5E_)
|
||||
ARM5
|
||||
#elif defined(__ARM_ARCH_6T2_) || defined(__ARM_ARCH_6T2_)
|
||||
armv6T2
|
||||
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)
|
||||
armv6
|
||||
#elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
|
||||
armv7
|
||||
#elif defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
|
||||
armv7A
|
||||
#elif defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__)
|
||||
armv7R
|
||||
#elif defined(__ARM_ARCH_7M__)
|
||||
armv7M
|
||||
#elif defined(__ARM_ARCH_7S__)
|
||||
armv7S
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
arm64
|
||||
#elif defined(mips) || defined(__mips__) || defined(__mips)
|
||||
mips
|
||||
#elif defined(__sh__)
|
||||
superh
|
||||
#elif defined(__powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC)
|
||||
powerpc
|
||||
#elif defined(__PPC64__) || defined(__ppc64__) || defined(_ARCH_PPC64)
|
||||
powerpc64
|
||||
#elif defined(__sparc__) || defined(__sparc)
|
||||
sparc
|
||||
#elif defined(__m68k__)
|
||||
m68k
|
||||
#elif defined __EMSCRIPTEN__
|
||||
wasm
|
||||
#else
|
||||
#error Unsupported cpu
|
||||
#endif
|
||||
|
||||
")
|
||||
|
||||
file(WRITE "${CMAKE_BINARY_DIR}/cputypetest.c" "${cputypetest_code}")
|
||||
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
|
||||
function(set_target_processor_type out)
|
||||
if(ANDROID_ABI AND "${ANDROID_ABI}" STREQUAL "armeabi-v7a")
|
||||
set(${out} armv7 PARENT_SCOPE)
|
||||
elseif(ANDROID_ABI AND "${ANDROID_ABI}" STREQUAL "arm64-v8a")
|
||||
set(${out} arm64 PARENT_SCOPE)
|
||||
elseif(ANDROID_ABI AND "${ANDROID_ABI}" STREQUAL "x86")
|
||||
set(${out} x86 PARENT_SCOPE)
|
||||
elseif(ANDROID_ABI AND "${ANDROID_ABI}" STREQUAL "x86_64")
|
||||
set(${out} x86_64 PARENT_SCOPE)
|
||||
|
||||
else()
|
||||
if(MSVC) # MSVC is true for all msvc-style compilers, including clang-cl
|
||||
if("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM" OR "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm")
|
||||
set(processor "arm")
|
||||
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "ARM64" OR "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm64")
|
||||
set(processor "arm64")
|
||||
else()
|
||||
set(C_PREPROCESS ${CMAKE_C_COMPILER} /EP /nologo)
|
||||
# Versions of MSVC prior to VS2019 have a supporting dll which
|
||||
# must be found along the search path. MSVC in VS 2019 just
|
||||
# works. Whether due to not having this supporting dll or using
|
||||
# a different way to locate it, is unknown. To make earlier
|
||||
# versions work set the WORKING_DIR to the location of the
|
||||
# support dll to ensure it is found.
|
||||
string(REGEX REPLACE "/VC/.*$" "/Common7/IDE"
|
||||
compiler_support_dir
|
||||
${CMAKE_C_COMPILER})
|
||||
execute_process(
|
||||
COMMAND ${C_PREPROCESS} "${CMAKE_BINARY_DIR}/cputypetest.c"
|
||||
WORKING_DIRECTORY ${compiler_support_dir}
|
||||
OUTPUT_VARIABLE processor
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
# Specify this to block MSVC's output of the source file name
|
||||
# so as not to trigger PowerShell's stop-on-error in CI.
|
||||
# Unfortunately it suppresses all compile errors too hence
|
||||
# the special case for MSVC. Which was convenient to have
|
||||
# when we found the issue with earlier versions of VS.
|
||||
ERROR_QUIET
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
# Apple's clang is a single compiler whose target is determined by
|
||||
# its -arch <architecture> or --target=<architecture> options
|
||||
# defaulting to the processor of the Mac it is running on. CMake does
|
||||
# not set this directly when generating for Xcode. (I don't know what
|
||||
# it does when generating makefiles. Therefore, in the Xcode case,
|
||||
# compiling cputypetest.c with CMAKE_{C,CXX}_COMPILER results in
|
||||
# processor being set to x86_86 or arm64 depending on the Mac it is
|
||||
# running on.
|
||||
#
|
||||
# When building for iOS, only CMAKE_SYSTEN_NAME is specified during
|
||||
# configuration. CMake leaves it up to Xcode or to the user passing
|
||||
# a -sdk argument to xcbuild to make sure the correct <architecture>
|
||||
# is set when calling the compiler.
|
||||
#
|
||||
# When building for macOS (and possibly for iOS, not tested) the
|
||||
# user can specify CMAKE_OSX_ARCHITECTURES if they want to compile
|
||||
# for something different than the current processor. This could be
|
||||
# set to $(ARCHS_STANDARD) an Xcode build setting whose value in
|
||||
# recent Xcode versions is "x86_64 arm64" to create universal binaries.
|
||||
# This is passed to Xcode which calls the compiler twice passing the
|
||||
# same set of target_definitions each time so in this case we have
|
||||
# to choose BASISU_SUPPORT_SSE=OFF or the arm64 compile will fail.
|
||||
#
|
||||
# The following code reflects all this.
|
||||
if(APPLE AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
# Building for iOS, iPadOS, etc. Since we don't care what
|
||||
# type of ARM processor, arbitrarily set armv8.
|
||||
# It should be arm64 but there is a check in tests/CMakeLists.txt
|
||||
# that is dropping loadtests for Apple Silicon arm64.
|
||||
set(processor armv8)
|
||||
elseif(APPLE AND CMAKE_OSX_ARCHITECTURES)
|
||||
string(STRIP "${CMAKE_OSX_ARCHITECTURES}" architectures)
|
||||
if("${architectures}" STREQUAL "$(ARCHS_STANDARD)")
|
||||
# Choose arm64 so SSE support is disabled.
|
||||
set(processor arm64)
|
||||
elseif("${architectures}" MATCHES "[^ ]+[ ]+[^ ]+")
|
||||
# Multiple words, choose arm64 so SSE support is disabled.
|
||||
set(processor arm64)
|
||||
elseif(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")
|
||||
set(processor x86_64)
|
||||
elseif(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")
|
||||
set(processor arm64)
|
||||
else()
|
||||
# Choose arm64 so SSE support is disabled.
|
||||
set(processor arm64)
|
||||
endif()
|
||||
unset(architectures)
|
||||
else()
|
||||
# This will distinguish between M1 and Intel Macs
|
||||
set(C_PREPROCESS ${CMAKE_C_COMPILER} -E -P)
|
||||
execute_process(
|
||||
COMMAND ${C_PREPROCESS} "${CMAKE_BINARY_DIR}/cputypetest.c"
|
||||
OUTPUT_VARIABLE processor
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
string(STRIP "${processor}" processor)
|
||||
#message(STATUS "*** set_target_processor_type ***: processor is ${processor}")
|
||||
set(${out} ${processor} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction(set_target_processor_type)
|
||||
@@ -0,0 +1,275 @@
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# dot is optional as missing include dependency graphs and
|
||||
# inheritance graphs is not a big enough deal to justify
|
||||
# forcing people to install Graphviz.
|
||||
find_package(Doxygen REQUIRED OPTIONAL_COMPONENTS dot)
|
||||
if(NOT DOXYGEN_DOT_EXECUTABLE)
|
||||
message(NOTICE "dot executable not found so Doxygen will not generate\n"
|
||||
"include dependency or inheritance graphs in the documentation.\n"
|
||||
"If you want these graphs, install Graphviz.")
|
||||
endif()
|
||||
|
||||
set(docdest "${CMAKE_CURRENT_BINARY_DIR}/docs")
|
||||
|
||||
# The torturous Doxygen output settings are a hack
|
||||
# to workaround a doxygen limitation where it will
|
||||
# only create the trailing directory of the path
|
||||
# given in, e.g DOXYGEN_HTML_OUTPUT while enabling
|
||||
# us to put each sub-document in its own directory of
|
||||
# the html output.
|
||||
|
||||
# Global
|
||||
set( DOXYGEN_PROJECT_LOGO icons/ktx_logo_200.png )
|
||||
set( DOXYGEN_OUTPUT_DIRECTORY ${docdest}/html)
|
||||
set( DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES )
|
||||
set( DOXYGEN_EXTRACT_LOCAL_CLASSES NO )
|
||||
set( DOXYGEN_HIDE_UNDOC_MEMBERS YES )
|
||||
set( DOXYGEN_CASE_SENSE_NAMES YES )
|
||||
set( DOXYGEN_SHOW_USED_FILES NO )
|
||||
set( DOXYGEN_VERBATIM_HEADERS NO )
|
||||
set( DOXYGEN_CLANG_ASSISTED_PARSING NO )
|
||||
set( DOXYGEN_ALPHABETICAL_INDEX NO )
|
||||
set( DOXYGEN_DISABLE_INDEX YES )
|
||||
set( DOXYGEN_DISABLE_INDEX NO )
|
||||
set( DOXYGEN_GENERATE_TREEVIEW YES )
|
||||
set( DOXYGEN_GENERATE_LATEX NO )
|
||||
set( DOXYGEN_GENERATE_HTML YES )
|
||||
set( DOXYGEN_GENERATE_MAN YES )
|
||||
set( DOXYGEN_MAN_OUTPUT ../man )
|
||||
# This is to get timestamps with older versions of doxygen.
|
||||
# older
|
||||
set( DOXYGEN_HTML_TIMESTAMP YES )
|
||||
set( DOXYGEN_TIMESTAMP YES )
|
||||
|
||||
function( add_sources target sources )
|
||||
# Make ${sources} show up in IDE/project
|
||||
get_target_property( doc_sources ${target} SOURCES )
|
||||
if( NOT doc_sources )
|
||||
set( doc_sources "" ) # Clear doc_sources-NOTFOUND value.
|
||||
endif()
|
||||
set_target_properties(
|
||||
${target}
|
||||
PROPERTIES
|
||||
SOURCES "${doc_sources};${sources}"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
function( add_docs_cmake target )
|
||||
# Make `docs.cmake` show up in IDE/project
|
||||
add_sources( ${target} "cmake/docs.cmake" )
|
||||
endfunction()
|
||||
|
||||
function( add_docs_cmake_plus target sources )
|
||||
# Make `docs.cmake` plus ${sources} show up in IDE/project
|
||||
add_sources( ${target} "cmake/docs.cmake;${sources}" )
|
||||
endfunction()
|
||||
|
||||
# Note very well
|
||||
#
|
||||
# These projects and accompanying DOXYGEN_LAYOUT_FILES are carefully crafted
|
||||
# to provide the illusion of a consistent GUI across all the projects.
|
||||
# Likely this will be fragile in the face of Doxygen changes.
|
||||
|
||||
# ktx.doc
|
||||
function( CreateDocLibKTX )
|
||||
set( DOXYGEN_PROJECT_NAME "libktx Reference" )
|
||||
set( DOXYGEN_ALIASES error=\"\\par Errors\\n\" )
|
||||
set( DOXYGEN_LAYOUT_FILE pkgdoc/libktxDoxyLayout.xml )
|
||||
set( DOXYGEN_TYPEDEF_HIDES_STRUCT NO )
|
||||
set( DOXYGEN_EXCLUDE lib/uthash.h )
|
||||
set( DOXYGEN_EXCLUDE_PATTERNS ktxint.h )
|
||||
set( DOXYGEN_EXAMPLE_PATH examples lib )
|
||||
# This does not hide the scope (class) names in the Modules list
|
||||
# in the ToC. See https://github.com/doxygen/doxygen/issues/9921.
|
||||
set( DOXYGEN_HIDE_SCOPE_NAMES YES )
|
||||
set( DOXYGEN_HTML_OUTPUT libktx )
|
||||
# Order is important here. '_' suffixed prefices must come first
|
||||
# otherwise the non-suffixed is stripped first leaving just '_'.
|
||||
set( DOXYGEN_IGNORE_PREFIX KTX_;ktx_;KTX;ktx )
|
||||
set( DOXYGEN_MAN_LINKS YES )
|
||||
set( DOXYGEN_MACRO_EXPANSION YES )
|
||||
set( DOXYGEN_EXPAND_ONLY_PREDEF YES )
|
||||
|
||||
set( DOXYGEN_PREDEFINED
|
||||
KTX_DOXYGEN_SKIP
|
||||
KTX_FEATURE_WRITE
|
||||
"KTXTEXTURECLASSDEFN=class_id classId\; \\
|
||||
struct ktxTexture_vtbl* vtbl\; \\
|
||||
struct ktxTexture_vvtbl* vvtbl\; \\
|
||||
struct ktxTexture_protected* _protected\; \\
|
||||
ktx_bool_t isArray\; \\
|
||||
ktx_bool_t isCubemap\; \\
|
||||
ktx_bool_t isCompressed\; \\
|
||||
ktx_bool_t generateMipmaps\; \\
|
||||
ktx_uint32_t baseWidth\; \\
|
||||
ktx_uint32_t baseHeight\; \\
|
||||
ktx_uint32_t baseDepth\; \\
|
||||
ktx_uint32_t numDimensions\; \\
|
||||
ktx_uint32_t numLevels\; \\
|
||||
ktx_uint32_t numLayers\; \\
|
||||
ktx_uint32_t numFaces\; \\
|
||||
struct { \\
|
||||
ktxOrientationX x\; \\
|
||||
ktxOrientationY y\; \\
|
||||
ktxOrientationZ z\; \\
|
||||
} orientation\; \\
|
||||
ktxHashList kvDataHead\; \\
|
||||
ktx_uint32_t kvDataLen\; \\
|
||||
ktx_uint8_t* kvData\; \\
|
||||
ktx_size_t dataSize\; \\
|
||||
ktx_uint8_t* pData\;"
|
||||
)
|
||||
#set( DOXYGEN_GENERATE_TAGFILE ${docdest}/libktx.tag )
|
||||
|
||||
doxygen_add_docs(
|
||||
libktx.doc
|
||||
lib/libktx_mainpage.md
|
||||
include
|
||||
lib/astc_codec.cpp
|
||||
lib/basis_encode.cpp
|
||||
lib/basis_transcode.cpp
|
||||
lib/miniz_wrapper.cpp
|
||||
lib/strings.c
|
||||
lib/gl_funcs.c
|
||||
lib/glloader.c
|
||||
lib/hashlist.c
|
||||
lib/filestream.c
|
||||
lib/memstream.c
|
||||
lib/texture.c
|
||||
lib/texture1.c
|
||||
lib/texture2.c
|
||||
lib/vkloader.c
|
||||
lib/writer1.c
|
||||
lib/writer2.c
|
||||
)
|
||||
add_docs_cmake_plus( libktx.doc pkgdoc/libktxDoxyLayout.xml )
|
||||
endfunction()
|
||||
|
||||
# ktxtools.doc
|
||||
function( CreateDocTools )
|
||||
set( DOXYGEN_PROJECT_NAME "KTX Tools Reference" )
|
||||
set( DOXYGEN_FULL_PATH_NAMES NO )
|
||||
set( DOXYGEN_ALIASES author=\"\\section AUTHOR\\n\" )
|
||||
set( DOXYGEN_LAYOUT_FILE pkgdoc/toolsDoxyLayout.xml )
|
||||
set( DOXYGEN_SHOW_FILES NO )
|
||||
set( DOXYGEN_FILE_PATTERNS *.cpp )
|
||||
set( DOXYGEN_RECURSIVE YES )
|
||||
set( DOXYGEN_EXAMPLE_PATH utils tools )
|
||||
set( DOXYGEN_HTML_OUTPUT ktxtools )
|
||||
set( DOXYGEN_MAN_EXTENSION .1 )
|
||||
#set( DOXYGEN_GENERATE_TAGFILE ${docdest}/ktxtools.tag )
|
||||
set( DOXYGEN_TAGFILES ${docdest}/ktxpkg.tag=.. )
|
||||
|
||||
doxygen_add_docs(
|
||||
tools.doc
|
||||
tools/ktx/ktx_main.cpp
|
||||
tools/ktx/command_compare.cpp
|
||||
tools/ktx/command_create.cpp
|
||||
tools/ktx/command_deflate.cpp
|
||||
tools/ktx/command_encode.cpp
|
||||
tools/ktx/command_extract.cpp
|
||||
tools/ktx/command_help.cpp
|
||||
tools/ktx/command_info.cpp
|
||||
tools/ktx/command_transcode.cpp
|
||||
tools/ktx/command_validate.cpp
|
||||
tools/ktx2check/ktx2check.cpp
|
||||
tools/ktx2ktx2/ktx2ktx2.cpp
|
||||
tools/ktxinfo/ktxinfo.cpp
|
||||
tools/ktxsc/ktxsc.cpp
|
||||
tools/ktxtools_mainpage.md
|
||||
tools/toktx/toktx.cc
|
||||
)
|
||||
add_docs_cmake_plus( tools.doc pkgdoc/toolsDoxyLayout.xml )
|
||||
endfunction()
|
||||
|
||||
# ktxjswrappers.doc
|
||||
function( CreateDocJSWrappers )
|
||||
set( DOXYGEN_PROJECT_NAME "KTX Javascript Wrappers Reference" )
|
||||
set( DOXYGEN_FULL_PATH_NAMES NO )
|
||||
set( DOXYGEN_ALIASES author=\"\\section AUTHOR\\n\" )
|
||||
set( DOXYGEN_LAYOUT_FILE pkgdoc/jswrappersDoxyLayout.xml )
|
||||
set( DOXYGEN_SHOW_FILES NO )
|
||||
set( DOXYGEN_HTML_OUTPUT ktxjswrappers )
|
||||
#set( DOXYGEN_GENERATE_TAGFILE ${docdest}/ktxjswrappers.tag )
|
||||
set( DOXYGEN_TAGFILES ${docdest}/ktxpkg.tag=.. )
|
||||
|
||||
doxygen_add_docs(
|
||||
jswrappers.doc
|
||||
interface/js_binding
|
||||
)
|
||||
add_docs_cmake_plus( jswrappers.doc pkgdoc/jswrappersDoxyLayout.xml )
|
||||
endfunction()
|
||||
|
||||
# pyktxwrappers.doc
|
||||
function( CreateDocPyktxWrappers )
|
||||
add_custom_command(
|
||||
TARGET libktx.doc
|
||||
POST_BUILD
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E copy_directory ${KTX_BUILD_DIR}/interface/python_binding/docs/html/pyktx/html ${KTX_BUILD_DIR}/docs/html/pyktx
|
||||
)
|
||||
add_dependencies( libktx.doc pyktx.doc )
|
||||
endfunction()
|
||||
|
||||
# ktxpkg.doc
|
||||
function( CreateDocKTX )
|
||||
set( DOXYGEN_PROJECT_NAME "Khronos Texture Software" )
|
||||
set( DOXYGEN_ALIASES pversion=\"\\par Package Version\\n\" )
|
||||
set( DOXYGEN_LAYOUT_FILE pkgdoc/packageDoxyLayout.xml )
|
||||
set( DOXYGEN_EXCLUDE lib/uthash.h )
|
||||
set( DOXYGEN_EXCLUDE_PATTERNS ktxint.h )
|
||||
set( DOXYGEN_EXAMPLE_PATH lib )
|
||||
set( DOXYGEN_GENERATE_TAGFILE ${docdest}/ktxpkg.tag )
|
||||
set( DOXYGEN_HTML_HEADER pkgdoc/header.html )
|
||||
set( DOXYGEN_HTML_OUTPUT . )
|
||||
set( DOXYGEN_MAN_LINKS YES )
|
||||
#set( DOXYGEN_TAGFILES ${docdest}/libktx.tag=libktx ${docdest}/ktxtools.tag=ktxtools )
|
||||
|
||||
doxygen_add_docs(
|
||||
ktxpkg.doc
|
||||
pkgdoc/pages.md
|
||||
LICENSE.md
|
||||
#RELEASE_NOTES.md
|
||||
)
|
||||
add_docs_cmake_plus( ktxpkg.doc pkgdoc/packageDoxyLayout.xml )
|
||||
endfunction()
|
||||
|
||||
CreateDocLibKTX()
|
||||
CreateDocTools()
|
||||
CreateDocJSWrappers()
|
||||
if (KTX_FEATURE_PY)
|
||||
CreateDocPyktxWrappers()
|
||||
endif()
|
||||
CreateDocKTX()
|
||||
|
||||
add_dependencies( libktx.doc ktxpkg.doc ktx_version )
|
||||
add_dependencies( jswrappers.doc ktxpkg.doc )
|
||||
add_dependencies( tools.doc ktxpkg.doc )
|
||||
|
||||
# I want to add a dependency on the "package" built-in target.
|
||||
# Unfortunately CMake does not support adding dependencies to
|
||||
# built-in targets. See https://gitlab.kitware.com/cmake/cmake/-/issues/8438.
|
||||
#
|
||||
# There also seems to be no way to add a dependency for the install commands
|
||||
# below. Presumably "install(TARGETS ...)" adds a dependency on each target
|
||||
# but the rest of that command is simply not appropriate for this case.
|
||||
add_custom_target( all.doc ALL
|
||||
DEPENDS tools.doc libktx.doc jswrappers.doc
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY ${docdest}/html
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
|
||||
COMPONENT tools
|
||||
)
|
||||
|
||||
install(
|
||||
DIRECTORY ${docdest}/man/man1
|
||||
## Omit those, since at the moment they contain a lot of undesired files generated by Doxygen
|
||||
# ${docdest}/man/man3
|
||||
# ${docdest}/man/ktx/man3
|
||||
DESTINATION "${CMAKE_INSTALL_MANDIR}"
|
||||
COMPONENT tools
|
||||
)
|
||||
@@ -0,0 +1,39 @@
|
||||
# Copyright 2023 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# CMake Toolchain file for cross-compiling to aarch64 (arm64) on
|
||||
# a non-arm64 device running Linux (Ubuntu).
|
||||
#
|
||||
# This following packages must be installed for compiling to ARM64:
|
||||
# sudo apt-get -qq install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
|
||||
|
||||
######################################################################
|
||||
# Nota Bene
|
||||
#
|
||||
# Untested. 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.
|
||||
######################################################################
|
||||
|
||||
# Target operating system name.
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR aarch64)
|
||||
|
||||
# Name of C compiler.
|
||||
set(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc")
|
||||
set(CMAKE_CXX_COMPILER "/usr/bin/aarch64-linux-gnu-g++")
|
||||
|
||||
# Where to look for the target environment. (More paths can be added here)
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-linux-gnu)
|
||||
#set(CMAKE_SYSROOT /usr/aarch64-linux-gnu)
|
||||
|
||||
# Adjust the default behavior of the FIND_XXX() commands:
|
||||
# search programs in the host environment only.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Search headers and libraries in the target environment only.
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64)
|
||||
@@ -0,0 +1,48 @@
|
||||
# Copyright 2023 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# CMake Toolchain file for cross-compiling to x86_64 (amd64) on
|
||||
# a non-x86_64 device running Linux (Ubuntu).
|
||||
#
|
||||
# The following packages must be installed for compiling to x86_64.
|
||||
# sudo apt-get -qq install gcc-x86-64-linux-gnu g++-x86-64-linux-gnu binutils-x86-64-linux-gnu
|
||||
|
||||
######################################################################
|
||||
# Nota Bene
|
||||
#
|
||||
# Untested. 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.
|
||||
######################################################################
|
||||
|
||||
# A note about the platform/architecture naming.
|
||||
#
|
||||
# The Ubuntu/Deb packages with the compiler and tools use "x64-64" as
|
||||
# you can see above. The compiler and tools are named with "x86_64"
|
||||
# as you will see in the macro settings below. Probably this is done
|
||||
# to maintain consistency with existing naming conventions for
|
||||
# packages (no underscores) and tools (use the offical architecture
|
||||
# name).
|
||||
|
||||
# Target operating system name.
|
||||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
# Name of C compiler.
|
||||
set(CMAKE_C_COMPILER "/usr/bin/x86_64-linux-gnu-gcc")
|
||||
set(CMAKE_CXX_COMPILER "/usr/bin/x86_64-linux-gnu-g++")
|
||||
|
||||
# Where to look for the target environment. (More paths can be added here)
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-linux-gnu)
|
||||
#set(CMAKE_SYSROOT /usr/x86_64-linux-gnu)
|
||||
|
||||
# Adjust the default behavior of the FIND_XXX() commands:
|
||||
# search programs in the host environment only.
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
# Search headers and libraries in the target environment only.
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
#set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
|
||||
@@ -0,0 +1,202 @@
|
||||
# Copyright 2015-2020 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# Code generation scripts that require a Vulkan SDK installation
|
||||
|
||||
# TODO: Rewrite scripts to generate the files from the Vulkan
|
||||
# registry, vk.xml, in the Vulkan-Docs repo.
|
||||
|
||||
# NOTE: Since this must be explicitly included by setting an option,
|
||||
# require sought packages. However, in order to give an informative
|
||||
# error, REQUIRED is not used in the find_* commands.
|
||||
#
|
||||
# CAUTION: Outputs of custom commands are deleted during a clean
|
||||
# operation so these targets result in clean deleting what are normally
|
||||
# considered source files. There appears to be no easy way to avoid
|
||||
# this. Since only project developers need to use these targets, and
|
||||
# only occasionally, this misfeature can be tolerated.
|
||||
|
||||
if (NOT IOS AND NOT ANDROID)
|
||||
# Not needed as local custom vulkan_core.h is used. Keeping
|
||||
# in case we go back to the standard one.
|
||||
# # find_package doesn't find the Vulkan SDK when building for IOS.
|
||||
# # I haven't investigated why.
|
||||
# find_package(Vulkan REQUIRED)
|
||||
|
||||
# This cmake file is included from its parent so has the same scope as
|
||||
# the including file. If we change Vulkan_INCLUDE_DIR, other parts will
|
||||
# be affected.
|
||||
set(mkvk_vulkan_include_dir external/dfdutils)
|
||||
else()
|
||||
# Skip mkvk. There is no need to use iOS or Android to regenerate
|
||||
# the files.
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(vulkan_header "${mkvk_vulkan_include_dir}/vulkan/vulkan_core.h")
|
||||
|
||||
# CAUTION: On Windows use a version of Perl built for Windows, i.e. not
|
||||
# one found in Cygwin or MSYS (Git for Windows). This is needed so the
|
||||
# generated files have the correct the correct CRLF line endings. The ones
|
||||
# mentioned write LF line endings (possibly related to some Cygwin or MSYS
|
||||
# installation setting for handling of text files). The Perl scripts,
|
||||
# unlike the Awk scripts, have not been modified to always write CRLF
|
||||
# on Windows.
|
||||
#
|
||||
# Strawberry Perl via Chocolatey is recommended.
|
||||
# choco install strawberryperl
|
||||
|
||||
#if(CMAKE_HOST_WIN32 AND NOT CYGWIN_INSTALL_PATH)
|
||||
# # Git for Windows comes with Perl
|
||||
# # Trick FindPerl into considering default Git location
|
||||
# set(CYGWIN_INSTALL_PATH "C:\\Program Files\\Git\\usr")
|
||||
#endif()
|
||||
|
||||
string(APPEND not_found_error
|
||||
"not found. "
|
||||
"This is only needed by project maintainers when regenerating source files. "
|
||||
"To silence, set KTX_GENERATE_VK_FILES OFF.")
|
||||
find_package(Perl QUIET)
|
||||
# Painful. Oh for a way to provide custom error messages for failures.
|
||||
if(NOT PERL_EXECUTABLE)
|
||||
message(FATAL_ERROR "Perl executable ${not_found_error}")
|
||||
endif()
|
||||
|
||||
set(Ruby_FIND_VIRTUALENV FIRST)
|
||||
find_package(Ruby 3 QUIET)
|
||||
if(NOT Ruby_EXECUTABLE)
|
||||
message(FATAL_ERROR "Ruby v3 executable ${not_found_error}")
|
||||
endif()
|
||||
|
||||
find_path(KTX_SPECIFICATION
|
||||
NAMES formats.json
|
||||
PATHS ${PROJECT_SOURCE_DIR}/../KTX-Specification
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT KTX_SPECIFICATION)
|
||||
message(FATAL_ERROR "KTX-Specification repo clone ${not_found_error}")
|
||||
endif()
|
||||
|
||||
list(APPEND mkvkformatfiles_input
|
||||
${vulkan_header}
|
||||
scripts/mkvkformatfiles)
|
||||
list(APPEND mkvkformatfiles_output
|
||||
"${PROJECT_SOURCE_DIR}/interface/java_binding/src/main/java/org/khronos/ktx/VkFormat.java"
|
||||
"${PROJECT_SOURCE_DIR}/interface/js_binding/vk_format.inl"
|
||||
"${PROJECT_SOURCE_DIR}/interface/python_binding/pyktx/vk_format.py"
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkformat_enum.h"
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkformat_typesize.c"
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkformat_check.c"
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkformat_str.c"
|
||||
"${PROJECT_SOURCE_DIR}tests/unittests/vkformat_list.inl")
|
||||
|
||||
# CAUTION: When a COMMAND contains VAR="Value" CMake messes up the escaping
|
||||
# for Bash. With or without VERBATIM, if Value has no spaces CMake changes it
|
||||
# to VAR=\"Value\". If it has spaces CMake changes it to "VAR=\"Value\"".
|
||||
# The first causes the quotes to leak into the command that is reading VAR
|
||||
# breaking, e.g. opening a file that has VAR's value as part of its name.
|
||||
# The second causes Bash to look for the command 'VAR="Value"' causing it
|
||||
# to exit with error.
|
||||
#
|
||||
# The only workaround I've found is to put the command in a string and invoke
|
||||
# it with bash -c. This is what we'd have to do on Windows anyway as COMMAND
|
||||
# defaults to cmd or powershell (not sure which). In this case CMake passes
|
||||
# to bash a string of the form '"VAR=\"Value\" command arg ..."' which bash
|
||||
# parses successfully.
|
||||
|
||||
list(APPEND mvffc_as_list
|
||||
scripts/mkvkformatfiles ./ ${vulkan_header})
|
||||
list(JOIN mvffc_as_list " " mvffc_as_string)
|
||||
set(mkvkformatfiles_command "${BASH_EXECUTABLE}" -c "${mvffc_as_string}")
|
||||
|
||||
add_custom_command(OUTPUT ${mkvkformatfiles_output}
|
||||
COMMAND ${mkvkformatfiles_command}
|
||||
DEPENDS ${mkvkformatfiles_input}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generating VkFormat-related source files"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(mkvkformatfiles
|
||||
DEPENDS ${mkvkformatfiles_output}
|
||||
SOURCES ${mkvkformatfiles_input}
|
||||
)
|
||||
|
||||
list(APPEND makevk2dfd_input
|
||||
${vulkan_header}
|
||||
external/dfdutils/makevk2dfd.pl)
|
||||
set(makevk2dfd_output
|
||||
"${PROJECT_SOURCE_DIR}/external/dfdutils/vk2dfd.inl")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${makevk2dfd_output}
|
||||
COMMAND "${PERL_EXECUTABLE}" external/dfdutils/makevk2dfd.pl ${vulkan_header} external/dfdutils/vk2dfd.inl
|
||||
DEPENDS ${makevk2dfd_input}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generating VkFormat/DFD switch body"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(makevk2dfd
|
||||
DEPENDS ${makevk2dfd_output}
|
||||
SOURCES ${makevk2dfd_input}
|
||||
)
|
||||
|
||||
|
||||
list(APPEND makedfd2vk_input
|
||||
${vulkan_header}
|
||||
external/dfdutils/makedfd2vk.pl)
|
||||
list(APPEND makedfd2vk_output
|
||||
"${PROJECT_SOURCE_DIR}/external/dfdutils/dfd2vk.inl")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${makedfd2vk_output}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory external/dfdutils
|
||||
COMMAND "${PERL_EXECUTABLE}" external/dfdutils/makedfd2vk.pl ${vulkan_header} external/dfdutils/dfd2vk.inl
|
||||
DEPENDS ${makedfd2vk_input}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generating DFD/VkFormat switch body"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(makedfd2vk
|
||||
DEPENDS ${makedfd2vk_output}
|
||||
SOURCES ${makedfd2vk_input}
|
||||
)
|
||||
|
||||
list(APPEND makevk2gl_input
|
||||
${KTX_SPECIFICATION}/generate_format_switches.rb
|
||||
${KTX_SPECIFICATION}/formats.json)
|
||||
list(APPEND makevk2gl_output
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkFormat2glFormat.inl"
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkFormat2glInternalFormat.inl"
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkFormat2glType.inl")
|
||||
# Until we have D3D or Metal loaders these outputs of
|
||||
# generate_format_switches.rb are unneeded.
|
||||
list(APPEND makevk2gl_extraneous_files
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkFormat2dxgiFormat.inl"
|
||||
"${PROJECT_SOURCE_DIR}/lib/vkFormat2mtlFormat.inl"
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${makevk2gl_output}
|
||||
COMMAND "${RUBY_EXECUTABLE}" ${KTX_SPECIFICATION}/generate_format_switches.rb ${PROJECT_SOURCE_DIR}/lib
|
||||
COMMAND ${CMAKE_COMMAND} -E rm -f ${makevk2gl_extraneous_files}
|
||||
DEPENDS ${makevk2gl_input}
|
||||
WORKING_DIRECTORY ${KTX_SPECIFICATION}
|
||||
COMMENT "Generating VkFormat to OpenGL internal format, format and type switches"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_custom_target(makevk2gl
|
||||
DEPENDS ${makevk2gl_output}
|
||||
SOURCES ${makedvk2gl_input}
|
||||
)
|
||||
|
||||
add_custom_target(mkvk SOURCES ${CMAKE_CURRENT_LIST_FILE})
|
||||
|
||||
add_dependencies(mkvk
|
||||
mkvkformatfiles
|
||||
makevk2dfd
|
||||
makedfd2vk
|
||||
makevk2gl
|
||||
)
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2020 Andreas Atteneder
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<installer-gui-script minSpecVersion="1.0">
|
||||
<title>KTX-Software</title>
|
||||
<welcome file="@CPACK_RESOURCE_FILE_WELCOME_NOPATH@"/>
|
||||
<readme file="@CPACK_RESOURCE_FILE_README_NOPATH@"/>
|
||||
<license file="@CPACK_RESOURCE_FILE_LICENSE_NOPATH@"/>
|
||||
<domains enable_localSystem="true"/>
|
||||
<options allow-external-scripts="no" customize="allow" rootVolumeOnly="true"/>
|
||||
@CPACK_PACKAGEMAKER_CHOICES@
|
||||
<conclusion file="summary.html" mime-type="text/html"/>
|
||||
</installer-gui-script>
|
||||
@@ -0,0 +1,100 @@
|
||||
##############################################################################
|
||||
# @file FindBASH.cmake
|
||||
# @brief Find BASH interpreter.
|
||||
#
|
||||
# Sets the CMake variables @c BASH_FOUND, @c BASH_EXECUTABLE,
|
||||
# @c BASH_VERSION_STRING, @c BASH_VERSION_MAJOR, @c BASH_VERSION_MINOR, and
|
||||
# @c BASH_VERSION_PATCH.
|
||||
#
|
||||
# @ingroup CMakeFindModules
|
||||
##############################################################################
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2011-2012 University of Pennsylvania
|
||||
# Copyright 2013-2016 Andreas Schuh <andreas.schuh.84@gmail.com>
|
||||
# Copyright 2013-2020 Andreas Atteneder <andreas.atteneder@gmail.com>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# find BASH executable
|
||||
|
||||
# First, look if GIT bash is installed
|
||||
find_program (
|
||||
BASH_EXECUTABLE
|
||||
bash
|
||||
PATHS
|
||||
# Additional paths for Windows
|
||||
"C:\\Program Files\\Git\\bin"
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
|
||||
if(NOT BASH_EXECUTABLE)
|
||||
# Fallback search in default locations
|
||||
find_program (
|
||||
BASH_EXECUTABLE
|
||||
bash
|
||||
)
|
||||
endif()
|
||||
|
||||
mark_as_advanced (BASH_EXECUTABLE)
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Get version of found BASH executable.
|
||||
if (BASH_EXECUTABLE)
|
||||
# Set LANG to en because match looks for English "version".
|
||||
set(ENV{LANG} "en_US.UTF-8")
|
||||
execute_process (COMMAND "${BASH_EXECUTABLE}" --version OUTPUT_VARIABLE _BASH_STDOUT ERROR_VARIABLE _BASH_STDERR)
|
||||
if (_BASH_STDOUT MATCHES "version ([0-9]+)\\.([0-9]+)\\.([0-9]+)")
|
||||
set (BASH_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
set (BASH_VERSION_MINOR "${CMAKE_MATCH_2}")
|
||||
set (BASH_VERSION_PATCH "${CMAKE_MATCH_3}")
|
||||
set (BASH_VERSION_STRING "${BASH_VERSION_MAJOR}.${BASH_VERSION_MINOR}.${BASH_VERSION_PATCH}")
|
||||
else ()
|
||||
message (WARNING "Failed to determine version of Bash interpreter (${BASH_EXECUTABLE})! Error:\n${_BASH_STDERR}")
|
||||
endif ()
|
||||
unset (_BASH_STDOUT)
|
||||
unset (_BASH_STDERR)
|
||||
endif ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Handle the QUIET and REQUIRED arguments and set *_FOUND to TRUE
|
||||
# if all listed variables are found or TRUE
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args (
|
||||
Bash
|
||||
REQUIRED_VARS
|
||||
BASH_EXECUTABLE
|
||||
)
|
||||
@@ -0,0 +1,210 @@
|
||||
# A version of cmake's FindSDL module modified to find SDL2.
|
||||
|
||||
# Copyright 2000-2020 Kitware, Inc. and Contributors
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
# Modifled for SDL2 by Mark Callow. (khronos at callow.im)
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindSDL2
|
||||
--------
|
||||
|
||||
Locate SDL2 library
|
||||
|
||||
This module defines
|
||||
|
||||
::
|
||||
|
||||
SDL2_LIBRARY, the name of the library to link against
|
||||
SDL2_FOUND, if false, do not try to link to SDL
|
||||
SDL2_INCLUDE_DIR, where to find SDL.h
|
||||
SDL2_VERSION_STRING, human-readable string containing the version of SDL
|
||||
|
||||
|
||||
|
||||
This module responds to the flag:
|
||||
|
||||
::
|
||||
|
||||
SDL2_BUILDING_LIBRARY
|
||||
If this is defined, then no SDL2_main will be linked in because
|
||||
only applications need main().
|
||||
Otherwise, it is assumed you are building an application and this
|
||||
module will attempt to locate and set the proper link flags
|
||||
as part of the returned SDL2_LIBRARY variable.
|
||||
|
||||
|
||||
|
||||
Don't forget to include SDLmain.h and SDLmain.m your project for the
|
||||
OS X framework based version. (Other versions link to -lSDLmain which
|
||||
this module will try to find on your behalf.) Also for OS X, this
|
||||
module will automatically add the -framework Cocoa on your behalf.
|
||||
|
||||
|
||||
|
||||
Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your
|
||||
configuration and no SDL2_LIBRARY, it means CMake did not find your SDL
|
||||
library (SDL.dll, libsdl.so, SDL.framework, etc). Set
|
||||
SDL2_LIBRARY_TEMP to point to your SDL library, and configure again.
|
||||
Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this
|
||||
value as appropriate. These values are used to generate the final
|
||||
SDL2_LIBRARY variable, but when these values are unset, SDL2_LIBRARY
|
||||
does not get created.
|
||||
|
||||
|
||||
|
||||
$SDL2DIR is an environment variable that would correspond to the
|
||||
./configure --prefix=$SDL2DIR used in building SDL. l.e.galup 9-20-02
|
||||
|
||||
Modified by Eric Wing. Added code to assist with automated building
|
||||
by using environmental variables and providing a more
|
||||
controlled/consistent search behavior. Added new modifications to
|
||||
recognize OS X frameworks and additional Unix paths (FreeBSD, etc).
|
||||
Also corrected the header search path to follow "proper" SDL
|
||||
guidelines. Added a search for SDLmain which is needed by some
|
||||
platforms. Added a search for threads which is needed by some
|
||||
platforms. Added needed compile switches for MinGW.
|
||||
|
||||
On OSX, this will prefer the Framework version (if found) over others.
|
||||
People will have to manually change the cache values of SDL2_LIBRARY to
|
||||
override this selection or set the CMake environment
|
||||
CMAKE_INCLUDE_PATH to modify the search paths.
|
||||
|
||||
Note that the header path has changed from SDL/SDL.h to just SDL.h
|
||||
This needed to change because "proper" SDL convention is #include
|
||||
"SDL.h", not <SDL/SDL.h>. This is done for portability reasons
|
||||
because not all systems place things in SDL/ (see FreeBSD).
|
||||
#]=======================================================================]
|
||||
|
||||
if(NOT SDL2_DIR)
|
||||
set(SDL2_DIR "" CACHE PATH "SDL2 directory")
|
||||
endif()
|
||||
|
||||
find_path(SDL2_INCLUDE_DIR SDL.h
|
||||
HINTS
|
||||
ENV SDL2DIR
|
||||
${SDL2_DIR}
|
||||
PATH_SUFFIXES SDL2
|
||||
# path suffixes to search inside ENV{SDL2DIR}
|
||||
include/SDL2 include
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(VC_LIB_PATH_SUFFIX lib/x64)
|
||||
else()
|
||||
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||
endif()
|
||||
|
||||
find_library(SDL2_LIBRARY_TEMP
|
||||
NAMES SDL2
|
||||
HINTS
|
||||
ENV SDL2DIR
|
||||
${SDL2_DIR}
|
||||
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
|
||||
)
|
||||
|
||||
# Hide this cache variable from the user, it's an internal implementation
|
||||
# detail. The documented library variable for the user is SDL2_LIBRARY
|
||||
# which is derived from SDL2_LIBRARY_TEMP further below.
|
||||
set_property(CACHE SDL2_LIBRARY_TEMP PROPERTY TYPE INTERNAL)
|
||||
|
||||
if(NOT SDL2_BUILDING_LIBRARY)
|
||||
if(NOT SDL2_INCLUDE_DIR MATCHES ".framework")
|
||||
# Non-OS X framework versions expect you to also dynamically link to
|
||||
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
|
||||
# seem to provide SDLmain for compatibility even though they don't
|
||||
# necessarily need it.
|
||||
find_library(SDL2MAIN_LIBRARY
|
||||
NAMES SDL2main
|
||||
HINTS
|
||||
ENV SDL2DIR
|
||||
${SDL2_DIR}
|
||||
PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX}
|
||||
PATHS
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# SDL may require threads on your system.
|
||||
# The Apple build may not need an explicit flag because one of the
|
||||
# frameworks may already provide it.
|
||||
# But for non-OSX systems, I will use the CMake Threads package.
|
||||
if(NOT APPLE)
|
||||
find_package(Threads)
|
||||
endif()
|
||||
|
||||
# MinGW needs an additional link flag, -mwindows
|
||||
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -mwindows
|
||||
if(MINGW)
|
||||
set(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "link flags for MinGW")
|
||||
endif()
|
||||
|
||||
if(SDL2_LIBRARY_TEMP)
|
||||
# For SDLmain
|
||||
if(SDL2MAIN_LIBRARY AND NOT SDL2_BUILDING_LIBRARY)
|
||||
list(FIND SDL2_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL2_MAIN_INDEX)
|
||||
if(_SDL2_MAIN_INDEX EQUAL -1)
|
||||
set(SDL2_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL2_LIBRARY_TEMP})
|
||||
endif()
|
||||
unset(_SDL2_MAIN_INDEX)
|
||||
endif()
|
||||
|
||||
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
|
||||
# CMake doesn't display the -framework Cocoa string in the UI even
|
||||
# though it actually is there if I modify a pre-used variable.
|
||||
# I think it has something to do with the CACHE STRING.
|
||||
# So I use a temporary variable until the end so I can set the
|
||||
# "real" variable in one-shot.
|
||||
if(APPLE)
|
||||
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
# For threads, as mentioned Apple doesn't need this.
|
||||
# In fact, there seems to be a problem if I used the Threads package
|
||||
# and try using this line, so I'm just skipping it entirely for OS X.
|
||||
if(NOT APPLE)
|
||||
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
# For MinGW library
|
||||
if(MINGW)
|
||||
set(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||
endif()
|
||||
|
||||
# Set the final string here so the GUI reflects the final state.
|
||||
set(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
|
||||
endif()
|
||||
|
||||
if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL2_version.h")
|
||||
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+[0-9]+$")
|
||||
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+[0-9]+$")
|
||||
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+[0-9]+$")
|
||||
string(REGEX REPLACE "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}")
|
||||
string(REGEX REPLACE "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}")
|
||||
string(REGEX REPLACE "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}")
|
||||
set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH})
|
||||
unset(SDL2_VERSION_MAJOR_LINE)
|
||||
unset(SDL2_VERSION_MINOR_LINE)
|
||||
unset(SDL2_VERSION_PATCH_LINE)
|
||||
unset(SDL2_VERSION_MAJOR)
|
||||
unset(SDL2_VERSION_MINOR)
|
||||
unset(SDL2_VERSION_PATCH)
|
||||
endif()
|
||||
|
||||
set(SDL2_LIBRARIES ${SDL2_LIBRARY} ${SDL2MAIN_LIBRARY})
|
||||
set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
|
||||
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
|
||||
VERSION_VAR SDL2_VERSION_STRING)
|
||||
|
||||
# vim:ai:ts=4:sts=4:sw=2:expandtab:textwidth=70
|
||||
@@ -0,0 +1,983 @@
|
||||
# Updates for iOS Copyright (c) 2024, Holochip Inc.
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindVulkan
|
||||
----------
|
||||
|
||||
.. versionadded:: 3.7
|
||||
|
||||
Find Vulkan, which is a low-overhead, cross-platform 3D graphics
|
||||
and computing API.
|
||||
|
||||
Optional COMPONENTS
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionadded:: 3.24
|
||||
|
||||
This module respects several optional COMPONENTS.
|
||||
There are corresponding imported targets for each of these.
|
||||
|
||||
``glslc``
|
||||
The SPIR-V compiler.
|
||||
|
||||
``glslangValidator``
|
||||
The ``glslangValidator`` tool.
|
||||
|
||||
``glslang``
|
||||
The SPIR-V generator library.
|
||||
|
||||
``shaderc_combined``
|
||||
The static library for Vulkan shader compilation.
|
||||
|
||||
``SPIRV-Tools``
|
||||
Tools to process SPIR-V modules.
|
||||
|
||||
``MoltenVK``
|
||||
On macOS, an additional component ``MoltenVK`` is available.
|
||||
|
||||
``dxc``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
The DirectX Shader Compiler.
|
||||
|
||||
The ``glslc`` and ``glslangValidator`` components are provided even
|
||||
if not explicitly requested (for backward compatibility).
|
||||
|
||||
IMPORTED Targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines :prop_tgt:`IMPORTED` targets if Vulkan has been found:
|
||||
|
||||
``Vulkan::Vulkan``
|
||||
The main Vulkan library.
|
||||
|
||||
``Vulkan::glslc``
|
||||
.. versionadded:: 3.19
|
||||
|
||||
The GLSLC SPIR-V compiler, if it has been found.
|
||||
|
||||
``Vulkan::Headers``
|
||||
.. versionadded:: 3.21
|
||||
|
||||
Provides just Vulkan headers include paths, if found. No library is
|
||||
included in this target. This can be useful for applications that
|
||||
load Vulkan library dynamically.
|
||||
|
||||
``Vulkan::glslangValidator``
|
||||
.. versionadded:: 3.21
|
||||
|
||||
The glslangValidator tool, if found. It is used to compile GLSL and
|
||||
HLSL shaders into SPIR-V.
|
||||
|
||||
``Vulkan::glslang``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Defined if SDK has the Khronos-reference front-end shader parser and SPIR-V
|
||||
generator library (glslang).
|
||||
|
||||
``Vulkan::shaderc_combined``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Defined if SDK has the Google static library for Vulkan shader compilation
|
||||
(shaderc_combined).
|
||||
|
||||
``Vulkan::SPIRV-Tools``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Defined if SDK has the Khronos library to process SPIR-V modules
|
||||
(SPIRV-Tools).
|
||||
|
||||
``Vulkan::MoltenVK``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Defined if SDK has the Khronos library which implement a subset of Vulkan API
|
||||
over Apple Metal graphics framework. (MoltenVK).
|
||||
|
||||
``Vulkan::volk``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
Defined if SDK has the Vulkan meta-loader (volk).
|
||||
|
||||
``Vulkan::dxc_lib``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
Defined if SDK has the DirectX shader compiler library.
|
||||
|
||||
``Vulkan::dxc_exe``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
Defined if SDK has the DirectX shader compiler CLI tool.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
``Vulkan_FOUND``
|
||||
set to true if Vulkan was found
|
||||
``Vulkan_INCLUDE_DIRS``
|
||||
include directories for Vulkan
|
||||
``Vulkan_LIBRARIES``
|
||||
link against this library to use Vulkan
|
||||
``Vulkan_VERSION``
|
||||
.. versionadded:: 3.23
|
||||
|
||||
value from ``vulkan/vulkan_core.h``
|
||||
``Vulkan_glslc_FOUND``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
True, if the SDK has the glslc executable.
|
||||
``Vulkan_glslangValidator_FOUND``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
True, if the SDK has the glslangValidator executable.
|
||||
``Vulkan_glslang_FOUND``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
True, if the SDK has the glslang library.
|
||||
``Vulkan_shaderc_combined_FOUND``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
True, if the SDK has the shaderc_combined library.
|
||||
``Vulkan_SPIRV-Tools_FOUND``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
True, if the SDK has the SPIRV-Tools library.
|
||||
``Vulkan_MoltenVK_FOUND``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
True, if the SDK has the MoltenVK library.
|
||||
``Vulkan_volk_FOUND``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
True, if the SDK has the volk library.
|
||||
|
||||
``Vulkan_dxc_lib_FOUND``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
True, if the SDK has the DirectX shader compiler library.
|
||||
|
||||
``Vulkan_dxc_exe_FOUND``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
True, if the SDK has the DirectX shader compiler CLI tool.
|
||||
|
||||
|
||||
The module will also defines these cache variables:
|
||||
|
||||
``Vulkan_INCLUDE_DIR``
|
||||
the Vulkan include directory
|
||||
``Vulkan_LIBRARY``
|
||||
the path to the Vulkan library
|
||||
``Vulkan_GLSLC_EXECUTABLE``
|
||||
the path to the GLSL SPIR-V compiler
|
||||
``Vulkan_GLSLANG_VALIDATOR_EXECUTABLE``
|
||||
the path to the glslangValidator tool
|
||||
``Vulkan_glslang_LIBRARY``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Path to the glslang library.
|
||||
``Vulkan_shaderc_combined_LIBRARY``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Path to the shaderc_combined library.
|
||||
``Vulkan_SPIRV-Tools_LIBRARY``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Path to the SPIRV-Tools library.
|
||||
``Vulkan_MoltenVK_LIBRARY``
|
||||
.. versionadded:: 3.24
|
||||
|
||||
Path to the MoltenVK library.
|
||||
|
||||
``Vulkan_volk_LIBRARY``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
Path to the volk library.
|
||||
|
||||
``Vulkan_dxc_LIBRARY``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
Path to the DirectX shader compiler library.
|
||||
|
||||
``Vulkan_dxc_EXECUTABLE``
|
||||
.. versionadded:: 3.25
|
||||
|
||||
Path to the DirectX shader compiler CLI tool.
|
||||
|
||||
Hints
|
||||
^^^^^
|
||||
|
||||
.. versionadded:: 3.18
|
||||
|
||||
The ``VULKAN_SDK`` environment variable optionally specifies the
|
||||
location of the Vulkan SDK root directory for the given
|
||||
architecture. It is typically set by sourcing the toplevel
|
||||
``setup-env.sh`` script of the Vulkan SDK directory into the shell
|
||||
environment.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
|
||||
# Provide compatibility with a common invalid component request that
|
||||
# was silently ignored prior to CMake 3.24.
|
||||
if("FATAL_ERROR" IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
message(AUTHOR_WARNING
|
||||
"Ignoring unknown component 'FATAL_ERROR'.\n"
|
||||
"The find_package() command documents no such argument."
|
||||
)
|
||||
list(REMOVE_ITEM Vulkan_FIND_COMPONENTS "FATAL_ERROR")
|
||||
endif()
|
||||
|
||||
# FindVulkan only works correctly for iOS with CMAKE_FIND_FRAMEWORK set to
|
||||
# FIRST or ALWAYS. If LAST or NEVER it will find the macOS dylibs instead
|
||||
# of the iOS frameworks because the macOS lib directory has to be added to
|
||||
# the search path so libraries for various tools can be found.
|
||||
#
|
||||
# For macOS there is a MoltenVK.xcframework which contains a static library.
|
||||
# To find the MoltenVK.dylib, which is needed when building bundles we need
|
||||
# to LAST or NEVER. LAST appears to be default value.
|
||||
#
|
||||
# If frameworks are ever included in the SDK for macOS, the search mechanism
|
||||
# will need revisiting.
|
||||
if(APPLE)
|
||||
if(IOS)
|
||||
if (NOT ${CMAKE_FIND_FRAMEWORK} STREQUAL "FIRST" AND NOT ${CMAKE_FIND_FRAMEWORK} STREQUAL "ALWAYS")
|
||||
message(NOTICE "Temporarily setting CMAKE_FIND_FRAMEWORK to FIRST to find Vulkan iOS frameworks.")
|
||||
set(_Vulkan_saved_cmake_find_framework ${CMAKE_FIND_FRAMEWORK})
|
||||
set(CMAKE_FIND_FRAMEWORK FIRST)
|
||||
endif()
|
||||
else()
|
||||
if (NOT ${CMAKE_FIND_FRAMEWORK} STREQUAL "LAST" AND NOT ${CMAKE_FIND_FRAMEWORK} STREQUAL "NEVER")
|
||||
message(NOTICE "Temporarily setting CMAKE_FIND_FRAMEWORK to LAST to find Vulkan macOS dylibs.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
# Make robust against different ways VULKAN_SDK may be set.
|
||||
get_filename_component(_Vulkan_SDK_dirname "$ENV{VULKAN_SDK}" NAME)
|
||||
if(${_Vulkan_SDK_dirname} STREQUAL "macOS" OR ${_Vulkan_SDK_dirname} STREQUAL "iOS")
|
||||
get_filename_component(Vulkan_SDK_Base "$ENV{VULKAN_SDK}/.." REALPATH)
|
||||
else()
|
||||
get_filename_component(Vulkan_SDK_Base "$ENV{VULKAN_SDK}" REALPATH)
|
||||
endif()
|
||||
set(_Vulkan_SDK ${Vulkan_SDK_Base}/macOS)
|
||||
if(IOS)
|
||||
list(APPEND CMAKE_FRAMEWORK_PATH "${Vulkan_SDK_Base}/iOS/lib")
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH)
|
||||
endif()
|
||||
else()
|
||||
set(_Vulkan_SDK "$ENV{VULKAN_SDK}")
|
||||
endif()
|
||||
|
||||
# For backward compatibility as `FindVulkan` in previous CMake versions allow to retrieve `glslc`
|
||||
# and `glslangValidator` without requesting the corresponding component.
|
||||
if(NOT glslc IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
list(APPEND Vulkan_FIND_COMPONENTS glslc)
|
||||
endif()
|
||||
if(NOT glslangValidator IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
list(APPEND Vulkan_FIND_COMPONENTS glslangValidator)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(_Vulkan_library_name vulkan-1)
|
||||
set(_Vulkan_hint_include_search_paths
|
||||
${_Vulkan_SDK}/include
|
||||
)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_Vulkan_hint_executable_search_paths
|
||||
${_Vulkan_SDK}/bin
|
||||
)
|
||||
set(_Vulkan_hint_library_search_paths
|
||||
${_Vulkan_SDK}/lib
|
||||
${_Vulkan_SDK}/bin
|
||||
)
|
||||
else()
|
||||
set(_Vulkan_hint_executable_search_paths
|
||||
${_Vulkan_SDK}/bin32
|
||||
${_Vulkan_SDK}/bin
|
||||
)
|
||||
set(_Vulkan_hint_library_search_paths
|
||||
${_Vulkan_SDK}/lib32
|
||||
${_Vulkan_SDK}/bin32
|
||||
${_Vulkan_SDK}/lib
|
||||
${_Vulkan_SDK}/bin
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(_Vulkan_library_name vulkan)
|
||||
set(_Vulkan_hint_include_search_paths
|
||||
${_Vulkan_SDK}/include
|
||||
)
|
||||
set(_Vulkan_hint_executable_search_paths
|
||||
${_Vulkan_SDK}/bin
|
||||
)
|
||||
set(_Vulkan_hint_library_search_paths
|
||||
${_Vulkan_SDK}/lib
|
||||
)
|
||||
endif()
|
||||
if(APPLE AND IOS)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
list(APPEND _Vulkan_hint_library_search_paths
|
||||
${Vulkan_SDK_Base}/iOS/lib
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "tvOS")
|
||||
list(APPEND _Vulkan_hint_library_search_paths
|
||||
${Vulkan_SDK_Base}/tvOS/lib
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_path(Vulkan_INCLUDE_DIR
|
||||
NAMES vulkan/vulkan.h
|
||||
HINTS
|
||||
${_Vulkan_hint_include_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_INCLUDE_DIR)
|
||||
|
||||
find_library(Vulkan_LIBRARY
|
||||
NAMES ${_Vulkan_library_name}
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
message(STATUS "Vulkan_LIBRARY ${Vulkan_LIBRARY} search paths ${_Vulkan_hint_library_search_paths}")
|
||||
mark_as_advanced(Vulkan_LIBRARY)
|
||||
|
||||
find_library(Vulkan_Layer_API_DUMP
|
||||
NAMES VkLayer_api_dump
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_Layer_API_DUMP)
|
||||
|
||||
find_library(Vulkan_Layer_SHADER_OBJECT
|
||||
NAMES VkLayer_khronos_shader_object
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(VkLayer_khronos_shader_object)
|
||||
|
||||
find_library(Vulkan_Layer_SYNC2
|
||||
NAMES VkLayer_khronos_synchronization2
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_Layer_SYNC2)
|
||||
|
||||
find_library(Vulkan_Layer_VALIDATION
|
||||
NAMES VkLayer_khronos_validation
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_Layer_VALIDATION)
|
||||
|
||||
if(glslc IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
find_program(Vulkan_GLSLC_EXECUTABLE
|
||||
NAMES glslc
|
||||
HINTS
|
||||
${_Vulkan_hint_executable_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_GLSLC_EXECUTABLE)
|
||||
endif()
|
||||
if(glslangValidator IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
find_program(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE
|
||||
NAMES glslangValidator
|
||||
HINTS
|
||||
${_Vulkan_hint_executable_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
|
||||
endif()
|
||||
if(glslang IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
find_library(Vulkan_glslang-spirv_LIBRARY
|
||||
NAMES SPIRV
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-spirv_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-spirv_DEBUG_LIBRARY
|
||||
NAMES SPIRVd
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-spirv_DEBUG_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-oglcompiler_LIBRARY
|
||||
NAMES OGLCompiler
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-oglcompiler_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY
|
||||
NAMES OGLCompilerd
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-osdependent_LIBRARY
|
||||
NAMES OSDependent
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-osdependent_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-osdependent_DEBUG_LIBRARY
|
||||
NAMES OSDependentd
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-osdependent_DEBUG_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-machineindependent_LIBRARY
|
||||
NAMES MachineIndependent
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-machineindependent_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-machineindependent_DEBUG_LIBRARY
|
||||
NAMES MachineIndependentd
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-machineindependent_DEBUG_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-genericcodegen_LIBRARY
|
||||
NAMES GenericCodeGen
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-genericcodegen_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY
|
||||
NAMES GenericCodeGend
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang_LIBRARY
|
||||
NAMES glslang
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang_LIBRARY)
|
||||
|
||||
find_library(Vulkan_glslang_DEBUG_LIBRARY
|
||||
NAMES glslangd
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_glslang_DEBUG_LIBRARY)
|
||||
endif()
|
||||
if(shaderc_combined IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
find_library(Vulkan_shaderc_combined_LIBRARY
|
||||
NAMES shaderc_combined
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths})
|
||||
mark_as_advanced(Vulkan_shaderc_combined_LIBRARY)
|
||||
|
||||
find_library(Vulkan_shaderc_combined_DEBUG_LIBRARY
|
||||
NAMES shaderc_combinedd
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths})
|
||||
mark_as_advanced(Vulkan_shaderc_combined_DEBUG_LIBRARY)
|
||||
endif()
|
||||
if(SPIRV-Tools IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
find_library(Vulkan_SPIRV-Tools_LIBRARY
|
||||
NAMES SPIRV-Tools
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths})
|
||||
mark_as_advanced(Vulkan_SPIRV-Tools_LIBRARY)
|
||||
|
||||
find_library(Vulkan_SPIRV-Tools_DEBUG_LIBRARY
|
||||
NAMES SPIRV-Toolsd
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths})
|
||||
mark_as_advanced(Vulkan_SPIRV-Tools_DEBUG_LIBRARY)
|
||||
endif()
|
||||
if(MoltenVK IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
# CMake has a bug in 3.28 that doesn't handle xcframeworks. Do it by hand for now.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||
if(CMAKE_VERSION VERSION_LESS 3.29)
|
||||
set( _Vulkan_hint_library_search_paths ${Vulkan_SDK_Base}/ios/lib/MoltenVK.xcframework/ios-arm64)
|
||||
else ()
|
||||
set( _Vulkan_hint_library_search_paths ${Vulkan_SDK_Base}/ios/lib/)
|
||||
endif ()
|
||||
endif ()
|
||||
find_library(Vulkan_MoltenVK_LIBRARY
|
||||
NAMES MoltenVK
|
||||
NO_DEFAULT_PATH
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths}
|
||||
)
|
||||
message(STATUS "MoltenVK_LIBRARY ${Vulkan_MoltenVK_LIBRARY} search paths ${_Vulkan_hint_library_search_paths}")
|
||||
mark_as_advanced(Vulkan_MoltenVK_LIBRARY)
|
||||
|
||||
find_path(Vulkan_MoltenVK_INCLUDE_DIR
|
||||
NAMES MoltenVK/mvk_vulkan.h
|
||||
HINTS
|
||||
${_Vulkan_hint_include_search_paths}
|
||||
)
|
||||
mark_as_advanced(Vulkan_MoltenVK_INCLUDE_DIR)
|
||||
endif()
|
||||
if(volk IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
find_library(Vulkan_volk_LIBRARY
|
||||
NAMES volk
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths})
|
||||
mark_as_advanced(Vulkan_Volk_LIBRARY)
|
||||
endif()
|
||||
|
||||
if (dxc IN_LIST Vulkan_FIND_COMPONENTS)
|
||||
find_library(Vulkan_dxc_LIBRARY
|
||||
NAMES dxcompiler
|
||||
HINTS
|
||||
${_Vulkan_hint_library_search_paths})
|
||||
mark_as_advanced(Vulkan_dxc_LIBRARY)
|
||||
|
||||
find_program(Vulkan_dxc_EXECUTABLE
|
||||
NAMES dxc
|
||||
HINTS
|
||||
${_Vulkan_hint_executable_search_paths})
|
||||
mark_as_advanced(Vulkan_dxc_EXECUTABLE)
|
||||
endif()
|
||||
|
||||
if(DEFINED _Vulkan_saved_cmake_find_framework)
|
||||
set(CMAKE_FIND_FRAMEWORK ${_Vulkan_saved_cmake_find_framework})
|
||||
unset(_Vulkan_saved_cmake_find_framework)
|
||||
endif()
|
||||
|
||||
if(Vulkan_GLSLC_EXECUTABLE)
|
||||
set(Vulkan_glslc_FOUND TRUE)
|
||||
else()
|
||||
set(Vulkan_glslc_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
if(Vulkan_GLSLANG_VALIDATOR_EXECUTABLE)
|
||||
set(Vulkan_glslangValidator_FOUND TRUE)
|
||||
else()
|
||||
set(Vulkan_glslangValidator_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
if (Vulkan_dxc_EXECUTABLE)
|
||||
set(Vulkan_dxc_exe_FOUND TRUE)
|
||||
else()
|
||||
set(Vulkan_dxc_exe_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
function(_Vulkan_set_library_component_found component)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 _ARG
|
||||
"NO_WARNING"
|
||||
""
|
||||
"DEPENDENT_COMPONENTS")
|
||||
|
||||
set(all_dependent_component_found TRUE)
|
||||
foreach(dependent_component IN LISTS _ARG_DEPENDENT_COMPONENTS)
|
||||
if(NOT Vulkan_${dependent_component}_FOUND)
|
||||
set(all_dependent_component_found FALSE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(all_dependent_component_found AND (Vulkan_${component}_LIBRARY OR Vulkan_${component}_DEBUG_LIBRARY))
|
||||
set(Vulkan_${component}_FOUND TRUE PARENT_SCOPE)
|
||||
|
||||
# For Windows Vulkan SDK, third party tools binaries are provided with different MSVC ABI:
|
||||
# - Release binaries uses a runtime library
|
||||
# - Debug binaries uses a debug runtime library
|
||||
# This lead to incompatibilities in linking for some configuration types due to CMake-default or project-configured selected MSVC ABI.
|
||||
if(WIN32 AND NOT _ARG_NO_WARNING)
|
||||
if(NOT Vulkan_${component}_LIBRARY)
|
||||
message(WARNING
|
||||
"Library ${component} for Release configuration is missing, imported target Vulkan::${component} may not be able to link when targeting this build configuration due to incompatible MSVC ABI.")
|
||||
endif()
|
||||
if(NOT Vulkan_${component}_DEBUG_LIBRARY)
|
||||
message(WARNING
|
||||
"Library ${component} for Debug configuration is missing, imported target Vulkan::${component} may not be able to link when targeting this build configuration due to incompatible MSVC ABI. Consider re-installing the Vulkan SDK and request debug libraries to fix this warning.")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(Vulkan_${component}_FOUND FALSE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
_Vulkan_set_library_component_found(glslang-spirv NO_WARNING)
|
||||
_Vulkan_set_library_component_found(glslang-oglcompiler NO_WARNING)
|
||||
_Vulkan_set_library_component_found(glslang-osdependent NO_WARNING)
|
||||
_Vulkan_set_library_component_found(glslang-machineindependent NO_WARNING)
|
||||
_Vulkan_set_library_component_found(glslang-genericcodegen NO_WARNING)
|
||||
_Vulkan_set_library_component_found(glslang
|
||||
DEPENDENT_COMPONENTS
|
||||
glslang-spirv
|
||||
glslang-oglcompiler
|
||||
glslang-osdependent
|
||||
glslang-machineindependent
|
||||
glslang-genericcodegen)
|
||||
_Vulkan_set_library_component_found(shaderc_combined)
|
||||
_Vulkan_set_library_component_found(SPIRV-Tools)
|
||||
_Vulkan_set_library_component_found(volk)
|
||||
_Vulkan_set_library_component_found(dxc)
|
||||
|
||||
if(Vulkan_MoltenVK_INCLUDE_DIR AND Vulkan_MoltenVK_LIBRARY)
|
||||
set(Vulkan_MoltenVK_FOUND TRUE)
|
||||
else()
|
||||
set(Vulkan_MoltenVK_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
|
||||
set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
|
||||
|
||||
# detect version e.g 1.2.189
|
||||
set(Vulkan_VERSION "")
|
||||
if(Vulkan_INCLUDE_DIR)
|
||||
set(VULKAN_CORE_H ${Vulkan_INCLUDE_DIR}/vulkan/vulkan_core.h)
|
||||
if(EXISTS ${VULKAN_CORE_H})
|
||||
file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine REGEX "^#define VK_HEADER_VERSION ")
|
||||
string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion "${VulkanHeaderVersionLine}")
|
||||
file(STRINGS ${VULKAN_CORE_H} VulkanHeaderVersionLine2 REGEX "^#define VK_HEADER_VERSION_COMPLETE ")
|
||||
string(REGEX MATCHALL "[0-9]+" VulkanHeaderVersion2 "${VulkanHeaderVersionLine2}")
|
||||
list(LENGTH VulkanHeaderVersion2 _len)
|
||||
# versions >= 1.2.175 have an additional numbers in front of e.g. '0, 1, 2' instead of '1, 2'
|
||||
if(_len EQUAL 3)
|
||||
list(REMOVE_AT VulkanHeaderVersion2 0)
|
||||
endif()
|
||||
list(APPEND VulkanHeaderVersion2 ${VulkanHeaderVersion})
|
||||
list(JOIN VulkanHeaderVersion2 "." Vulkan_VERSION)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(Vulkan_MoltenVK_FOUND)
|
||||
set(Vulkan_MoltenVK_VERSION "")
|
||||
if(Vulkan_MoltenVK_INCLUDE_DIR)
|
||||
set(VK_MVK_MOLTENVK_H ${Vulkan_MoltenVK_INCLUDE_DIR}/MoltenVK/vk_mvk_moltenvk.h)
|
||||
if(EXISTS ${VK_MVK_MOLTENVK_H})
|
||||
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_MAJOR REGEX "^#define MVK_VERSION_MAJOR ")
|
||||
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_MAJOR "${_Vulkan_MoltenVK_VERSION_MAJOR}")
|
||||
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_MINOR REGEX "^#define MVK_VERSION_MINOR ")
|
||||
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_MINOR "${_Vulkan_MoltenVK_VERSION_MINOR}")
|
||||
file(STRINGS ${VK_MVK_MOLTENVK_H} _Vulkan_MoltenVK_VERSION_PATCH REGEX "^#define MVK_VERSION_PATCH ")
|
||||
string(REGEX MATCHALL "[0-9]+" _Vulkan_MoltenVK_VERSION_PATCH "${_Vulkan_MoltenVK_VERSION_PATCH}")
|
||||
set(Vulkan_MoltenVK_VERSION "${_Vulkan_MoltenVK_VERSION_MAJOR}.${_Vulkan_MoltenVK_VERSION_MINOR}.${_Vulkan_MoltenVK_VERSION_PATCH}")
|
||||
unset(_Vulkan_MoltenVK_VERSION_MAJOR)
|
||||
unset(_Vulkan_MoltenVK_VERSION_MINOR)
|
||||
unset(_Vulkan_MoltenVK_VERSION_PATCH)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Vulkan
|
||||
REQUIRED_VARS
|
||||
Vulkan_LIBRARY
|
||||
Vulkan_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
Vulkan_VERSION
|
||||
HANDLE_COMPONENTS
|
||||
)
|
||||
|
||||
if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan)
|
||||
add_library(Vulkan::Vulkan UNKNOWN IMPORTED)
|
||||
get_filename_component(_Vulkan_lib_extension ${Vulkan_LIBRARIES} LAST_EXT)
|
||||
if(_Vulkan_lib_extension STREQUAL ".framework" AND CMAKE_VERSION VERSION_LESS 3.28)
|
||||
set_target_properties(Vulkan::Vulkan PROPERTIES
|
||||
# Prior to 3.28 must reference library just inside the framework.
|
||||
IMPORTED_LOCATION "${Vulkan_LIBRARIES}/vulkan")
|
||||
else()
|
||||
set_target_properties(Vulkan::Vulkan PROPERTIES
|
||||
IMPORTED_LOCATION "${Vulkan_LIBRARIES}")
|
||||
endif()
|
||||
set_target_properties(Vulkan::Vulkan PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
unset(_Vulkan_lib_extension)
|
||||
endif()
|
||||
|
||||
if(Vulkan_FOUND AND NOT TARGET Vulkan::Headers)
|
||||
add_library(Vulkan::Headers INTERFACE IMPORTED)
|
||||
set_target_properties(Vulkan::Headers PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
if(Vulkan_FOUND AND Vulkan_GLSLC_EXECUTABLE AND NOT TARGET Vulkan::glslc)
|
||||
add_executable(Vulkan::glslc IMPORTED)
|
||||
set_property(TARGET Vulkan::glslc PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLC_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
if(Vulkan_FOUND AND Vulkan_GLSLANG_VALIDATOR_EXECUTABLE AND NOT TARGET Vulkan::glslangValidator)
|
||||
add_executable(Vulkan::glslangValidator IMPORTED)
|
||||
set_property(TARGET Vulkan::glslangValidator PROPERTY IMPORTED_LOCATION "${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
if(Vulkan_FOUND)
|
||||
if((Vulkan_glslang-spirv_LIBRARY OR Vulkan_glslang-spirv_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-spirv)
|
||||
add_library(Vulkan::glslang-spirv STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::glslang-spirv
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
if(Vulkan_glslang-spirv_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-spirv APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::glslang-spirv
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-spirv_LIBRARY}")
|
||||
endif()
|
||||
if(Vulkan_glslang-spirv_DEBUG_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-spirv APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Debug)
|
||||
set_property(TARGET Vulkan::glslang-spirv
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-spirv_DEBUG_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((Vulkan_glslang-oglcompiler_LIBRARY OR Vulkan_glslang-oglcompiler_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-oglcompiler)
|
||||
add_library(Vulkan::glslang-oglcompiler STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::glslang-oglcompiler
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
if(Vulkan_glslang-oglcompiler_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-oglcompiler APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::glslang-oglcompiler
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-oglcompiler_LIBRARY}")
|
||||
endif()
|
||||
if(Vulkan_glslang-oglcompiler_DEBUG_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-oglcompiler APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Debug)
|
||||
set_property(TARGET Vulkan::glslang-oglcompiler
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-oglcompiler_DEBUG_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((Vulkan_glslang-osdependent_LIBRARY OR Vulkan_glslang-osdependent_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-osdependent)
|
||||
add_library(Vulkan::glslang-osdependent STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::glslang-osdependent
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
if(Vulkan_glslang-osdependent_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-osdependent APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::glslang-osdependent
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-osdependent_LIBRARY}")
|
||||
endif()
|
||||
if(Vulkan_glslang-osdependent_DEBUG_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-osdependent APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Debug)
|
||||
set_property(TARGET Vulkan::glslang-osdependent
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-osdependent_DEBUG_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((Vulkan_glslang-machineindependent_LIBRARY OR Vulkan_glslang-machineindependent_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-machineindependent)
|
||||
add_library(Vulkan::glslang-machineindependent STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::glslang-machineindependent
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
if(Vulkan_glslang-machineindependent_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-machineindependent APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::glslang-machineindependent
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-machineindependent_LIBRARY}")
|
||||
endif()
|
||||
if(Vulkan_glslang-machineindependent_DEBUG_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-machineindependent APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Debug)
|
||||
set_property(TARGET Vulkan::glslang-machineindependent
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-machineindependent_DEBUG_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((Vulkan_glslang-genericcodegen_LIBRARY OR Vulkan_glslang-genericcodegen_DEBUG_LIBRARY) AND NOT TARGET Vulkan::glslang-genericcodegen)
|
||||
add_library(Vulkan::glslang-genericcodegen STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::glslang-genericcodegen
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
if(Vulkan_glslang-genericcodegen_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-genericcodegen APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::glslang-genericcodegen
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang-genericcodegen_LIBRARY}")
|
||||
endif()
|
||||
if(Vulkan_glslang-genericcodegen_DEBUG_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang-genericcodegen APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Debug)
|
||||
set_property(TARGET Vulkan::glslang-genericcodegen
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang-genericcodegen_DEBUG_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((Vulkan_glslang_LIBRARY OR Vulkan_glslang_DEBUG_LIBRARY)
|
||||
AND TARGET Vulkan::glslang-spirv
|
||||
AND TARGET Vulkan::glslang-oglcompiler
|
||||
AND TARGET Vulkan::glslang-osdependent
|
||||
AND TARGET Vulkan::glslang-machineindependent
|
||||
AND TARGET Vulkan::glslang-genericcodegen
|
||||
AND NOT TARGET Vulkan::glslang)
|
||||
add_library(Vulkan::glslang STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::glslang
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
if(Vulkan_glslang_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::glslang
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_glslang_LIBRARY}")
|
||||
endif()
|
||||
if(Vulkan_glslang_DEBUG_LIBRARY)
|
||||
set_property(TARGET Vulkan::glslang APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Debug)
|
||||
set_property(TARGET Vulkan::glslang
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${Vulkan_glslang_DEBUG_LIBRARY}")
|
||||
endif()
|
||||
target_link_libraries(Vulkan::glslang
|
||||
INTERFACE
|
||||
Vulkan::glslang-spirv
|
||||
Vulkan::glslang-oglcompiler
|
||||
Vulkan::glslang-osdependent
|
||||
Vulkan::glslang-machineindependent
|
||||
Vulkan::glslang-genericcodegen
|
||||
)
|
||||
endif()
|
||||
|
||||
if((Vulkan_shaderc_combined_LIBRARY OR Vulkan_shaderc_combined_DEBUG_LIBRARY) AND NOT TARGET Vulkan::shaderc_combined)
|
||||
add_library(Vulkan::shaderc_combined STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::shaderc_combined
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
if(Vulkan_shaderc_combined_LIBRARY)
|
||||
set_property(TARGET Vulkan::shaderc_combined APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::shaderc_combined
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_shaderc_combined_LIBRARY}")
|
||||
endif()
|
||||
if(Vulkan_shaderc_combined_DEBUG_LIBRARY)
|
||||
set_property(TARGET Vulkan::shaderc_combined APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Debug)
|
||||
set_property(TARGET Vulkan::shaderc_combined
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${Vulkan_shaderc_combined_DEBUG_LIBRARY}")
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(Vulkan::shaderc_combined
|
||||
INTERFACE
|
||||
Threads::Threads)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((Vulkan_SPIRV-Tools_LIBRARY OR Vulkan_SPIRV-Tools_DEBUG_LIBRARY) AND NOT TARGET Vulkan::SPIRV-Tools)
|
||||
add_library(Vulkan::SPIRV-Tools STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::SPIRV-Tools
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
if(Vulkan_SPIRV-Tools_LIBRARY)
|
||||
set_property(TARGET Vulkan::SPIRV-Tools APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::SPIRV-Tools
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_SPIRV-Tools_LIBRARY}")
|
||||
endif()
|
||||
if(Vulkan_SPIRV-Tools_DEBUG_LIBRARY)
|
||||
set_property(TARGET Vulkan::SPIRV-Tools APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Debug)
|
||||
set_property(TARGET Vulkan::SPIRV-Tools
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${Vulkan_SPIRV-Tools_DEBUG_LIBRARY}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(Vulkan_volk_LIBRARY AND NOT TARGET Vulkan::volk)
|
||||
add_library(Vulkan::volk STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::volk
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
set_property(TARGET Vulkan::volk APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::volk APPEND
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_volk_LIBRARY}")
|
||||
|
||||
if (NOT WIN32)
|
||||
set_property(TARGET Vulkan::volk APPEND
|
||||
PROPERTY
|
||||
IMPORTED_LINK_INTERFACE_LIBRARIES dl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (Vulkan_dxc_LIBRARY AND NOT TARGET Vulkan::dxc_lib)
|
||||
add_library(Vulkan::dxc_lib STATIC IMPORTED)
|
||||
set_property(TARGET Vulkan::dxc_lib
|
||||
PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIRS}")
|
||||
set_property(TARGET Vulkan::dxc_lib APPEND
|
||||
PROPERTY
|
||||
IMPORTED_CONFIGURATIONS Release)
|
||||
set_property(TARGET Vulkan::dxc_lib APPEND
|
||||
PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${Vulkan_dxc_LIBRARY}")
|
||||
endif()
|
||||
|
||||
if(Vulkan_dxc_EXECUTABLE AND NOT TARGET Vulkan::dxc_exe)
|
||||
add_executable(Vulkan::dxc_exe IMPORTED)
|
||||
set_property(TARGET Vulkan::dxc_exe PROPERTY IMPORTED_LOCATION "${Vulkan_dxc_EXECUTABLE}")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(Vulkan_MoltenVK_FOUND)
|
||||
if(Vulkan_MoltenVK_LIBRARY AND NOT TARGET Vulkan::MoltenVK)
|
||||
add_library(Vulkan::MoltenVK SHARED IMPORTED)
|
||||
set_target_properties(Vulkan::MoltenVK
|
||||
PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_MoltenVK_INCLUDE_DIR}"
|
||||
IMPORTED_LOCATION "${Vulkan_MoltenVK_LIBRARY}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
unset(_Vulkan_library_name)
|
||||
unset(_Vulkan_SDK)
|
||||
unset(_Vulkan_SDK_dirname)
|
||||
unset(_Vulkan_hint_include_search_paths)
|
||||
unset(_Vulkan_hint_executable_search_paths)
|
||||
unset(_Vulkan_hint_library_search_paths)
|
||||
|
||||
cmake_policy(POP)
|
||||
@@ -0,0 +1,89 @@
|
||||
# Copyright 2020 Andreas Atteneder
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(ASSIMP_ARCHITECTURE "64")
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(ASSIMP_ARCHITECTURE "32")
|
||||
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
|
||||
if(WIN32)
|
||||
set(ASSIMP_ROOT_DIR CACHE PATH "ASSIMP root directory")
|
||||
|
||||
# Find path of each library
|
||||
find_path(ASSIMP_INCLUDE_DIR
|
||||
NAMES
|
||||
assimp/anim.h
|
||||
HINTS
|
||||
${ASSIMP_ROOT_DIR}/include
|
||||
)
|
||||
|
||||
if(MSVC12)
|
||||
set(ASSIMP_MSVC_VERSION "vc120")
|
||||
elseif(MSVC14)
|
||||
set(ASSIMP_MSVC_VERSION "vc140")
|
||||
endif(MSVC12)
|
||||
|
||||
if(MSVC12 OR MSVC14)
|
||||
|
||||
find_path(ASSIMP_LIBRARY_DIR
|
||||
NAMES
|
||||
assimp-${ASSIMP_MSVC_VERSION}-mt.lib
|
||||
HINTS
|
||||
${ASSIMP_ROOT_DIR}/lib${ASSIMP_ARCHITECTURE}
|
||||
)
|
||||
|
||||
find_library(ASSIMP_LIBRARY_RELEASE assimp-${ASSIMP_MSVC_VERSION}-mt.lib PATHS ${ASSIMP_LIBRARY_DIR})
|
||||
find_library(ASSIMP_LIBRARY_DEBUG assimp-${ASSIMP_MSVC_VERSION}-mtd.lib PATHS ${ASSIMP_LIBRARY_DIR})
|
||||
|
||||
set(ASSIMP_LIBRARY
|
||||
optimized ${ASSIMP_LIBRARY_RELEASE}
|
||||
debug ${ASSIMP_LIBRARY_DEBUG}
|
||||
)
|
||||
|
||||
set(ASSIMP_LIBRARIES "ASSIMP_LIBRARY_RELEASE" "ASSIMP_LIBRARY_DEBUG")
|
||||
|
||||
FUNCTION(ASSIMP_COPY_BINARIES TargetDirectory)
|
||||
ADD_CUSTOM_TARGET(AssimpCopyBinaries
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${TargetDirectory}/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${TargetDirectory}/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll
|
||||
COMMENT "Copying Assimp binaries to '${TargetDirectory}'"
|
||||
VERBATIM)
|
||||
ENDFUNCTION(ASSIMP_COPY_BINARIES)
|
||||
|
||||
endif()
|
||||
|
||||
else(WIN32)
|
||||
|
||||
find_path(
|
||||
assimp_INCLUDE_DIRS
|
||||
NAMES assimp/postprocess.h assimp/scene.h assimp/version.h assimp/config.h assimp/cimport.h
|
||||
PATHS /usr/local/include
|
||||
PATHS /usr/include/
|
||||
|
||||
)
|
||||
|
||||
find_library(
|
||||
assimp_LIBRARIES
|
||||
NAMES assimp
|
||||
PATHS /usr/local/lib/
|
||||
PATHS /usr/lib64/
|
||||
PATHS /usr/lib/
|
||||
)
|
||||
|
||||
if (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
|
||||
SET(assimp_FOUND TRUE)
|
||||
ENDIF (assimp_INCLUDE_DIRS AND assimp_LIBRARIES)
|
||||
|
||||
if (assimp_FOUND)
|
||||
if (NOT assimp_FIND_QUIETLY)
|
||||
message(STATUS "Found asset importer library: ${assimp_LIBRARIES}")
|
||||
endif (NOT assimp_FIND_QUIETLY)
|
||||
else (assimp_FOUND)
|
||||
if (assimp_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find asset importer library")
|
||||
endif (assimp_FIND_REQUIRED)
|
||||
endif (assimp_FOUND)
|
||||
|
||||
endif(WIN32)
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
#[============================================================================
|
||||
# Copyright 2022, Khronos Group, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#============================================================================]
|
||||
|
||||
# Functions to convert unix-style paths into paths useable by cmake on windows.
|
||||
#[=======================================================================[.rst:
|
||||
Findsigntool
|
||||
-------
|
||||
|
||||
Finds the signtool executable used for codesigning on Windows.
|
||||
|
||||
Note that signtool does not offer a way to make it print its version
|
||||
so version selection and reporting is not possible.
|
||||
|
||||
Result Variables
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
This will define the following variables:
|
||||
|
||||
``signtool_FOUND``
|
||||
True if the system has the signtool executable.
|
||||
``signtool_EXECUTABLE``
|
||||
The signtool command executable.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
if (WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES "CYGWIN.*")
|
||||
find_program(CYGPATH
|
||||
NAMES cygpath
|
||||
HINTS [HKEY_LOCAL_MACHINE\\Software\\Cygwin\\setup;rootdir]/bin
|
||||
PATHS C:/cygwin64/bin
|
||||
C:/cygwin/bin
|
||||
)
|
||||
endif ()
|
||||
|
||||
function(convert_cygwin_path _pathvar)
|
||||
if (WIN32 AND CYGPATH)
|
||||
execute_process(
|
||||
COMMAND "${CYGPATH}" -m "${${_pathvar}}"
|
||||
OUTPUT_VARIABLE ${_pathvar}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(${_pathvar} "${${_pathvar}}" PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
function(convert_windows_path _pathvar)
|
||||
if (CYGPATH)
|
||||
execute_process(
|
||||
COMMAND "${CYGPATH}" "${${_pathvar}}"
|
||||
OUTPUT_VARIABLE ${_pathvar}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
set(${_pathvar} "${${_pathvar}}" PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction()
|
||||
|
||||
# Make a list of Windows Kit versions with newer versions first.
|
||||
#
|
||||
# _root string KitsRoot for the Windows version whose kits to find.
|
||||
# _versions variable name Variable in which to return the list of versions.
|
||||
#
|
||||
function(find_kits _winver _kit_versions)
|
||||
set(${_kit_versions})
|
||||
set(_kit_root "KitsRoot${_winver}")
|
||||
set(regkey "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots")
|
||||
set(regval ${_kit_root})
|
||||
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Windows")
|
||||
# Note: must be a cache operation in order to read from the registry.
|
||||
get_filename_component(_kits_path "[${regkey};${regval}]"
|
||||
ABSOLUTE CACHE
|
||||
)
|
||||
elseif(CMAKE_HOST_SYSTEM_NAME MATCHES "CYGWIN.*")
|
||||
# On Cygwin, CMake's built-in registry query won't work.
|
||||
# Use Cygwin utility "regtool" instead.
|
||||
execute_process(COMMAND regtool get "\\${regkey}\\${regval}"
|
||||
OUTPUT_VARIABLE _kits_path}
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if (_kits_path)
|
||||
convert_windows_path(_kits_path)
|
||||
endif ()
|
||||
endif()
|
||||
if (_kits_path)
|
||||
file(GLOB ${_kit_versions} "${_kits_path}/bin/${_winver}.*")
|
||||
# Reverse list, so newer versions (higher-numbered) appear first.
|
||||
list(REVERSE ${_kit_versions})
|
||||
endif ()
|
||||
unset(_kits_path CACHE)
|
||||
set(${_kit_versions} ${${_kit_versions}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if (WIN32 AND NOT signtool_EXECUTABLE)
|
||||
if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "AMD64")
|
||||
set(arch "x64")
|
||||
else()
|
||||
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
# Look for latest signtool
|
||||
foreach(winver 11 10)
|
||||
find_kits(${winver} kit_versions)
|
||||
if (kit_versions)
|
||||
find_program(signtool_EXECUTABLE
|
||||
NAMES signtool
|
||||
PATHS ${kit_versions}
|
||||
PATH_SUFFIXES ${arch}
|
||||
bin/${arch}
|
||||
bin
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if (signtool_EXECUTABLE)
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if (signtool_EXECUTABLE)
|
||||
mark_as_advanced (signtool_EXECUTABLE)
|
||||
endif ()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set *_FOUND to TRUE
|
||||
# if all listed variables are found or TRUE
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args (
|
||||
signtool
|
||||
REQUIRED_VARS
|
||||
signtool_EXECUTABLE
|
||||
FAIL_MESSAGE
|
||||
"Could NOT find signtool. Will be unable to sign Windows binaries."
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,33 @@
|
||||
# Copyright 2020 Andreas Atteneder
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# - Find zstd
|
||||
# Find the zstd compression library and includes
|
||||
#
|
||||
# zstd_INCLUDE_DIRS - where to find zstd.h, etc.
|
||||
# zstd_LIBRARIES - List of libraries when using zstd.
|
||||
# zstd_FOUND - True if zstd found.
|
||||
|
||||
find_path(zstd_INCLUDE_DIRS
|
||||
NAMES zstd.h
|
||||
HINTS ${zstd_ROOT_DIR}/include)
|
||||
|
||||
find_library(zstd_LIBRARIES
|
||||
NAMES zstd
|
||||
HINTS ${zstd_ROOT_DIR}/lib)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(zstd DEFAULT_MSG zstd_LIBRARIES zstd_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(
|
||||
zstd_LIBRARIES
|
||||
zstd_INCLUDE_DIRS)
|
||||
|
||||
if(zstd_FOUND AND NOT (TARGET zstd::zstd))
|
||||
add_library (zstd::zstd UNKNOWN IMPORTED)
|
||||
set_target_properties(zstd::zstd
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION ${zstd_LIBRARIES}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${zstd_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
# Copyright 2009-2010 Iowa State University
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
# - Returns a version string from Git
|
||||
#
|
||||
# These functions force a re-configure on each git commit so that you can
|
||||
# trust the values of the variables in your build system.
|
||||
#
|
||||
# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the refspec and sha hash of the current head revision
|
||||
#
|
||||
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe on the source tree, and adjusting
|
||||
# the output so that it tests false if an error occurs.
|
||||
#
|
||||
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||
#
|
||||
# Returns the results of git describe --exact-match on the source tree,
|
||||
# and adjusting the output so that it tests false if there was no exact
|
||||
# matching tag.
|
||||
#
|
||||
# git_local_changes(<var>)
|
||||
#
|
||||
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||
# Does not regard untracked files.
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
if(__get_git_revision_description)
|
||||
return()
|
||||
endif()
|
||||
set(__get_git_revision_description YES)
|
||||
|
||||
# We must run the following at "include" time, not at function call time,
|
||||
# to find the path to this module rather than the path to a calling list file
|
||||
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
|
||||
function(get_git_head_revision _refspecvar _hashvar)
|
||||
set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories
|
||||
set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
|
||||
get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
|
||||
if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
|
||||
# We have reached the root directory, we are not in git
|
||||
set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
set(GIT_DIR "${GIT_PARENT_DIR}/.git")
|
||||
endwhile()
|
||||
# check if this is a submodule
|
||||
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||
file(READ ${GIT_DIR} submodule)
|
||||
string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
|
||||
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
|
||||
endif()
|
||||
if(NOT IS_DIRECTORY "${GIT_DIR}")
|
||||
file(READ ${GIT_DIR} worktree)
|
||||
string(REGEX REPLACE "gitdir: (.*)worktrees(.*)\n$" "\\1" GIT_DIR ${worktree})
|
||||
endif()
|
||||
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||
if(NOT EXISTS "${GIT_DATA}")
|
||||
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${GIT_DIR}/HEAD")
|
||||
return()
|
||||
endif()
|
||||
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||
configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
|
||||
|
||||
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||
"${GIT_DATA}/grabRef.cmake"
|
||||
@ONLY)
|
||||
include("${GIT_DATA}/grabRef.cmake")
|
||||
|
||||
set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
|
||||
set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_describe _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# TODO sanitize
|
||||
#if((${ARGN}" MATCHES "&&") OR
|
||||
# (ARGN MATCHES "||") OR
|
||||
# (ARGN MATCHES "\\;"))
|
||||
# message("Please report the following error to the project!")
|
||||
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||
#endif()
|
||||
|
||||
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${hash}
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "${out}-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_get_exact_tag _var)
|
||||
git_describe(out --exact-match ${ARGN})
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_local_changes _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
get_git_head_revision(refspec hash)
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
if(NOT hash)
|
||||
set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
diff-index --quiet HEAD --
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(res EQUAL 0)
|
||||
set(${_var} "CLEAN" PARENT_SCOPE)
|
||||
else()
|
||||
set(${_var} "DIRTY" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -0,0 +1,44 @@
|
||||
# Copyright 2009-2010 Iowa State University
|
||||
# SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#
|
||||
# Internal file for GetGitRevisionDescription.cmake
|
||||
#
|
||||
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||
#
|
||||
# Original Author:
|
||||
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||
# http://academic.cleardefinition.com
|
||||
# Iowa State University HCI Graduate Program/VRAC
|
||||
#
|
||||
# Copyright Iowa State University 2009-2010.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
set(HEAD_HASH)
|
||||
|
||||
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||
|
||||
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||
if(HEAD_CONTENTS MATCHES "ref")
|
||||
# named branch
|
||||
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
else()
|
||||
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# detached HEAD
|
||||
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||
endif()
|
||||
|
||||
if(NOT HEAD_HASH)
|
||||
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||
endif()
|
||||
@@ -0,0 +1,79 @@
|
||||
#[============================================================================
|
||||
# Copyright 2022, Khronos Group, Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#============================================================================]
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
KtxDependentVariable
|
||||
--------------------
|
||||
|
||||
Macro to provide a cache variable dependent on other options.
|
||||
|
||||
This macro presents the variable to the user only if a set of other
|
||||
conditions are true.
|
||||
|
||||
.. command:: dependent_variable
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
KTX_DEPENDENT_VARIABLE(<var> type "<help_text>" <value> <depends> <force>)
|
||||
|
||||
Makes ``<var>`` available to the user if the
|
||||
:ref:`semicolon-separated list <CMake Language Lists>` of conditions in
|
||||
``<depends>`` are all true. Otherwise, a local variable named ``<var>``
|
||||
is set to ``<force>``.
|
||||
|
||||
When ``<var>`` is available, the given ``<help_text>`` and initial
|
||||
``<value>`` are used. Otherwise, any value set by the user is preserved for
|
||||
when ``<depends>`` is satisfied in the future.
|
||||
|
||||
Note that the ``<var>`` variable only has a value which satisfies the
|
||||
``<depends>`` condition within the scope of the caller because it is a local
|
||||
variable.
|
||||
|
||||
Example invocation:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
KTX_DEPENDENT_VARIABLE(USE_FOO STRING "Use Foo" "Default" "USE_BAR;NOT USE_ZOT" "")
|
||||
|
||||
If ``USE_BAR`` is true and ``USE_ZOT`` is false, this provides an var called
|
||||
``USE_FOO`` that defaults to Default. Otherwise, it sets ``USE_FOO`` to OFF and
|
||||
hides the var from the user. If the status of ``USE_BAR`` or ``USE_ZOT``
|
||||
ever changes, any value for the ``USE_FOO`` var is saved so that when the
|
||||
var is re-enabled it retains its old value.
|
||||
|
||||
An important difference to CMakeDependentOption is that this does an early
|
||||
out on false when processing the list of dependencies. This is so expressions
|
||||
of dependencies based on a potentially unset variable do not fail when it
|
||||
is unset.
|
||||
|
||||
#]=======================================================================]
|
||||
|
||||
macro(KTX_DEPENDENT_VARIABLE var type doc default depends force)
|
||||
if(${var}_ISSET MATCHES "^${var}_ISSET$")
|
||||
set(${var}_AVAILABLE 1)
|
||||
foreach(d ${depends})
|
||||
cmake_language(EVAL CODE "
|
||||
if (${d})
|
||||
else()
|
||||
set(${var}_AVAILABLE 0)
|
||||
endif()"
|
||||
)
|
||||
if(NOT ${${var}_AVAILABLE})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if(${var}_AVAILABLE)
|
||||
set(${var} "${${var}}" CACHE ${type} "${doc}" FORCE)
|
||||
else()
|
||||
if(${var} MATCHES "^${var}$")
|
||||
else()
|
||||
set(${var} "${${var}}" CACHE INTERNAL "${doc}")
|
||||
endif()
|
||||
set(${var} ${force})
|
||||
endif()
|
||||
else()
|
||||
set(${var} "${${var}_ISSET}")
|
||||
endif()
|
||||
endmacro()
|
||||
@@ -0,0 +1,37 @@
|
||||
[Settings]
|
||||
NumFields=4
|
||||
|
||||
[Field 1]
|
||||
Type=label
|
||||
Text=By default @CPACK_PACKAGE_INSTALL_DIRECTORY@ does not add its directory to the system PATH.
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=0
|
||||
Bottom=20
|
||||
|
||||
[Field 2]
|
||||
Type=radiobutton
|
||||
Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=30
|
||||
Bottom=40
|
||||
State=1
|
||||
|
||||
[Field 3]
|
||||
Type=radiobutton
|
||||
Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=40
|
||||
Bottom=50
|
||||
State=0
|
||||
|
||||
[Field 4]
|
||||
Type=radiobutton
|
||||
Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user
|
||||
Left=0
|
||||
Right=-1
|
||||
Top=50
|
||||
Bottom=60
|
||||
State=0
|
||||
@@ -0,0 +1,987 @@
|
||||
; Copyright 2020 Andreas Atteneder
|
||||
; SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
; CPack install script designed for a nmake build
|
||||
|
||||
;--------------------------------
|
||||
; You must define these values
|
||||
|
||||
!define VERSION "@CPACK_PACKAGE_VERSION@"
|
||||
!define PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
|
||||
!define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
|
||||
|
||||
;--------------------------------
|
||||
;Variables
|
||||
|
||||
Var MUI_TEMP
|
||||
;Var STARTMENU_FOLDER
|
||||
Var SV_ALLUSERS
|
||||
;Var START_MENU
|
||||
Var DO_NOT_ADD_TO_PATH
|
||||
Var ADD_TO_PATH_ALL_USERS
|
||||
Var ADD_TO_PATH_CURRENT_USER
|
||||
Var INSTALL_DESKTOP
|
||||
Var IS_DEFAULT_INSTALLDIR
|
||||
;--------------------------------
|
||||
;Include Modern UI
|
||||
|
||||
!include "MUI.nsh"
|
||||
|
||||
;Default installation folder
|
||||
InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||
|
||||
;--------------------------------
|
||||
;Signing
|
||||
|
||||
!finalize '@CPACK_NSIS_FINALIZE_CMD@'
|
||||
!uninstfinalize '@CPACK_NSIS_FINALIZE_CMD@'
|
||||
|
||||
;--------------------------------
|
||||
;General
|
||||
|
||||
;Name and file
|
||||
Name "@CPACK_NSIS_PACKAGE_NAME@"
|
||||
OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
|
||||
|
||||
;Set compression
|
||||
SetCompressor @CPACK_NSIS_COMPRESSOR@
|
||||
|
||||
;Require administrator access
|
||||
RequestExecutionLevel admin
|
||||
|
||||
@CPACK_NSIS_DEFINES@
|
||||
|
||||
!include Sections.nsh
|
||||
|
||||
;--- Component support macros: ---
|
||||
; The code for the add/remove functionality is from:
|
||||
; http://nsis.sourceforge.net/Add/Remove_Functionality
|
||||
; It has been modified slightly and extended to provide
|
||||
; inter-component dependencies.
|
||||
Var AR_SecFlags
|
||||
Var AR_RegFlags
|
||||
@CPACK_NSIS_SECTION_SELECTED_VARS@
|
||||
|
||||
; Loads the "selected" flag for the section named SecName into the
|
||||
; variable VarName.
|
||||
!macro LoadSectionSelectedIntoVar SecName VarName
|
||||
SectionGetFlags ${${SecName}} $${VarName}
|
||||
IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
|
||||
!macroend
|
||||
|
||||
; Loads the value of a variable... can we get around this?
|
||||
!macro LoadVar VarName
|
||||
IntOp $R0 0 + $${VarName}
|
||||
!macroend
|
||||
|
||||
; Sets the value of a variable
|
||||
!macro StoreVar VarName IntValue
|
||||
IntOp $${VarName} 0 + ${IntValue}
|
||||
!macroend
|
||||
|
||||
!macro InitSection SecName
|
||||
; This macro reads component installed flag from the registry and
|
||||
;changes checked state of the section on the components page.
|
||||
;Input: section index constant name specified in Section command.
|
||||
|
||||
ClearErrors
|
||||
;Reading component status from registry
|
||||
ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
|
||||
IfErrors "default_${SecName}"
|
||||
;Status will stay default if registry value not found
|
||||
;(component was never installed)
|
||||
IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
|
||||
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
|
||||
IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
|
||||
IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
|
||||
|
||||
; Note whether this component was installed before
|
||||
!insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
|
||||
IntOp $R0 $AR_RegFlags & $AR_RegFlags
|
||||
|
||||
;Writing modified flags
|
||||
SectionSetFlags ${${SecName}} $AR_SecFlags
|
||||
|
||||
"default_${SecName}:"
|
||||
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
|
||||
!macroend
|
||||
|
||||
!macro FinishSection SecName
|
||||
; This macro reads section flag set by user and removes the section
|
||||
;if it is not selected.
|
||||
;Then it writes component installed flag to registry
|
||||
;Input: section index constant name specified in Section command.
|
||||
|
||||
SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
|
||||
;Checking lowest bit:
|
||||
IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
|
||||
IntCmp $AR_SecFlags 1 "leave_${SecName}"
|
||||
;Section is not selected:
|
||||
;Calling Section uninstall macro and writing zero installed flag
|
||||
!insertmacro "Remove_${${SecName}}"
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
|
||||
"Installed" 0
|
||||
Goto "exit_${SecName}"
|
||||
|
||||
"leave_${SecName}:"
|
||||
;Section is selected:
|
||||
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
|
||||
"Installed" 1
|
||||
|
||||
"exit_${SecName}:"
|
||||
!macroend
|
||||
|
||||
!macro RemoveSection_CPack SecName
|
||||
; This macro is used to call section's Remove_... macro
|
||||
;from the uninstaller.
|
||||
;Input: section index constant name specified in Section command.
|
||||
|
||||
!insertmacro "Remove_${${SecName}}"
|
||||
!macroend
|
||||
|
||||
; Determine whether the selection of SecName changed
|
||||
!macro MaybeSelectionChanged SecName
|
||||
!insertmacro LoadVar ${SecName}_selected
|
||||
SectionGetFlags ${${SecName}} $R1
|
||||
IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
|
||||
|
||||
; See if the status has changed:
|
||||
IntCmp $R0 $R1 "${SecName}_unchanged"
|
||||
!insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
|
||||
|
||||
IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
|
||||
!insertmacro "Deselect_required_by_${SecName}"
|
||||
goto "${SecName}_unchanged"
|
||||
|
||||
"${SecName}_was_selected:"
|
||||
!insertmacro "Select_${SecName}_depends"
|
||||
|
||||
"${SecName}_unchanged:"
|
||||
!macroend
|
||||
;--- End of Add/Remove macros ---
|
||||
|
||||
;--------------------------------
|
||||
;Interface Settings
|
||||
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_ABORTWARNING
|
||||
|
||||
;----------------------------------------
|
||||
; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
|
||||
;----------------------------------------
|
||||
!verbose 3
|
||||
!include "WinMessages.NSH"
|
||||
!verbose 4
|
||||
;====================================================
|
||||
; get_NT_environment
|
||||
; Returns: the selected environment
|
||||
; Output : head of the stack
|
||||
;====================================================
|
||||
!macro select_NT_profile UN
|
||||
Function ${UN}select_NT_profile
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
|
||||
DetailPrint "Selected environment for all users"
|
||||
Push "all"
|
||||
Return
|
||||
environment_single:
|
||||
DetailPrint "Selected environment for current user only."
|
||||
Push "current"
|
||||
Return
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro select_NT_profile ""
|
||||
!insertmacro select_NT_profile "un."
|
||||
;----------------------------------------------------
|
||||
!define NT_current_env 'HKCU "Environment"'
|
||||
!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
|
||||
!ifndef WriteEnvStr_RegKey
|
||||
!ifdef ALL_USERS
|
||||
!define WriteEnvStr_RegKey \
|
||||
'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
!else
|
||||
!define WriteEnvStr_RegKey 'HKCU "Environment"'
|
||||
!endif
|
||||
!endif
|
||||
|
||||
; AddToPath - Adds the given dir to the search path.
|
||||
; Input - head of the stack
|
||||
; Note - Win9x systems requires reboot
|
||||
|
||||
Function AddToPath
|
||||
Exch $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
|
||||
# don't add if the path doesn't exist
|
||||
IfFileExists "$0\*.*" "" AddToPath_done
|
||||
|
||||
ReadEnvStr $1 PATH
|
||||
; if the path is too long for a NSIS variable NSIS will return a 0
|
||||
; length string. If we find that, then warn and skip any path
|
||||
; modification as it will trash the existing path.
|
||||
StrLen $2 $1
|
||||
IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
|
||||
CheckPathLength_ShowPathWarning:
|
||||
Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
|
||||
Goto AddToPath_done
|
||||
CheckPathLength_Done:
|
||||
Push "$1;"
|
||||
Push "$0;"
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
Push "$1;"
|
||||
Push "$0\;"
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
GetFullPathName /SHORT $3 $0
|
||||
Push "$1;"
|
||||
Push "$3;"
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
Push "$1;"
|
||||
Push "$3\;"
|
||||
Call StrStr
|
||||
Pop $2
|
||||
StrCmp $2 "" "" AddToPath_done
|
||||
|
||||
Call IsNT
|
||||
Pop $1
|
||||
StrCmp $1 1 AddToPath_NT
|
||||
; Not on NT
|
||||
StrCpy $1 $WINDIR 2
|
||||
FileOpen $1 "$1\autoexec.bat" a
|
||||
FileSeek $1 -1 END
|
||||
FileReadByte $1 $2
|
||||
IntCmp $2 26 0 +2 +2 # DOS EOF
|
||||
FileSeek $1 -1 END # write over EOF
|
||||
FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
|
||||
FileClose $1
|
||||
SetRebootFlag true
|
||||
Goto AddToPath_done
|
||||
|
||||
AddToPath_NT:
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
|
||||
ReadRegStr $1 ${NT_current_env} "PATH"
|
||||
Goto DoTrim
|
||||
ReadAllKey:
|
||||
ReadRegStr $1 ${NT_all_env} "PATH"
|
||||
DoTrim:
|
||||
StrCmp $1 "" AddToPath_NTdoIt
|
||||
Push $1
|
||||
Call Trim
|
||||
Pop $1
|
||||
StrCpy $0 "$1;$0"
|
||||
AddToPath_NTdoIt:
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
|
||||
WriteRegExpandStr ${NT_current_env} "PATH" $0
|
||||
Goto DoSend
|
||||
WriteAllKey:
|
||||
WriteRegExpandStr ${NT_all_env} "PATH" $0
|
||||
DoSend:
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
AddToPath_done:
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
|
||||
; RemoveFromPath - Remove a given dir from the path
|
||||
; Input: head of the stack
|
||||
|
||||
Function un.RemoveFromPath
|
||||
Exch $0
|
||||
Push $1
|
||||
Push $2
|
||||
Push $3
|
||||
Push $4
|
||||
Push $5
|
||||
Push $6
|
||||
|
||||
IntFmt $6 "%c" 26 # DOS EOF
|
||||
|
||||
Call un.IsNT
|
||||
Pop $1
|
||||
StrCmp $1 1 unRemoveFromPath_NT
|
||||
; Not on NT
|
||||
StrCpy $1 $WINDIR 2
|
||||
FileOpen $1 "$1\autoexec.bat" r
|
||||
GetTempFileName $4
|
||||
FileOpen $2 $4 w
|
||||
GetFullPathName /SHORT $0 $0
|
||||
StrCpy $0 "SET PATH=%PATH%;$0"
|
||||
Goto unRemoveFromPath_dosLoop
|
||||
|
||||
unRemoveFromPath_dosLoop:
|
||||
FileRead $1 $3
|
||||
StrCpy $5 $3 1 -1 # read last char
|
||||
StrCmp $5 $6 0 +2 # if DOS EOF
|
||||
StrCpy $3 $3 -1 # remove DOS EOF so we can compare
|
||||
StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
|
||||
StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
|
||||
StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
|
||||
StrCmp $3 "" unRemoveFromPath_dosLoopEnd
|
||||
FileWrite $2 $3
|
||||
Goto unRemoveFromPath_dosLoop
|
||||
unRemoveFromPath_dosLoopRemoveLine:
|
||||
SetRebootFlag true
|
||||
Goto unRemoveFromPath_dosLoop
|
||||
|
||||
unRemoveFromPath_dosLoopEnd:
|
||||
FileClose $2
|
||||
FileClose $1
|
||||
StrCpy $1 $WINDIR 2
|
||||
Delete "$1\autoexec.bat"
|
||||
CopyFiles /SILENT $4 "$1\autoexec.bat"
|
||||
Delete $4
|
||||
Goto unRemoveFromPath_done
|
||||
|
||||
unRemoveFromPath_NT:
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
|
||||
ReadRegStr $1 ${NT_current_env} "PATH"
|
||||
Goto unDoTrim
|
||||
unReadAllKey:
|
||||
ReadRegStr $1 ${NT_all_env} "PATH"
|
||||
unDoTrim:
|
||||
StrCpy $5 $1 1 -1 # copy last char
|
||||
StrCmp $5 ";" +2 # if last char != ;
|
||||
StrCpy $1 "$1;" # append ;
|
||||
Push $1
|
||||
Push "$0;"
|
||||
Call un.StrStr ; Find `$0;` in $1
|
||||
Pop $2 ; pos of our dir
|
||||
StrCmp $2 "" unRemoveFromPath_done
|
||||
; else, it is in path
|
||||
# $0 - path to add
|
||||
# $1 - path var
|
||||
StrLen $3 "$0;"
|
||||
StrLen $4 $2
|
||||
StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
|
||||
StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
|
||||
StrCpy $3 $5$6
|
||||
|
||||
StrCpy $5 $3 1 -1 # copy last char
|
||||
StrCmp $5 ";" 0 +2 # if last char == ;
|
||||
StrCpy $3 $3 -1 # remove last char
|
||||
|
||||
StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
|
||||
WriteRegExpandStr ${NT_current_env} "PATH" $3
|
||||
Goto unDoSend
|
||||
unWriteAllKey:
|
||||
WriteRegExpandStr ${NT_all_env} "PATH" $3
|
||||
unDoSend:
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
|
||||
unRemoveFromPath_done:
|
||||
Pop $6
|
||||
Pop $5
|
||||
Pop $4
|
||||
Pop $3
|
||||
Pop $2
|
||||
Pop $1
|
||||
Pop $0
|
||||
FunctionEnd
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Uninstall sutff
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
###########################################
|
||||
# Utility Functions #
|
||||
###########################################
|
||||
|
||||
;====================================================
|
||||
; IsNT - Returns 1 if the current system is NT, 0
|
||||
; otherwise.
|
||||
; Output: head of the stack
|
||||
;====================================================
|
||||
; IsNT
|
||||
; no input
|
||||
; output, top of the stack = 1 if NT or 0 if not
|
||||
;
|
||||
; Usage:
|
||||
; Call IsNT
|
||||
; Pop $R0
|
||||
; ($R0 at this point is 1 or 0)
|
||||
|
||||
!macro IsNT un
|
||||
Function ${un}IsNT
|
||||
Push $0
|
||||
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
|
||||
StrCmp $0 "" 0 IsNT_yes
|
||||
; we are not NT.
|
||||
Pop $0
|
||||
Push 0
|
||||
Return
|
||||
|
||||
IsNT_yes:
|
||||
; NT!!!
|
||||
Pop $0
|
||||
Push 1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro IsNT ""
|
||||
!insertmacro IsNT "un."
|
||||
|
||||
; StrStr
|
||||
; input, top of stack = string to search for
|
||||
; top of stack-1 = string to search in
|
||||
; output, top of stack (replaces with the portion of the string remaining)
|
||||
; modifies no other variables.
|
||||
;
|
||||
; Usage:
|
||||
; Push "this is a long ass string"
|
||||
; Push "ass"
|
||||
; Call StrStr
|
||||
; Pop $R0
|
||||
; ($R0 at this point is "ass string")
|
||||
|
||||
!macro StrStr un
|
||||
Function ${un}StrStr
|
||||
Exch $R1 ; st=haystack,old$R1, $R1=needle
|
||||
Exch ; st=old$R1,haystack
|
||||
Exch $R2 ; st=old$R1,old$R2, $R2=haystack
|
||||
Push $R3
|
||||
Push $R4
|
||||
Push $R5
|
||||
StrLen $R3 $R1
|
||||
StrCpy $R4 0
|
||||
; $R1=needle
|
||||
; $R2=haystack
|
||||
; $R3=len(needle)
|
||||
; $R4=cnt
|
||||
; $R5=tmp
|
||||
loop:
|
||||
StrCpy $R5 $R2 $R3 $R4
|
||||
StrCmp $R5 $R1 done
|
||||
StrCmp $R5 "" done
|
||||
IntOp $R4 $R4 + 1
|
||||
Goto loop
|
||||
done:
|
||||
StrCpy $R1 $R2 "" $R4
|
||||
Pop $R5
|
||||
Pop $R4
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
!macroend
|
||||
!insertmacro StrStr ""
|
||||
!insertmacro StrStr "un."
|
||||
|
||||
Function Trim ; Added by Pelaca
|
||||
Exch $R1
|
||||
Push $R2
|
||||
Loop:
|
||||
StrCpy $R2 "$R1" 1 -1
|
||||
StrCmp "$R2" " " RTrim
|
||||
StrCmp "$R2" "$\n" RTrim
|
||||
StrCmp "$R2" "$\r" RTrim
|
||||
StrCmp "$R2" ";" RTrim
|
||||
GoTo Done
|
||||
RTrim:
|
||||
StrCpy $R1 "$R1" -1
|
||||
Goto Loop
|
||||
Done:
|
||||
Pop $R2
|
||||
Exch $R1
|
||||
FunctionEnd
|
||||
|
||||
Function ConditionalAddToRegisty
|
||||
Pop $0
|
||||
Pop $1
|
||||
StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
|
||||
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
|
||||
"$1" "$0"
|
||||
;MessageBox MB_OK "Set Registry: '$1' to '$0'"
|
||||
DetailPrint "Set install registry entry: '$1' to '$0'"
|
||||
ConditionalAddToRegisty_EmptyString:
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
!ifdef CPACK_USES_DOWNLOAD
|
||||
Function DownloadFile
|
||||
IfFileExists $INSTDIR\* +2
|
||||
CreateDirectory $INSTDIR
|
||||
Pop $0
|
||||
|
||||
; Skip if already downloaded
|
||||
IfFileExists $INSTDIR\$0 0 +2
|
||||
Return
|
||||
|
||||
StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
|
||||
|
||||
try_again:
|
||||
NSISdl::download "$1/$0" "$INSTDIR\$0"
|
||||
|
||||
Pop $1
|
||||
StrCmp $1 "success" success
|
||||
StrCmp $1 "Cancelled" cancel
|
||||
MessageBox MB_OK "Download failed: $1"
|
||||
cancel:
|
||||
Return
|
||||
success:
|
||||
FunctionEnd
|
||||
!endif
|
||||
|
||||
;--------------------------------
|
||||
; Define some macro setting for the gui
|
||||
@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
|
||||
@CPACK_NSIS_INSTALLER_ICON_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE@
|
||||
@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
|
||||
@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
|
||||
|
||||
;--------------------------------
|
||||
;Pages
|
||||
@CPACK_NSIS_INSTALLER_WELCOME_TITLE_CODE@
|
||||
@CPACK_NSIS_INSTALLER_WELCOME_TITLE_3LINES_CODE@
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
|
||||
Page custom InstallOptionsPage
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
|
||||
;Start Menu Folder Page Configuration
|
||||
;!define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
|
||||
;!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
;!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
||||
;!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
|
||||
|
||||
@CPACK_NSIS_PAGE_COMPONENTS@
|
||||
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
@CPACK_NSIS_INSTALLER_FINISH_TITLE_CODE@
|
||||
@CPACK_NSIS_INSTALLER_FINISH_TITLE_3LINES_CODE@
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
;--------------------------------
|
||||
;Languages
|
||||
|
||||
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
|
||||
!insertmacro MUI_LANGUAGE "Albanian"
|
||||
!insertmacro MUI_LANGUAGE "Arabic"
|
||||
!insertmacro MUI_LANGUAGE "Basque"
|
||||
!insertmacro MUI_LANGUAGE "Belarusian"
|
||||
!insertmacro MUI_LANGUAGE "Bosnian"
|
||||
!insertmacro MUI_LANGUAGE "Breton"
|
||||
!insertmacro MUI_LANGUAGE "Bulgarian"
|
||||
!insertmacro MUI_LANGUAGE "Croatian"
|
||||
!insertmacro MUI_LANGUAGE "Czech"
|
||||
!insertmacro MUI_LANGUAGE "Danish"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!insertmacro MUI_LANGUAGE "Estonian"
|
||||
!insertmacro MUI_LANGUAGE "Farsi"
|
||||
!insertmacro MUI_LANGUAGE "Finnish"
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
!insertmacro MUI_LANGUAGE "Greek"
|
||||
!insertmacro MUI_LANGUAGE "Hebrew"
|
||||
!insertmacro MUI_LANGUAGE "Hungarian"
|
||||
!insertmacro MUI_LANGUAGE "Icelandic"
|
||||
!insertmacro MUI_LANGUAGE "Indonesian"
|
||||
!insertmacro MUI_LANGUAGE "Irish"
|
||||
!insertmacro MUI_LANGUAGE "Italian"
|
||||
!insertmacro MUI_LANGUAGE "Japanese"
|
||||
!insertmacro MUI_LANGUAGE "Korean"
|
||||
!insertmacro MUI_LANGUAGE "Kurdish"
|
||||
!insertmacro MUI_LANGUAGE "Latvian"
|
||||
!insertmacro MUI_LANGUAGE "Lithuanian"
|
||||
!insertmacro MUI_LANGUAGE "Luxembourgish"
|
||||
!insertmacro MUI_LANGUAGE "Macedonian"
|
||||
!insertmacro MUI_LANGUAGE "Malay"
|
||||
!insertmacro MUI_LANGUAGE "Mongolian"
|
||||
!insertmacro MUI_LANGUAGE "Norwegian"
|
||||
!insertmacro MUI_LANGUAGE "Polish"
|
||||
!insertmacro MUI_LANGUAGE "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
!insertmacro MUI_LANGUAGE "Romanian"
|
||||
!insertmacro MUI_LANGUAGE "Russian"
|
||||
!insertmacro MUI_LANGUAGE "Serbian"
|
||||
!insertmacro MUI_LANGUAGE "SerbianLatin"
|
||||
!insertmacro MUI_LANGUAGE "SimpChinese"
|
||||
!insertmacro MUI_LANGUAGE "Slovak"
|
||||
!insertmacro MUI_LANGUAGE "Slovenian"
|
||||
!insertmacro MUI_LANGUAGE "Spanish"
|
||||
!insertmacro MUI_LANGUAGE "Swedish"
|
||||
!insertmacro MUI_LANGUAGE "Thai"
|
||||
!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
!insertmacro MUI_LANGUAGE "Turkish"
|
||||
!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
!insertmacro MUI_LANGUAGE "Welsh"
|
||||
|
||||
;--------------------------------
|
||||
;Reserve Files
|
||||
|
||||
;These files should be inserted before other files in the data block
|
||||
;Keep these lines before any File command
|
||||
;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
|
||||
|
||||
ReserveFile "NSIS.InstallOptions.ini"
|
||||
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
||||
|
||||
; for UserInfo::GetName and UserInfo::GetAccountType
|
||||
ReserveFile /plugin 'UserInfo.dll'
|
||||
|
||||
;--------------------------------
|
||||
; Installation types
|
||||
@CPACK_NSIS_INSTALLATION_TYPES@
|
||||
|
||||
;--------------------------------
|
||||
; Component sections
|
||||
@CPACK_NSIS_COMPONENT_SECTIONS@
|
||||
|
||||
;--------------------------------
|
||||
;Installer Sections
|
||||
|
||||
Section "-Core installation"
|
||||
;Use the entire tree produced by the INSTALL target. Keep the
|
||||
;list of directories here in sync with the RMDir commands below.
|
||||
SetOutPath "$INSTDIR"
|
||||
@CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@
|
||||
@CPACK_NSIS_FULL_INSTALL@
|
||||
|
||||
;Store installation folder
|
||||
WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
|
||||
|
||||
;Create uninstaller
|
||||
WriteUninstaller "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
|
||||
Push "DisplayName"
|
||||
Push "@CPACK_NSIS_DISPLAY_NAME@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "DisplayVersion"
|
||||
Push "@CPACK_PACKAGE_VERSION@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "Publisher"
|
||||
Push "@CPACK_PACKAGE_VENDOR@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "UninstallString"
|
||||
Push "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "NoRepair"
|
||||
Push "1"
|
||||
Call ConditionalAddToRegisty
|
||||
|
||||
!ifdef CPACK_NSIS_ADD_REMOVE
|
||||
;Create add/remove functionality
|
||||
Push "ModifyPath"
|
||||
Push "$INSTDIR\AddRemove.exe"
|
||||
Call ConditionalAddToRegisty
|
||||
!else
|
||||
Push "NoModify"
|
||||
Push "1"
|
||||
Call ConditionalAddToRegisty
|
||||
!endif
|
||||
|
||||
; Optional registration
|
||||
Push "DisplayIcon"
|
||||
Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "HelpLink"
|
||||
Push "@CPACK_NSIS_HELP_LINK@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "URLInfoAbout"
|
||||
Push "@CPACK_NSIS_URL_INFO_ABOUT@"
|
||||
Call ConditionalAddToRegisty
|
||||
Push "Contact"
|
||||
Push "@CPACK_NSIS_CONTACT@"
|
||||
Call ConditionalAddToRegisty
|
||||
;!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
|
||||
;!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||
|
||||
;Create shortcuts
|
||||
;CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
|
||||
;@CPACK_NSIS_CREATE_ICONS@
|
||||
;@CPACK_NSIS_CREATE_ICONS_EXTRA@
|
||||
;CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
|
||||
|
||||
;Read a value from an InstallOptions INI file
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
|
||||
|
||||
; Write special uninstall registry entries
|
||||
;Push "StartMenu"
|
||||
;Push "$STARTMENU_FOLDER"
|
||||
;Call ConditionalAddToRegisty
|
||||
;Push "DoNotAddToPath"
|
||||
;Push "$DO_NOT_ADD_TO_PATH"
|
||||
;Call ConditionalAddToRegisty
|
||||
;Push "AddToPathAllUsers"
|
||||
;Push "$ADD_TO_PATH_ALL_USERS"
|
||||
;Call ConditionalAddToRegisty
|
||||
;Push "AddToPathCurrentUser"
|
||||
;Push "$ADD_TO_PATH_CURRENT_USER"
|
||||
;Call ConditionalAddToRegisty
|
||||
;Push "InstallToDesktop"
|
||||
;Push "$INSTALL_DESKTOP"
|
||||
;Call ConditionalAddToRegisty
|
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "-Add to path"
|
||||
Push $INSTDIR\bin
|
||||
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
|
||||
StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
|
||||
Call AddToPath
|
||||
doNotAddToPath:
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
; Create custom pages
|
||||
Function InstallOptionsPage
|
||||
!insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
|
||||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
; determine admin versus local install
|
||||
Function un.onInit
|
||||
|
||||
ClearErrors
|
||||
UserInfo::GetName
|
||||
IfErrors noLM
|
||||
Pop $0
|
||||
UserInfo::GetAccountType
|
||||
Pop $1
|
||||
StrCmp $1 "Admin" 0 +3
|
||||
SetShellVarContext all
|
||||
;MessageBox MB_OK 'User "$0" is in the Admin group'
|
||||
Goto done
|
||||
StrCmp $1 "Power" 0 +3
|
||||
SetShellVarContext all
|
||||
;MessageBox MB_OK 'User "$0" is in the Power Users group'
|
||||
Goto done
|
||||
|
||||
noLM:
|
||||
;Get installation folder from registry if available
|
||||
|
||||
done:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
;--- Add/Remove callback functions: ---
|
||||
!macro SectionList MacroName
|
||||
;This macro used to perform operation on multiple sections.
|
||||
;List all of your components in following manner here.
|
||||
@CPACK_NSIS_COMPONENT_SECTION_LIST@
|
||||
!macroend
|
||||
|
||||
Section -FinishComponents
|
||||
;Removes unselected components and writes component status to registry
|
||||
!insertmacro SectionList "FinishSection"
|
||||
|
||||
!ifdef CPACK_NSIS_ADD_REMOVE
|
||||
; Get the name of the installer executable
|
||||
System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
|
||||
StrCpy $R3 $R0
|
||||
|
||||
; Strip off the last 13 characters, to see if we have AddRemove.exe
|
||||
StrLen $R1 $R0
|
||||
IntOp $R1 $R0 - 13
|
||||
StrCpy $R2 $R0 13 $R1
|
||||
StrCmp $R2 "AddRemove.exe" addremove_installed
|
||||
|
||||
; We're not running AddRemove.exe, so install it
|
||||
CopyFiles $R3 $INSTDIR\AddRemove.exe
|
||||
|
||||
addremove_installed:
|
||||
!endif
|
||||
SectionEnd
|
||||
;--- End of Add/Remove callback functions ---
|
||||
|
||||
;--------------------------------
|
||||
; Component dependencies
|
||||
Function .onSelChange
|
||||
!insertmacro SectionList MaybeSelectionChanged
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
;Uninstaller Section
|
||||
|
||||
Section "Uninstall"
|
||||
;ReadRegStr $START_MENU SHCTX \
|
||||
; "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu"
|
||||
;MessageBox MB_OK "Start menu is in: $START_MENU"
|
||||
ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
|
||||
ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
|
||||
ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
|
||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser"
|
||||
;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
|
||||
;ReadRegStr $INSTALL_DESKTOP SHCTX \
|
||||
; "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
|
||||
;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
|
||||
|
||||
@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
|
||||
|
||||
;Remove files we installed.
|
||||
;Keep the list of directories here in sync with the File commands above.
|
||||
@CPACK_NSIS_DELETE_FILES@
|
||||
@CPACK_NSIS_DELETE_DIRECTORIES@
|
||||
|
||||
!ifdef CPACK_NSIS_ADD_REMOVE
|
||||
;Remove the add/remove program
|
||||
Delete "$INSTDIR\AddRemove.exe"
|
||||
!endif
|
||||
|
||||
;Remove the uninstaller itself.
|
||||
Delete "$INSTDIR\@CPACK_NSIS_UNINSTALL_NAME@.exe"
|
||||
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
|
||||
;Remove the installation directory if it is empty.
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
; Remove the registry entries.
|
||||
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
|
||||
; Removes all optional components
|
||||
!insertmacro SectionList "RemoveSection_CPack"
|
||||
|
||||
;!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
|
||||
|
||||
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
||||
@CPACK_NSIS_DELETE_ICONS@
|
||||
@CPACK_NSIS_DELETE_ICONS_EXTRA@
|
||||
|
||||
;Delete empty start menu parent directories
|
||||
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
|
||||
|
||||
; startMenuDeleteLoop:
|
||||
; ClearErrors
|
||||
; RMDir $MUI_TEMP
|
||||
; GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
|
||||
;
|
||||
; IfErrors startMenuDeleteLoopDone
|
||||
;
|
||||
; StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
|
||||
; startMenuDeleteLoopDone:
|
||||
|
||||
; If the user changed the shortcut, then untinstall may not work. This should
|
||||
; try to fix it.
|
||||
;StrCpy $MUI_TEMP "$START_MENU"
|
||||
;Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
||||
@CPACK_NSIS_DELETE_ICONS_EXTRA@
|
||||
|
||||
;Delete empty start menu parent directories
|
||||
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
|
||||
|
||||
; secondStartMenuDeleteLoop:
|
||||
; ClearErrors
|
||||
; RMDir $MUI_TEMP
|
||||
; GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
|
||||
;
|
||||
; IfErrors secondStartMenuDeleteLoopDone
|
||||
;
|
||||
; StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
|
||||
; secondStartMenuDeleteLoopDone:
|
||||
|
||||
DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
|
||||
|
||||
Push $INSTDIR\bin
|
||||
StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
|
||||
Call un.RemoveFromPath
|
||||
doNotRemoveFromPath:
|
||||
SectionEnd
|
||||
|
||||
;--------------------------------
|
||||
; determine admin versus local install
|
||||
; Is install for "AllUsers" or "JustMe"?
|
||||
; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
|
||||
; This function is used for the very first "custom page" of the installer.
|
||||
; This custom page does not show up visibly, but it executes prior to the
|
||||
; first visible page and sets up $INSTDIR properly...
|
||||
; Choose different default installation folder based on SV_ALLUSERS...
|
||||
; "Program Files" for AllUsers, "My Documents" for JustMe...
|
||||
|
||||
Function .onInit
|
||||
StrCmp "@CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL@" "ON" 0 inst
|
||||
|
||||
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "UninstallString"
|
||||
StrCmp $0 "" inst
|
||||
|
||||
MessageBox MB_YESNOCANCEL|MB_ICONEXCLAMATION \
|
||||
"@CPACK_NSIS_PACKAGE_NAME@ is already installed. $\n$\nDo you want to uninstall the old version before installing the new one?" \
|
||||
/SD IDYES IDYES uninst IDNO inst
|
||||
Abort
|
||||
|
||||
;Run the uninstaller
|
||||
uninst:
|
||||
ClearErrors
|
||||
StrLen $2 "\Uninstall.exe"
|
||||
StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path
|
||||
ExecWait '"$0" /S _?=$3' ;Do not copy the uninstaller to a temp file
|
||||
|
||||
IfErrors uninst_failed inst
|
||||
uninst_failed:
|
||||
MessageBox MB_OK|MB_ICONSTOP "Uninstall failed."
|
||||
Abort
|
||||
|
||||
|
||||
inst:
|
||||
; Reads components status for registry
|
||||
!insertmacro SectionList "InitSection"
|
||||
|
||||
; check to see if /D has been used to change
|
||||
; the install directory by comparing it to the
|
||||
; install directory that is expected to be the
|
||||
; default
|
||||
StrCpy $IS_DEFAULT_INSTALLDIR 0
|
||||
StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
|
||||
StrCpy $IS_DEFAULT_INSTALLDIR 1
|
||||
|
||||
StrCpy $SV_ALLUSERS "JustMe"
|
||||
; if default install dir then change the default
|
||||
; if it is installed for JustMe
|
||||
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
|
||||
StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||
|
||||
ClearErrors
|
||||
UserInfo::GetName
|
||||
IfErrors noLM
|
||||
Pop $0
|
||||
UserInfo::GetAccountType
|
||||
Pop $1
|
||||
StrCmp $1 "Admin" 0 +4
|
||||
SetShellVarContext all
|
||||
;MessageBox MB_OK 'User "$0" is in the Admin group'
|
||||
StrCpy $SV_ALLUSERS "AllUsers"
|
||||
Goto done
|
||||
StrCmp $1 "Power" 0 +4
|
||||
SetShellVarContext all
|
||||
;MessageBox MB_OK 'User "$0" is in the Power Users group'
|
||||
StrCpy $SV_ALLUSERS "AllUsers"
|
||||
Goto done
|
||||
|
||||
noLM:
|
||||
StrCpy $SV_ALLUSERS "AllUsers"
|
||||
;Get installation folder from registry if available
|
||||
|
||||
done:
|
||||
StrCmp $SV_ALLUSERS "AllUsers" 0 +3
|
||||
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
|
||||
StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
|
||||
|
||||
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
|
||||
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
|
||||
|
||||
noOptionsPage:
|
||||
FunctionEnd
|
||||
@@ -0,0 +1,209 @@
|
||||
# Copyright 2020 Andreas Atteneder
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#
|
||||
# Retrieving the current version from GIT tags
|
||||
#
|
||||
|
||||
include(GetGitRevisionDescription)
|
||||
|
||||
function(git_update_index)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
update-index -q --refresh
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
)
|
||||
if(NOT res EQUAL 0)
|
||||
message(SEND_ERROR "git update-index not successful")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(git_describe_raw _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
if(NOT GIT_FOUND)
|
||||
set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
describe
|
||||
${ARGN}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
#ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT res EQUAL 0)
|
||||
set(out "exitcode-${res}-NOTFOUND")
|
||||
endif()
|
||||
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_rev_list target_path _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}"
|
||||
rev-list -1 HEAD ${target_path}
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
OUTPUT_VARIABLE
|
||||
out
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(NOT res EQUAL 0)
|
||||
message(SEND_ERROR "git update-index not successful")
|
||||
endif()
|
||||
set(${_var} "${out}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(git_dirty _var)
|
||||
if(NOT GIT_FOUND)
|
||||
find_package(Git QUIET)
|
||||
endif()
|
||||
execute_process(COMMAND
|
||||
diff-index --name-only HEAD --
|
||||
WORKING_DIRECTORY
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
RESULT_VARIABLE
|
||||
res
|
||||
)
|
||||
set(${_var} "${res}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
function(generate_version _var )
|
||||
if(${ARGC} GREATER 1)
|
||||
set(target_path ${ARGN})
|
||||
git_rev_list(${target_path} KTX_REV)
|
||||
git_describe_raw(KTX_VERSION --contains --match v[0-9]* ${KTX_REV})
|
||||
if(NOT KTX_VERSION)
|
||||
git_describe_raw(KTX_VERSION "--match" "v[0-9]*" ${KTX_REV})
|
||||
endif()
|
||||
else()
|
||||
git_describe_raw(KTX_VERSION "--match" "v[0-9]*" "HEAD" )
|
||||
endif()
|
||||
|
||||
git_update_index()
|
||||
git_dirty(GIT_DIRTY)
|
||||
if(GIT_DIRTY)
|
||||
set(KTX_VERSION ${KTX_VERSION}-dirty)
|
||||
endif()
|
||||
set(${_var} "${KTX_VERSION}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Get latest tag from git if not passed to cmake
|
||||
# This property can be passed to cmake when building from tar.gz
|
||||
if(NOT KTX_GIT_VERSION_FULL)
|
||||
git_describe_raw(KTX_GIT_VERSION_FULL --abbrev=0 --match v[0-9]*)
|
||||
endif()
|
||||
#message("KTX git full version: ${KTX_GIT_VERSION_FULL}")
|
||||
|
||||
# generate_version(TOKTX_VERSION tools/toktx)
|
||||
# message("TOKTX_VERSION: ${TOKTX_VERSION}")
|
||||
|
||||
# First try a full regex ( vMAJOR.MINOR.PATCH-TWEAK )
|
||||
string(REGEX MATCH "^v([0-9]*)\.([0-9]*)\.([0-9]*)(-[^\.]*)"
|
||||
KTX_VERSION ${KTX_GIT_VERSION_FULL})
|
||||
|
||||
if(KTX_VERSION)
|
||||
set(KTX_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
set(KTX_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
set(KTX_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
set(KTX_VERSION_TWEAK ${CMAKE_MATCH_4})
|
||||
else()
|
||||
# If full regex failed, go for vMAJOR.MINOR.PATCH
|
||||
string(REGEX MATCH "^v([0-9]*)\.([0-9]*)\.([^\.]*)"
|
||||
KTX_VERSION ${KTX_GIT_VERSION_FULL})
|
||||
|
||||
if(KTX_VERSION)
|
||||
set(KTX_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
set(KTX_VERSION_MINOR ${CMAKE_MATCH_2})
|
||||
set(KTX_VERSION_PATCH ${CMAKE_MATCH_3})
|
||||
|
||||
string(REGEX MATCH "^[0-9]*$"
|
||||
KTX_VERSION_PATCH_INT ${KTX_VERSION_PATCH})
|
||||
|
||||
if(KTX_VERSION_PATCH_INT)
|
||||
set(KTX_VERSION_TWEAK "")
|
||||
else()
|
||||
if(KTX_VERSION_PATCH)
|
||||
set(KTX_VERSION_TWEAK "-${KTX_VERSION_PATCH}")
|
||||
else()
|
||||
set(KTX_VERSION_TWEAK "")
|
||||
endif()
|
||||
set(KTX_VERSION_PATCH "0")
|
||||
endif()
|
||||
else()
|
||||
message(WARNING "Error retrieving version from GIT tag. Falling back to 0.0.0-noversion ")
|
||||
set(KTX_VERSION_MAJOR "0" )
|
||||
set(KTX_VERSION_MINOR "0" )
|
||||
set(KTX_VERSION_PATCH "0" )
|
||||
set(KTX_VERSION_TWEAK "-noversion" )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(KTX_VERSION ${KTX_VERSION_MAJOR}.${KTX_VERSION_MINOR}.${KTX_VERSION_PATCH})
|
||||
set(KTX_VERSION_FULL ${KTX_VERSION}${KTX_VERSION_TWEAK})
|
||||
|
||||
#message("KTX version: ${KTX_VERSION} major:${KTX_VERSION_MAJOR} minor:${KTX_VERSION_MINOR} patch:${KTX_VERSION_PATCH} tweak:${KTX_VERSION_TWEAK}")
|
||||
|
||||
|
||||
#
|
||||
# Create a version.h header file using the mkversion shell script.
|
||||
# Dignum memoria (worth remembering): you need to run CMake config
|
||||
# after adding a new tag or making a software change in order for the
|
||||
# version to be updated.
|
||||
#
|
||||
|
||||
function( create_version_header dest_path target )
|
||||
|
||||
set( version_h_output ${PROJECT_SOURCE_DIR}/${dest_path}/version.h)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
add_custom_command(
|
||||
OUTPUT ${version_h_output}
|
||||
# On Windows this command has to be invoked by a shell in order to work
|
||||
COMMAND ${BASH_EXECUTABLE} -c "\"scripts/mkversion\" \"-v\" \"${KTX_GIT_VERSION_FULL}\" \"-o\" \"version.h\" \"${dest_path}\""
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generate ${version_h_output}"
|
||||
VERBATIM
|
||||
)
|
||||
else()
|
||||
add_custom_command(
|
||||
OUTPUT ${version_h_output}
|
||||
COMMAND scripts/mkversion -v ${KTX_GIT_VERSION_FULL} -o version.h ${dest_path}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Generate ${version_h_output}"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
||||
set( version_target ${target}_version )
|
||||
add_custom_target( ${version_target} DEPENDS ${version_h_output} )
|
||||
add_dependencies( ${target} ${version_target} )
|
||||
target_sources( ${target} PRIVATE ${version_h_output} )
|
||||
|
||||
endfunction()
|
||||
|
||||
function( create_version_file )
|
||||
file(WRITE ${PROJECT_BINARY_DIR}/ktx.version "${KTX_VERSION_FULL}")
|
||||
endfunction()
|
||||
|
||||
# vim:ai:ts=4:sts=4:sw=2:expandtab:textwidth=70
|
||||
@@ -0,0 +1,150 @@
|
||||
// Copyright 2018-2020 The Khronos Group Inc.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <ktxvulkan.h>
|
||||
// Use c++ to keep the example short. Not required.
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
class Texture {
|
||||
public:
|
||||
Texture(const std::string ktxfile);
|
||||
~Texture();
|
||||
|
||||
protected:
|
||||
ktxVulkanTexture texture;
|
||||
vk::PhysicalDevice gpu;
|
||||
vk::Device device;
|
||||
vk::Queue queue;
|
||||
vk::CommandPool commandPool;
|
||||
|
||||
cleanup();
|
||||
prepareSamplerAndView();
|
||||
};
|
||||
|
||||
Texture::Texture(const std::string ktxfile)
|
||||
{
|
||||
ktxVulkanDeviceInfo kvdi;
|
||||
ktxTexture* kTexture;
|
||||
KTX_error_code ktxresult;
|
||||
|
||||
createVulkanInstance();
|
||||
findVulkanGpu(); // Find a suitable physical device
|
||||
createVulkanSurface();
|
||||
createVulkanDevice();
|
||||
prepareVulkanSwapchain();
|
||||
/*
|
||||
.
|
||||
.
|
||||
.
|
||||
*/
|
||||
|
||||
// This structure is used to pass the Vulkan device information to the loader
|
||||
// with the expectation that app's will typically load many textures.
|
||||
ktxVulkanDeviceInfo_Construct(&kvdi, gpu, device, queue, commandPool, nullptr);
|
||||
|
||||
ktxresult = ktxTexture_CreateFromNamedFile(
|
||||
(getAssetPath() + ktxfile).c_str(),
|
||||
KTX_TEXTURE_CREATE_NO_FLAGS,
|
||||
&kTexture);
|
||||
if (KTX_SUCCESS != ktxresult) {
|
||||
std::stringstream message;
|
||||
|
||||
message << "Creation of ktxTexture from \"" << getAssetPath()
|
||||
<< ktxfile << "\" failed: " << ktxErrorString(ktxresult);
|
||||
throw std::runtime_error(message.str());
|
||||
}
|
||||
ktxresult = ktxTexture_VkUploadEx(kTexture, &kvdi, &texture,
|
||||
VK_IMAGE_TILING_OPTIMAL,
|
||||
VK_IMAGE_USAGE_SAMPLED_BIT,
|
||||
VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
|
||||
if (KTX_SUCCESS != ktxresult) {
|
||||
std::stringstream message;
|
||||
|
||||
message << "ktxTexture_VkUpload failed: " << ktxErrorString(ktxresult);
|
||||
throw std::runtime_error(message.str());
|
||||
}
|
||||
|
||||
char* pValue;
|
||||
uint32_t valueLen;
|
||||
if (KTX_SUCCESS == ktxHashTable_FindValue(&kTexture->kvDataHead,
|
||||
KTX_ORIENTATION_KEY,
|
||||
&valueLen, (void**)&pValue))
|
||||
{
|
||||
char s, t;
|
||||
|
||||
if (sscanf(pValue, KTX_ORIENTATION2_FMT, &s, &t) == 2) {
|
||||
if (s == 'l') sign_s = -1;
|
||||
if (t == 'u') sign_t = -1;
|
||||
}
|
||||
}
|
||||
|
||||
ktxTexture_Destroy(kTexture);
|
||||
ktxVulkanDeviceInfo_destruct(&kvdi);
|
||||
|
||||
try {
|
||||
prepareSamplerAndView(); // See below for implementation.
|
||||
// Setup a layout with, e.g., a binding for a combined image-sampler.
|
||||
setupDescriptorSetLayout();
|
||||
// Create a descriptor set and update it with the sampler and image view handles.
|
||||
setupDescriptorSet();
|
||||
preparePipelines();
|
||||
setupDescriptorPool();
|
||||
setupDescriptorSet();
|
||||
buildCommandBuffers();
|
||||
} catch (std::exception&) {
|
||||
cleanup();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
Texture::~Texture()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
Texture::cleanup()
|
||||
{
|
||||
destroyCommandBuffers();
|
||||
destroySampler();
|
||||
destroyImageview();
|
||||
ktxVulkanTexture_destruct(&texture, device, nullptr);
|
||||
/*
|
||||
.
|
||||
.
|
||||
.
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
Texture::prepareSamplerAndView()
|
||||
{
|
||||
// Create sampler.
|
||||
vk::SamplerCreateInfo samplerInfo;
|
||||
// Set the non-default values
|
||||
samplerInfo.magFilter = vk::Filter::eLinear;
|
||||
samplerInfo.minFilter = vk::Filter::eLinear;
|
||||
samplerInfo.mipmapMode = vk::SamplerMipmapMode::eLinear;
|
||||
samplerInfo.maxLod = texture.levelCount;
|
||||
samplerInfo.anisotropyEnable = false;
|
||||
samplerInfo.maxAnisotropy = 1.0;
|
||||
samplerInfo.borderColor = vk::BorderColor::eFloatOpaqueWhite;
|
||||
sampler = vkctx.device.createSampler(samplerInfo);
|
||||
|
||||
// Create image view.
|
||||
// Textures are not directly accessed by the shaders and are abstracted
|
||||
// by image views containing additional information and sub resource
|
||||
// ranges.
|
||||
vk::ImageViewCreateInfo viewInfo;
|
||||
// Set the non-default values.
|
||||
viewInfo.image = texture.image;
|
||||
viewInfo.format = static_cast<vk::Format>(texture.imageFormat);
|
||||
viewInfo.viewType = static_cast<vk::ImageViewType>(texture.viewType);
|
||||
viewInfo.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
|
||||
viewInfo.subresourceRange.layerCount = texture.layerCount;
|
||||
viewInfo.subresourceRange.levelCount = texture.levelCount;
|
||||
imageView = vkctx.device.createImageView(viewInfo);
|
||||
}
|
||||
|
||||
/* -*- tab-width: 4; -*- */
|
||||
/* vi: set sw=2 ts=4 expandtab: */
|
||||
@@ -0,0 +1,7 @@
|
||||
# Copyright 2024 The Khronos Group Inc.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
---
|
||||
# Disable clang-format in this directory
|
||||
DisableFormat: true
|
||||
SortIncludes: false
|
||||
...
|
||||
@@ -0,0 +1,12 @@
|
||||
<!-- Copyright 2025 Mark Callow -->
|
||||
<!-- SPDX-License-Identifier: Apache-2.0 -->
|
||||
|
||||
SDL_gesture.h
|
||||
-------------
|
||||
|
||||
The Gesture API was removed from SDL3. As a migration path they provided an equivalent single-header library `SDL_gesture.h` that can be dropped into an SDL3-based project.
|
||||
|
||||
They do not make formal releases of this code; they say "just grab the latest and drop it into your project!"
|
||||
|
||||
The origin of this file is fork https://github.com/MarkCallow/SDL_gesture.git whose upstream is
|
||||
https://github.com/libsdl-org/SDL_gesture. It includes modifications for robustness to prevent production of spurious GESTURE\_MULTIGESTURE events.
|
||||
@@ -0,0 +1,966 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* Touch gestures were removed from SDL3, so this is the SDL2 implementation copied in here, and tweaked a little. */
|
||||
|
||||
#ifndef INCL_SDL_GESTURE_H
|
||||
#define INCL_SDL_GESTURE_H
|
||||
|
||||
#if !defined(SDL_MAJOR_VERSION)
|
||||
#error Please include SDL.h before including this header.
|
||||
#elif SDL_MAJOR_VERSION < 2
|
||||
#error This header requires SDL2 or later.
|
||||
#elif SDL_MAJOR_VERSION == 2
|
||||
/* building against SDL2? Just use the built-in SDL2 implementation. */
|
||||
#define Gesture_Init() (0)
|
||||
#define Gesture_Quit()
|
||||
#define Gesture_ID SDL_GestureID
|
||||
#define Gesture_LoadDollarTemplates SDL_LoadDollarTemplates
|
||||
#define Gesture_RecordGesture SDL_RecordGesture
|
||||
#define Gesture_SaveAllDollarTemplates SDL_SaveAllDollarTemplates
|
||||
#define Gesture_SaveDollarTemplate SDL_SaveDollarTemplate
|
||||
#define GESTURE_DOLLARGESTURE SDL_DOLLARGESTURE
|
||||
#define GESTURE_DOLLARRECORD SDL_DOLLARRECORD
|
||||
#define GESTURE_MULTIGESTURE SDL_MULTIGESTURE
|
||||
#define Gesture_MultiGestureEvent SDL_MultiGestureEvent
|
||||
#define Gesture_DollarGestureEvent SDL_DollarGestureEvent
|
||||
#else
|
||||
|
||||
#include <cmath>
|
||||
|
||||
/* Set up for C function definitions, even when using C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef Sint64 Gesture_ID;
|
||||
|
||||
/* events... */
|
||||
|
||||
/* generally you shouldn't hardcode event type numbers--and doubly so in
|
||||
the reserved range!--but these match SDL2 and SDL3 promises to preserve
|
||||
these values to help sdl2-compat. */
|
||||
#define GESTURE_DOLLARGESTURE 0x800
|
||||
#define GESTURE_DOLLARRECORD 0x801
|
||||
#define GESTURE_MULTIGESTURE 0x802
|
||||
|
||||
typedef struct Gesture_MultiGestureEvent
|
||||
{
|
||||
Uint32 type;
|
||||
Uint32 reserved;
|
||||
Uint64 timestamp;
|
||||
SDL_TouchID touchID;
|
||||
float dTheta;
|
||||
float dDist;
|
||||
float x;
|
||||
float y;
|
||||
Uint16 numFingers;
|
||||
Uint16 padding;
|
||||
} Gesture_MultiGestureEvent;
|
||||
|
||||
typedef struct Gesture_DollarGestureEvent
|
||||
{
|
||||
Uint32 type;
|
||||
Uint32 reserved;
|
||||
Uint64 timestamp;
|
||||
SDL_TouchID touchID;
|
||||
Gesture_ID gestureId;
|
||||
Uint32 numFingers;
|
||||
float error;
|
||||
float x;
|
||||
float y;
|
||||
} Gesture_DollarGestureEvent;
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
* Call this once, AFTER SDL_Init, to set up the Gesture API.
|
||||
*
|
||||
* \returns 0 on success, -1 on error. Call SDL_GetError() for specifics.
|
||||
*/
|
||||
extern int SDLCALL Gesture_Init(void);
|
||||
|
||||
/**
|
||||
* Call this once, BEFORE SDL_Quit, to clean up the Gesture API.
|
||||
*/
|
||||
extern void SDLCALL Gesture_Quit(void);
|
||||
|
||||
/**
|
||||
* Begin recording a gesture on a specified touch device or all touch devices.
|
||||
*
|
||||
* If the parameter `touchID` is -1 (i.e., all devices), this function will
|
||||
* always return 1, regardless of whether there actually are any devices.
|
||||
*
|
||||
* \param touchID the touch device id, or -1 for all touch devices
|
||||
* \returns 1 on success or 0 if the specified device could not be found.
|
||||
*/
|
||||
extern int SDLCALL Gesture_RecordGesture(SDL_TouchID touchID);
|
||||
|
||||
/**
|
||||
* Save all currently loaded Dollar Gesture templates.
|
||||
*
|
||||
* \param dst a SDL_IOStream to save to
|
||||
* \returns the number of saved templates on success or 0 on failure; call
|
||||
* SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa Gesture_LoadDollarTemplates
|
||||
* \sa Gesture_SaveDollarTemplate
|
||||
*/
|
||||
extern int SDLCALL Gesture_SaveAllDollarTemplates(SDL_IOStream *dst);
|
||||
|
||||
/**
|
||||
* Save a currently loaded Dollar Gesture template.
|
||||
*
|
||||
* \param gestureId a gesture id
|
||||
* \param dst a SDL_IOStream to save to
|
||||
* \returns 1 on success or 0 on failure; call SDL_GetError() for more
|
||||
* information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_LoadDollarTemplates
|
||||
* \sa SDL_SaveAllDollarTemplates
|
||||
*/
|
||||
extern int SDLCALL Gesture_SaveDollarTemplate(Gesture_ID gestureId, SDL_IOStream *dst);
|
||||
|
||||
/**
|
||||
* Load Dollar Gesture templates from a file.
|
||||
*
|
||||
* \param touchID a touch id
|
||||
* \param src a SDL_IOStream to load from
|
||||
* \returns the number of loaded templates on success or a negative error code
|
||||
* (or 0) on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 2.0.0.
|
||||
*
|
||||
* \sa SDL_SaveAllDollarTemplates
|
||||
* \sa SDL_SaveDollarTemplate
|
||||
*/
|
||||
extern int SDLCALL Gesture_LoadDollarTemplates(SDL_TouchID touchID, SDL_IOStream *src);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_GESTURE_IMPLEMENTATION)
|
||||
|
||||
#define GESTURE_MAX_DOLLAR_PATH_SIZE 1024
|
||||
#define GESTURE_DOLLARNPOINTS 64
|
||||
#define GESTURE_DOLLARSIZE 256
|
||||
#define GESTURE_PHI 0.618033989
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float length;
|
||||
int numPoints;
|
||||
SDL_FPoint p[GESTURE_MAX_DOLLAR_PATH_SIZE];
|
||||
} GestureDollarPath;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_FPoint path[GESTURE_DOLLARNPOINTS];
|
||||
Sint64 hash;
|
||||
} GestureDollarTemplate;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SDL_TouchID touchID;
|
||||
SDL_FPoint centroid;
|
||||
GestureDollarPath dollarPath;
|
||||
int numDownFingers;
|
||||
int numDollarTemplates;
|
||||
GestureDollarTemplate *dollarTemplate;
|
||||
bool recording;
|
||||
} GestureTouch;
|
||||
|
||||
static GestureTouch *GestureTouches = NULL;
|
||||
static int GestureNumTouches = 0;
|
||||
static bool GestureRecordAll = false;
|
||||
|
||||
static void GestureProcessEvent(const SDL_Event *event);
|
||||
|
||||
static bool SDLCALL GestureEventWatch(void *, SDL_Event *event)
|
||||
{
|
||||
GestureProcessEvent(event);
|
||||
return true;
|
||||
}
|
||||
|
||||
int Gesture_Init(void)
|
||||
{
|
||||
Gesture_Quit();
|
||||
SDL_AddEventWatch(GestureEventWatch, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static GestureTouch *GestureAddTouch(const SDL_TouchID touchID)
|
||||
{
|
||||
GestureTouch *gestureTouch = (GestureTouch *)SDL_realloc(GestureTouches, (GestureNumTouches + 1) * sizeof(GestureTouch));
|
||||
if (gestureTouch == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GestureTouches = gestureTouch;
|
||||
SDL_zero(GestureTouches[GestureNumTouches]);
|
||||
GestureTouches[GestureNumTouches].touchID = touchID;
|
||||
return &GestureTouches[GestureNumTouches++];
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int GestureDelTouch(const SDL_TouchID touchID)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
if (GestureTouches[i].touchID == touchID) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == GestureNumTouches) {
|
||||
/* not found */
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_free(GestureTouches[i].dollarTemplate);
|
||||
SDL_zero(GestureTouches[i]);
|
||||
|
||||
GestureNumTouches--;
|
||||
if (i != GestureNumTouches) {
|
||||
SDL_copyp(&GestureTouches[i], &GestureTouches[GestureNumTouches]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static GestureTouch *GestureGetTouch(const SDL_TouchID touchID)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
/* printf("%i ?= %i\n",GestureTouches[i].touchID,touchID); */
|
||||
if (GestureTouches[i].touchID == touchID) {
|
||||
return &GestureTouches[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int Gesture_RecordGesture(SDL_TouchID touchID)
|
||||
{
|
||||
SDL_TouchID *devices;
|
||||
int i;
|
||||
|
||||
devices = SDL_GetTouchDevices(NULL);
|
||||
if (devices) {
|
||||
/* make sure we know about all the devices SDL3 knows about, since we aren't connected as tightly as we were in SDL2. */
|
||||
for (i = 0; devices[i]; i++) {
|
||||
if (!GestureGetTouch(devices[i])) {
|
||||
GestureAddTouch(devices[i]);
|
||||
}
|
||||
}
|
||||
SDL_free(devices);
|
||||
}
|
||||
|
||||
if (touchID != 0) {
|
||||
GestureRecordAll = true; /* !!! FIXME: this is never set back to false anywhere, that's probably a bug. */
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
GestureTouches[i].recording = true;
|
||||
}
|
||||
} else {
|
||||
GestureTouch *touch = GestureGetTouch(touchID);
|
||||
if (!touch) {
|
||||
return 0; /* bogus touchid */
|
||||
}
|
||||
touch->recording = true;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Gesture_Quit(void)
|
||||
{
|
||||
SDL_RemoveEventWatch(GestureEventWatch, NULL);
|
||||
SDL_free(GestureTouches);
|
||||
GestureTouches = NULL;
|
||||
GestureNumTouches = 0;
|
||||
GestureRecordAll = false;
|
||||
}
|
||||
|
||||
static unsigned long GestureHashDollar(SDL_FPoint *points)
|
||||
{
|
||||
unsigned long hash = 5381;
|
||||
int i;
|
||||
for (i = 0; i < GESTURE_DOLLARNPOINTS; i++) {
|
||||
hash = ((hash << 5) + hash) + (unsigned long)points[i].x;
|
||||
hash = ((hash << 5) + hash) + (unsigned long)points[i].y;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
static int GestureSaveTemplate(GestureDollarTemplate *templ, SDL_IOStream *dst)
|
||||
{
|
||||
const size_t bytes = sizeof(templ->path[0]) * GESTURE_DOLLARNPOINTS;
|
||||
|
||||
if (dst == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* No Longer storing the Hash, rehash on load */
|
||||
/* if (SDL_IOWrite(dst, &(templ->hash), sizeof(templ->hash)) != sizeof(templ->hash)) return 0; */
|
||||
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
if (SDL_WriteIO(dst, templ->path, bytes) != bytes) {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
{
|
||||
GestureDollarTemplate copy = *templ;
|
||||
SDL_FPoint *p = copy.path;
|
||||
int i;
|
||||
for (i = 0; i < GESTURE_DOLLARNPOINTS; i++, p++) {
|
||||
p->x = SDL_SwapFloatLE(p->x);
|
||||
p->y = SDL_SwapFloatLE(p->y);
|
||||
}
|
||||
|
||||
if (SDL_WriteIO(dst, copy.path, bytes) != bytes) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_DECLSPEC int SDLCALL
|
||||
Gesture_SaveAllDollarTemplates(SDL_IOStream *dst)
|
||||
{
|
||||
int i, j, rtrn = 0;
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
GestureTouch *touch = &GestureTouches[i];
|
||||
for (j = 0; j < touch->numDollarTemplates; j++) {
|
||||
rtrn += GestureSaveTemplate(&touch->dollarTemplate[j], dst);
|
||||
}
|
||||
}
|
||||
return rtrn;
|
||||
}
|
||||
|
||||
SDL_DECLSPEC int SDLCALL
|
||||
Gesture_SaveDollarTemplate(Gesture_ID gestureId, SDL_IOStream *dst)
|
||||
{
|
||||
int i, j;
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
GestureTouch *touch = &GestureTouches[i];
|
||||
for (j = 0; j < touch->numDollarTemplates; j++) {
|
||||
if (touch->dollarTemplate[j].hash == gestureId) {
|
||||
return GestureSaveTemplate(&touch->dollarTemplate[j], dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
return SDL_SetError("Unknown gestureId");
|
||||
}
|
||||
|
||||
/* path is an already sampled set of points
|
||||
Returns the index of the gesture on success, or -1 */
|
||||
static int GestureAddDollar_one(GestureTouch *inTouch, SDL_FPoint *path)
|
||||
{
|
||||
GestureDollarTemplate *dollarTemplate;
|
||||
GestureDollarTemplate *templ;
|
||||
int index;
|
||||
|
||||
index = inTouch->numDollarTemplates;
|
||||
dollarTemplate = (GestureDollarTemplate *)SDL_realloc(inTouch->dollarTemplate, (index + 1) * sizeof(GestureDollarTemplate));
|
||||
if (dollarTemplate == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
inTouch->dollarTemplate = dollarTemplate;
|
||||
|
||||
templ = &inTouch->dollarTemplate[index];
|
||||
SDL_memcpy(templ->path, path, GESTURE_DOLLARNPOINTS * sizeof(SDL_FPoint));
|
||||
templ->hash = GestureHashDollar(templ->path);
|
||||
inTouch->numDollarTemplates++;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
static int GestureAddDollar(GestureTouch *inTouch, SDL_FPoint *path)
|
||||
{
|
||||
int index = -1;
|
||||
int i = 0;
|
||||
if (inTouch == NULL) {
|
||||
if (GestureNumTouches == 0) {
|
||||
return SDL_SetError("no gesture touch devices registered");
|
||||
}
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
inTouch = &GestureTouches[i];
|
||||
index = GestureAddDollar_one(inTouch, path);
|
||||
if (index < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/* Use the index of the last one added. */
|
||||
return index;
|
||||
}
|
||||
return GestureAddDollar_one(inTouch, path);
|
||||
}
|
||||
|
||||
SDL_DECLSPEC int SDLCALL
|
||||
Gesture_LoadDollarTemplates(SDL_TouchID touchID, SDL_IOStream *src)
|
||||
{
|
||||
int i, loaded = 0;
|
||||
GestureTouch *touch = NULL;
|
||||
if (src == NULL) {
|
||||
return 0;
|
||||
}
|
||||
/* In SDL2 this test was `touchID >= 0` leading to warnings from gcc
|
||||
because SDL_TouchId is now Uint64. In SDL2 it was Sint64. The
|
||||
documentation does not say what < 0 means here but the only defined
|
||||
negative touchID was SDL_MOUSE_TOUCHID (-1). In SDL3 SDL_PEN_TOUCHID (-2)
|
||||
has been added hence this test. Given the lack of documentation
|
||||
it is impossible to say if this updated test is correct. */
|
||||
if (touchID < SDL_PEN_TOUCHID) {
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
if (GestureTouches[i].touchID == touchID) {
|
||||
touch = &GestureTouches[i];
|
||||
}
|
||||
}
|
||||
if (touch == NULL) {
|
||||
return SDL_SetError("given touch id not found");
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
GestureDollarTemplate templ;
|
||||
const size_t bytes = sizeof(templ.path[0]) * GESTURE_DOLLARNPOINTS;
|
||||
|
||||
if (SDL_ReadIO(src, templ.path, bytes) < bytes) {
|
||||
if (loaded == 0) {
|
||||
return SDL_SetError("could not read any dollar gesture from rwops");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if SDL_BYTEORDER != SDL_LIL_ENDIAN
|
||||
for (i = 0; i < GESTURE_DOLLARNPOINTS; i++) {
|
||||
SDL_FPoint *p = &templ.path[i];
|
||||
p->x = SDL_SwapFloatLE(p->x);
|
||||
p->y = SDL_SwapFloatLE(p->y);
|
||||
}
|
||||
#endif
|
||||
|
||||
// See comment at line 436.
|
||||
if (touchID < SDL_PEN_TOUCHID) {
|
||||
/* printf("Adding loaded gesture to 1 touch\n"); */
|
||||
if (GestureAddDollar(touch, templ.path) >= 0) {
|
||||
loaded++;
|
||||
}
|
||||
} else {
|
||||
/* printf("Adding to: %i touches\n",GestureNumTouches); */
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
touch = &GestureTouches[i];
|
||||
/* printf("Adding loaded gesture to + touches\n"); */
|
||||
/* TODO: What if this fails? */
|
||||
GestureAddDollar(touch, templ.path);
|
||||
}
|
||||
loaded++;
|
||||
}
|
||||
}
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
static float GestureDollarDifference(SDL_FPoint *points, SDL_FPoint *templ, float ang)
|
||||
{
|
||||
/* SDL_FPoint p[GESTURE_DOLLARNPOINTS]; */
|
||||
float dist = 0;
|
||||
SDL_FPoint p;
|
||||
int i;
|
||||
for (i = 0; i < GESTURE_DOLLARNPOINTS; i++) {
|
||||
p.x = points[i].x * SDL_cosf(ang) - points[i].y * SDL_sinf(ang);
|
||||
p.y = points[i].x * SDL_sinf(ang) + points[i].y * SDL_cosf(ang);
|
||||
dist += SDL_sqrtf((p.x - templ[i].x) * (p.x - templ[i].x) + (p.y - templ[i].y) * (p.y - templ[i].y));
|
||||
}
|
||||
return dist / GESTURE_DOLLARNPOINTS;
|
||||
}
|
||||
|
||||
static float GestureBestDollarDifference(SDL_FPoint *points, SDL_FPoint *templ)
|
||||
{
|
||||
/*------------BEGIN DOLLAR BLACKBOX------------------
|
||||
-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-
|
||||
-"http://depts.washington.edu/aimgroup/proj/dollar/"
|
||||
*/
|
||||
double ta = -SDL_PI_D / 4;
|
||||
double tb = SDL_PI_D / 4;
|
||||
double dt = SDL_PI_D / 90;
|
||||
float x1 = (float)(GESTURE_PHI * ta + (1 - GESTURE_PHI) * tb);
|
||||
float f1 = GestureDollarDifference(points, templ, x1);
|
||||
float x2 = (float)((1 - GESTURE_PHI) * ta + GESTURE_PHI * tb);
|
||||
float f2 = GestureDollarDifference(points, templ, x2);
|
||||
while (SDL_fabs(ta - tb) > dt) {
|
||||
if (f1 < f2) {
|
||||
tb = x2;
|
||||
x2 = x1;
|
||||
f2 = f1;
|
||||
x1 = (float)(GESTURE_PHI * ta + (1 - GESTURE_PHI) * tb);
|
||||
f1 = GestureDollarDifference(points, templ, x1);
|
||||
} else {
|
||||
ta = x1;
|
||||
x1 = x2;
|
||||
f1 = f2;
|
||||
x2 = (float)((1 - GESTURE_PHI) * ta + GESTURE_PHI * tb);
|
||||
f2 = GestureDollarDifference(points, templ, x2);
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (f1 <= f2)
|
||||
printf("Min angle (x1): %f\n",x1);
|
||||
else if (f1 > f2)
|
||||
printf("Min angle (x2): %f\n",x2);
|
||||
*/
|
||||
return SDL_min(f1, f2);
|
||||
}
|
||||
|
||||
/* `path` contains raw points, plus (possibly) the calculated length */
|
||||
static int GestureDollarNormalize(const GestureDollarPath *path, SDL_FPoint *points, bool is_recording)
|
||||
{
|
||||
int i;
|
||||
float interval;
|
||||
float dist;
|
||||
int numPoints = 0;
|
||||
SDL_FPoint centroid;
|
||||
float xmin, xmax, ymin, ymax;
|
||||
float ang;
|
||||
float w, h;
|
||||
float length = path->length;
|
||||
|
||||
/* Calculate length if it hasn't already been done */
|
||||
if (length <= 0) {
|
||||
for (i = 1; i < path->numPoints; i++) {
|
||||
const float dx = path->p[i].x - path->p[i - 1].x;
|
||||
const float dy = path->p[i].y - path->p[i - 1].y;
|
||||
length += SDL_sqrtf(dx * dx + dy * dy);
|
||||
}
|
||||
}
|
||||
|
||||
/* Resample */
|
||||
interval = length / (GESTURE_DOLLARNPOINTS - 1);
|
||||
dist = interval;
|
||||
|
||||
centroid.x = 0;
|
||||
centroid.y = 0;
|
||||
|
||||
/* printf("(%f,%f)\n",path->p[path->numPoints-1].x,path->p[path->numPoints-1].y); */
|
||||
for (i = 1; i < path->numPoints; i++) {
|
||||
const float d = SDL_sqrtf((path->p[i - 1].x - path->p[i].x) * (path->p[i - 1].x - path->p[i].x) + (path->p[i - 1].y - path->p[i].y) * (path->p[i - 1].y - path->p[i].y));
|
||||
/* printf("d = %f dist = %f/%f\n",d,dist,interval); */
|
||||
while (dist + d > interval) {
|
||||
points[numPoints].x = path->p[i - 1].x +
|
||||
((interval - dist) / d) * (path->p[i].x - path->p[i - 1].x);
|
||||
points[numPoints].y = path->p[i - 1].y +
|
||||
((interval - dist) / d) * (path->p[i].y - path->p[i - 1].y);
|
||||
centroid.x += points[numPoints].x;
|
||||
centroid.y += points[numPoints].y;
|
||||
numPoints++;
|
||||
|
||||
dist -= interval;
|
||||
}
|
||||
dist += d;
|
||||
}
|
||||
if (numPoints < GESTURE_DOLLARNPOINTS - 1) {
|
||||
if (is_recording) {
|
||||
SDL_SetError("ERROR: NumPoints = %i", numPoints);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* copy the last point */
|
||||
points[GESTURE_DOLLARNPOINTS - 1] = path->p[path->numPoints - 1];
|
||||
numPoints = GESTURE_DOLLARNPOINTS;
|
||||
|
||||
centroid.x /= numPoints;
|
||||
centroid.y /= numPoints;
|
||||
|
||||
/* printf("Centroid (%f,%f)",centroid.x,centroid.y); */
|
||||
/* Rotate Points so point 0 is left of centroid and solve for the bounding box */
|
||||
xmin = centroid.x;
|
||||
xmax = centroid.x;
|
||||
ymin = centroid.y;
|
||||
ymax = centroid.y;
|
||||
|
||||
ang = SDL_atan2f(centroid.y - points[0].y, centroid.x - points[0].x);
|
||||
|
||||
for (i = 0; i < numPoints; i++) {
|
||||
const float px = points[i].x;
|
||||
const float py = points[i].y;
|
||||
points[i].x = (px - centroid.x) * SDL_cosf(ang) - (py - centroid.y) * SDL_sinf(ang) + centroid.x;
|
||||
points[i].y = (px - centroid.x) * SDL_sinf(ang) + (py - centroid.y) * SDL_cosf(ang) + centroid.y;
|
||||
|
||||
if (points[i].x < xmin) {
|
||||
xmin = points[i].x;
|
||||
}
|
||||
if (points[i].x > xmax) {
|
||||
xmax = points[i].x;
|
||||
}
|
||||
if (points[i].y < ymin) {
|
||||
ymin = points[i].y;
|
||||
}
|
||||
if (points[i].y > ymax) {
|
||||
ymax = points[i].y;
|
||||
}
|
||||
}
|
||||
|
||||
/* Scale points to GESTURE_DOLLARSIZE, and translate to the origin */
|
||||
w = xmax - xmin;
|
||||
h = ymax - ymin;
|
||||
|
||||
for (i = 0; i < numPoints; i++) {
|
||||
points[i].x = (points[i].x - centroid.x) * GESTURE_DOLLARSIZE / w;
|
||||
points[i].y = (points[i].y - centroid.y) * GESTURE_DOLLARSIZE / h;
|
||||
}
|
||||
return numPoints;
|
||||
}
|
||||
|
||||
static float GestureDollarRecognize(const GestureDollarPath *path, int *bestTempl, GestureTouch *touch)
|
||||
{
|
||||
SDL_FPoint points[GESTURE_DOLLARNPOINTS];
|
||||
int i;
|
||||
float bestDiff = 10000;
|
||||
|
||||
SDL_memset(points, 0, sizeof(points));
|
||||
|
||||
GestureDollarNormalize(path, points, false);
|
||||
|
||||
/* PrintPath(points); */
|
||||
*bestTempl = -1;
|
||||
for (i = 0; i < touch->numDollarTemplates; i++) {
|
||||
const float diff = GestureBestDollarDifference(points, touch->dollarTemplate[i].path);
|
||||
if (diff < bestDiff) {
|
||||
bestDiff = diff;
|
||||
*bestTempl = i;
|
||||
}
|
||||
}
|
||||
return bestDiff;
|
||||
}
|
||||
|
||||
static void GestureSendMulti(GestureTouch *touch, float dTheta, float dDist)
|
||||
{
|
||||
if (SDL_EventEnabled(GESTURE_MULTIGESTURE)) {
|
||||
Gesture_MultiGestureEvent mgesture;
|
||||
mgesture.type = GESTURE_MULTIGESTURE;
|
||||
mgesture.timestamp = 0;
|
||||
mgesture.touchID = touch->touchID;
|
||||
mgesture.x = touch->centroid.x;
|
||||
mgesture.y = touch->centroid.y;
|
||||
mgesture.dTheta = dTheta;
|
||||
mgesture.dDist = dDist;
|
||||
mgesture.numFingers = (Uint16)touch->numDownFingers;
|
||||
SDL_PushEvent((SDL_Event*)&mgesture);
|
||||
}
|
||||
}
|
||||
|
||||
static void GestureSendDollar(GestureTouch *touch, Gesture_ID gestureId, float error)
|
||||
{
|
||||
if (SDL_EventEnabled(GESTURE_DOLLARGESTURE)) {
|
||||
Gesture_DollarGestureEvent dgesture;
|
||||
dgesture.type = GESTURE_DOLLARGESTURE;
|
||||
dgesture.timestamp = 0;
|
||||
dgesture.touchID = touch->touchID;
|
||||
dgesture.x = touch->centroid.x;
|
||||
dgesture.y = touch->centroid.y;
|
||||
dgesture.gestureId = gestureId;
|
||||
dgesture.error = error;
|
||||
/* A finger came up to trigger this event. */
|
||||
dgesture.numFingers = touch->numDownFingers + 1;
|
||||
SDL_PushEvent((SDL_Event*)&dgesture);
|
||||
}
|
||||
}
|
||||
|
||||
static void GestureSendDollarRecord(GestureTouch *touch, Gesture_ID gestureId)
|
||||
{
|
||||
if (SDL_EventEnabled(GESTURE_DOLLARRECORD)) {
|
||||
Gesture_DollarGestureEvent dgesture;
|
||||
dgesture.type = GESTURE_DOLLARRECORD;
|
||||
dgesture.timestamp = 0;
|
||||
dgesture.touchID = touch->touchID;
|
||||
dgesture.gestureId = gestureId;
|
||||
SDL_PushEvent((SDL_Event*)&dgesture);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(GESTURE_LOG_UP_DOWN_EVENTS)
|
||||
#define GESTURE_LOG_UP_DOWN_EVENTS 0
|
||||
#endif
|
||||
#if !defined(GESTURE_LOG_MOTION_EVENTS)
|
||||
#define GESTURE_LOG_MOTION_EVENTS 0
|
||||
#endif
|
||||
|
||||
static void GestureProcessEvent(const SDL_Event *event)
|
||||
{
|
||||
float x, y;
|
||||
int index;
|
||||
int i;
|
||||
float pathDx, pathDy;
|
||||
SDL_FPoint lastP;
|
||||
SDL_FPoint lastCentroid;
|
||||
float lDist;
|
||||
float Dist;
|
||||
float dtheta;
|
||||
float dDist;
|
||||
|
||||
if (event->type == SDL_EVENT_FINGER_MOTION || event->type == SDL_EVENT_FINGER_DOWN || event->type == SDL_EVENT_FINGER_UP) {
|
||||
GestureTouch *inTouch = GestureGetTouch(event->tfinger.touchID);
|
||||
if (inTouch == NULL) { /* we maybe didn't see this one before. */
|
||||
inTouch = GestureAddTouch(event->tfinger.touchID);
|
||||
if (!inTouch) {
|
||||
return; /* oh well. */
|
||||
}
|
||||
}
|
||||
int numDownFingersReported;
|
||||
SDL_Finger** fingers = SDL_GetTouchFingers(event->tfinger.touchID, &numDownFingersReported);
|
||||
|
||||
x = event->tfinger.x;
|
||||
y = event->tfinger.y;
|
||||
|
||||
/* Finger Up */
|
||||
if (event->type == SDL_EVENT_FINGER_UP) {
|
||||
#if GESTURE_LOG_UP_DOWN_EVENTS
|
||||
SDL_Log("GPE: Finger: %#" SDL_PRIx64 " UP. Device: %#" SDL_PRIx64 ", fingers: %i, x: %f, y: %f, press: %f",
|
||||
event->tfinger.fingerID, event->tfinger.touchID, numDownFingersReported,
|
||||
event->tfinger.x, event->tfinger.y, event->tfinger.pressure);
|
||||
#endif
|
||||
SDL_FPoint path[GESTURE_DOLLARNPOINTS];
|
||||
|
||||
#if SDL_PLATFORM_MACOS
|
||||
/* Workaround issue https://github.com/libsdl-org/SDL/issues/13428,
|
||||
Extra SDL_EVENT_FINGER_{UP,DOWN} with mouse button press, by
|
||||
ignoring events with fingerID of SDL_BUTTON_LEFT.
|
||||
|
||||
N.B. If SDL_HINT_MOUSE_TOUCH_EVENTS is set to 0 no touch
|
||||
events are received from the trackpad. */
|
||||
if (event->tfinger.fingerID == SDL_BUTTON_LEFT) return;
|
||||
#endif
|
||||
/* Using the number of fingers returned by SDL_GetTouchFingers
|
||||
is much more robust than counting finger up and down events.
|
||||
With counting it is easy for the counted number to be higher
|
||||
than the actual number. Unfortunately it has not been possible
|
||||
to identify a sequence of actions that reliably reproduces
|
||||
this but asserts have shown it happens often. Perhaps
|
||||
sometimes a single UP or DOWN event is received for multiple
|
||||
fingers.
|
||||
|
||||
Using the reported number is independent of how many events
|
||||
are actually received. But, and this is a big one, in the
|
||||
case of FINGER_UP SDL_GetTouchFingers reports the number of
|
||||
fingers down *before* the up event.
|
||||
|
||||
N.B. In the case of a left button press on macOS,
|
||||
SDL_GetTouchFingers reports 1 for the event that is not
|
||||
ignored.
|
||||
*/
|
||||
inTouch->numDownFingers = numDownFingersReported - 1;
|
||||
assert(inTouch->numDownFingers >= 0);
|
||||
#if (GESTURE_LOG_UP_DOWN_EVENTS)
|
||||
SDL_Log("GPE FINGER_UP, numDownFingers now = %i", inTouch->numDownFingers);
|
||||
#endif
|
||||
|
||||
if (inTouch->recording) {
|
||||
inTouch->recording = false;
|
||||
GestureDollarNormalize(&inTouch->dollarPath, path, true);
|
||||
/* PrintPath(path); */
|
||||
if (GestureRecordAll) {
|
||||
index = GestureAddDollar(NULL, path);
|
||||
for (i = 0; i < GestureNumTouches; i++) {
|
||||
GestureTouches[i].recording = false;
|
||||
}
|
||||
} else {
|
||||
index = GestureAddDollar(inTouch, path);
|
||||
}
|
||||
|
||||
if (index >= 0) {
|
||||
GestureSendDollarRecord(inTouch, inTouch->dollarTemplate[index].hash);
|
||||
} else {
|
||||
GestureSendDollarRecord(inTouch, -1);
|
||||
}
|
||||
} else {
|
||||
int bestTempl = -1;
|
||||
const float error = GestureDollarRecognize(&inTouch->dollarPath, &bestTempl, inTouch);
|
||||
if (bestTempl >= 0) {
|
||||
/* Send Event */
|
||||
const Gesture_ID gestureId = inTouch->dollarTemplate[bestTempl].hash;
|
||||
GestureSendDollar(inTouch, gestureId, error);
|
||||
/* printf ("%s\n",);("Dollar error: %f\n",error); */
|
||||
}
|
||||
}
|
||||
|
||||
/* inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers]; */
|
||||
if (inTouch->numDownFingers > 0) {
|
||||
inTouch->centroid.x = (inTouch->centroid.x * (inTouch->numDownFingers + 1) - x) / inTouch->numDownFingers;
|
||||
inTouch->centroid.y = (inTouch->centroid.y * (inTouch->numDownFingers + 1) - y) / inTouch->numDownFingers;
|
||||
} else {
|
||||
inTouch->centroid.x = inTouch->centroid.y = 0.0f;
|
||||
}
|
||||
} else if (event->type == SDL_EVENT_FINGER_MOTION) {
|
||||
/* There is one FINGER_MOTION event per down finger. x,y gives
|
||||
the position of the finger whose id is in the event. */
|
||||
const float dx = event->tfinger.dx;
|
||||
const float dy = event->tfinger.dy;
|
||||
GestureDollarPath *path = &inTouch->dollarPath;
|
||||
|
||||
#if GESTURE_LOG_MOTION_EVENTS
|
||||
SDL_Log("GPE: Finger: %#" SDL_PRIx64 " MOTION: device: %#" SDL_PRIx64 ", timestamp = %"
|
||||
SDL_PRIu64 ", fingers: %i, x: %f, y: %f, press: %f, numDownFingers: %i",
|
||||
event->tfinger.fingerID, event->tfinger.touchID, event->tfinger.timestamp,
|
||||
numDownFingersReported, event->tfinger.x, event->tfinger.y, event->tfinger.pressure,
|
||||
inTouch->numDownFingers);
|
||||
#endif
|
||||
assert(numDownFingersReported > 0);
|
||||
#if SDL_PLATFORM_MACOS
|
||||
/* Workaround issue https://github.com/libsdl-org/SDL/issues/13428.
|
||||
See comment at line 753 for more details. */
|
||||
if (event->tfinger.fingerID == SDL_BUTTON_LEFT) return;
|
||||
/* SDL_GetTouchFingers reports 2 fingers down in the motion event
|
||||
for the other finger during button press. Fix up the number of
|
||||
fingers. */
|
||||
uint32_t reportedNumFingers = numDownFingersReported;
|
||||
for (uint32_t i = 0; i < reportedNumFingers; i++) {
|
||||
if (fingers[i]->id == SDL_BUTTON_LEFT) {
|
||||
numDownFingersReported--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* See comment at line 762. One case where the count reliably
|
||||
differs from reported is on iOS. When touching, dragging and
|
||||
releasing 2 fingers, iOS sends a BUTTON_DOWN and BUTTON_UP
|
||||
for one of the fingers. When the finger corresponding to the
|
||||
button is raised, it sends the BUTTON_UP followed by the
|
||||
FINGER_UP but FINGER_MOTION events can come before the
|
||||
FINGER_UP and those events have only one finger down. */
|
||||
inTouch->numDownFingers = numDownFingersReported;
|
||||
if (path->numPoints < GESTURE_MAX_DOLLAR_PATH_SIZE) {
|
||||
path->p[path->numPoints].x = inTouch->centroid.x;
|
||||
path->p[path->numPoints].y = inTouch->centroid.y;
|
||||
pathDx = (path->p[path->numPoints].x - path->p[path->numPoints - 1].x);
|
||||
pathDy = (path->p[path->numPoints].y - path->p[path->numPoints - 1].y);
|
||||
path->length += (float)SDL_sqrt(pathDx * pathDx + pathDy * pathDy);
|
||||
path->numPoints++;
|
||||
}
|
||||
|
||||
lastP.x = x - dx;
|
||||
lastP.y = y - dy;
|
||||
lastCentroid = inTouch->centroid;
|
||||
|
||||
inTouch->centroid.x += dx / inTouch->numDownFingers;
|
||||
inTouch->centroid.y += dy / inTouch->numDownFingers;
|
||||
/* printf("Centroid : (%f,%f)\n",inTouch->centroid.x,inTouch->centroid.y); */
|
||||
if (inTouch->numDownFingers > 1) {
|
||||
SDL_FPoint lv; /* Vector from centroid to last x,y position */
|
||||
SDL_FPoint v; /* Vector from centroid to current x,y position */
|
||||
/* lv = inTouch->gestureLast[j].cv; */
|
||||
lv.x = lastP.x - lastCentroid.x;
|
||||
lv.y = lastP.y - lastCentroid.y;
|
||||
lDist = SDL_sqrtf(lv.x * lv.x + lv.y * lv.y);
|
||||
/* printf("lDist = %f\n",lDist); */
|
||||
v.x = x - inTouch->centroid.x;
|
||||
v.y = y - inTouch->centroid.y;
|
||||
/* inTouch->gestureLast[j].cv = v; */
|
||||
Dist = SDL_sqrtf(v.x * v.x + v.y * v.y);
|
||||
/* SDL_cosf(dTheta) = (v . lv)/(|v| * |lv|) */
|
||||
|
||||
/* Normalize Vectors to simplify angle calculation */
|
||||
lv.x /= lDist;
|
||||
lv.y /= lDist;
|
||||
v.x /= Dist;
|
||||
v.y /= Dist;
|
||||
dtheta = SDL_atan2f(lv.x * v.y - lv.y * v.x, lv.x * v.x + lv.y * v.y);
|
||||
|
||||
dDist = (Dist - lDist);
|
||||
if (lDist == 0) {
|
||||
/* To avoid impossible values */
|
||||
dDist = 0;
|
||||
dtheta = 0;
|
||||
}
|
||||
|
||||
/* inTouch->gestureLast[j].dDist = dDist;
|
||||
inTouch->gestureLast[j].dtheta = dtheta;
|
||||
|
||||
printf("dDist = %f, dTheta = %f\n",dDist,dtheta);
|
||||
gdtheta = gdtheta*.9 + dtheta*.1;
|
||||
gdDist = gdDist*.9 + dDist*.1
|
||||
knob.r += dDist/numDownFingers;
|
||||
knob.ang += dtheta;
|
||||
printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist);
|
||||
printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist); */
|
||||
GestureSendMulti(inTouch, dtheta, dDist);
|
||||
} else {
|
||||
/* inTouch->gestureLast[j].dDist = 0;
|
||||
inTouch->gestureLast[j].dtheta = 0;
|
||||
inTouch->gestureLast[j].cv.x = 0;
|
||||
inTouch->gestureLast[j].cv.y = 0; */
|
||||
}
|
||||
/* inTouch->gestureLast[j].f.p.x = x;
|
||||
inTouch->gestureLast[j].f.p.y = y;
|
||||
break;
|
||||
pressure? */
|
||||
} else if (event->type == SDL_EVENT_FINGER_DOWN) {
|
||||
#if (GESTURE_LOG_UP_DOWN_EVENTS)
|
||||
SDL_Log("GPE: Finger: %#" SDL_PRIx64 " DOWN. Device: %#" SDL_PRIx64 ", fingers: %i, x: %f, y: %f, press: %f",
|
||||
event->tfinger.fingerID, event->tfinger.touchID, numDownFingersReported,
|
||||
event->tfinger.x, event->tfinger.y, event->tfinger.pressure);
|
||||
#endif
|
||||
#if SDL_PLATFORM_MACOS
|
||||
/* See comment starting at line 753. */
|
||||
if (event->tfinger.fingerID == SDL_BUTTON_LEFT) return;
|
||||
#endif
|
||||
/* Using the number of fingers returned by SDL_GetTouchFingers
|
||||
is much more robust than counting finger up and down events.
|
||||
With counting it is easy for the counted number to be higher
|
||||
than the actual number. Unfortunately it has not been possible
|
||||
to identify a sequence of actions that reliably reproduces
|
||||
this. Using the reported number is independent of how many
|
||||
events are actually received. */
|
||||
inTouch->numDownFingers = numDownFingersReported;
|
||||
inTouch->centroid.x = inTouch->centroid.y = 0.0;
|
||||
for (i = 0; i < numDownFingersReported; i++) {
|
||||
inTouch->centroid.x += fingers[i]->x;
|
||||
inTouch->centroid.y += fingers[i]->y;
|
||||
}
|
||||
inTouch->centroid.x /= numDownFingersReported;
|
||||
inTouch->centroid.y /= numDownFingersReported;
|
||||
//printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
|
||||
// inTouch->centroid.x,inTouch->centroid.y);
|
||||
|
||||
inTouch->dollarPath.length = 0;
|
||||
inTouch->dollarPath.p[0].x = x;
|
||||
inTouch->dollarPath.p[0].y = y;
|
||||
inTouch->dollarPath.numPoints = 1;
|
||||
}
|
||||
SDL_free(fingers);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* defined(SDL_GESTURE_IMPLEMENTATION) */
|
||||
#endif /* SDL version > 2 */
|
||||
#endif /* INCL_SDL_GESTURE_H */
|
||||
|
||||
/* vi: set sts=4 ts=4 sw=4 expandtab: */
|
||||
@@ -0,0 +1,21 @@
|
||||
# Text type files use auto line endings
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text file types for this repo
|
||||
*.c text
|
||||
*.cpp text
|
||||
*.h text
|
||||
*.md text
|
||||
Jenkinsfile text
|
||||
|
||||
# VS solutions always use Windows line endings
|
||||
*.sln text eol=crlf
|
||||
*.vcxproj text eol=crlf
|
||||
|
||||
# Bash scripts always use *nux line endings
|
||||
*.sh text eol=lf
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.png binary
|
||||
*.hdr binary
|
||||
*.exe binary
|
||||
@@ -0,0 +1,385 @@
|
||||
name: post-weekly-release
|
||||
run-name: Build, test, generate signed artifacts and optionally prepare release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- '*'
|
||||
schedule:
|
||||
- cron: '17 2 * * 1'
|
||||
|
||||
jobs:
|
||||
|
||||
coverity:
|
||||
if: ${{ (!startsWith(github.event.ref, 'refs/tags/')) && (github.repository_owner == 'Arm-software') }}
|
||||
name: Run Coverity static analysis
|
||||
runs-on: [self-hosted-ubuntu-latest-x64]
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
uses: AutoModality/action-clean@v1
|
||||
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Coverity preparation
|
||||
run: |
|
||||
export PATH=$PATH:/usr/local/cov-analysis/bin
|
||||
mkdir build_cov
|
||||
cd build_cov
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON ..
|
||||
cov-configure --config ${GITHUB_WORKSPACE}/coverity.conf --template --compiler cc --comptype gcc
|
||||
cov-configure --config ${GITHUB_WORKSPACE}/coverity.conf --template --compiler c++ --comptype g++
|
||||
|
||||
- name: Coverity build
|
||||
run: |
|
||||
export PATH=$PATH:/usr/local/cov-analysis/bin
|
||||
cd build_cov
|
||||
cov-build --config ${GITHUB_WORKSPACE}/coverity.conf --dir ${GITHUB_WORKSPACE}/intermediate make install
|
||||
|
||||
- name: Coverity analyze
|
||||
run: |
|
||||
export PATH=$PATH:/usr/local/cov-analysis/bin
|
||||
cd build_cov
|
||||
cov-analyze --dir ${GITHUB_WORKSPACE}/intermediate
|
||||
|
||||
- name: Coverity upload
|
||||
env:
|
||||
COVERITY_KEY: ${{ secrets.COVERITY_KEY }}
|
||||
run: |
|
||||
export PATH=$PATH:/usr/local/cov-analysis/bin
|
||||
echo "${COVERITY_KEY}" > coverity.key
|
||||
chmod 400 coverity.key
|
||||
cd build_cov
|
||||
cov-commit-defects \
|
||||
--dir ${GITHUB_WORKSPACE}/intermediate \
|
||||
--stream astcenc-master \
|
||||
--url https://coverity.cambridge.arm.com \
|
||||
--auth-key-file ../coverity.key \
|
||||
--strip-path ${GITHUB_WORKSPACE}
|
||||
|
||||
build-ubuntu-arm64:
|
||||
name: Ubuntu arm64
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Update apt packages
|
||||
run: sudo apt-get update
|
||||
|
||||
- name: Install ImageMagick
|
||||
run: sudo apt-get install imagemagick
|
||||
|
||||
- name: Build release
|
||||
run: |
|
||||
export CXX=clang++
|
||||
mkdir build_rel
|
||||
cd build_rel
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_NEON=ON -DASTCENC_ISA_SVE_128=ON -DASTCENC_ISA_SVE_256=ON -DASTCENC_PACKAGE=arm64 ..
|
||||
make install package -j4
|
||||
|
||||
- name: Upload binaries
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: astcenc-linux-arm64
|
||||
path: |
|
||||
build_rel/*.zip
|
||||
build_rel/*.zip.sha256
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Get Python modules
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install numpy Pillow
|
||||
|
||||
- name: Run system tests
|
||||
# Disable SVE testing for now
|
||||
run: |
|
||||
python ./Test/astc_test_functional.py --encoder neon
|
||||
python ./Test/astc_test_image.py --encoder neon --test-set Small
|
||||
|
||||
build-ubuntu-x64:
|
||||
name: Ubuntu x64
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Build release
|
||||
run: |
|
||||
export CXX=clang++
|
||||
mkdir build_rel
|
||||
cd build_rel
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_PACKAGE=x64 ..
|
||||
make install package -j4
|
||||
|
||||
- name: Upload binaries
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: astcenc-linux-x86_64
|
||||
path: |
|
||||
build_rel/*.zip
|
||||
build_rel/*.zip.sha256
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Get Python modules
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install numpy Pillow
|
||||
|
||||
- name: Run system tests
|
||||
run: |
|
||||
python ./Test/astc_test_functional.py
|
||||
python ./Test/astc_test_image.py --encoder all-x86 --test-set Small
|
||||
|
||||
build-macos-universal:
|
||||
name: macOS universal
|
||||
runs-on: macos-14
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Build release
|
||||
run: |
|
||||
mkdir build_rel
|
||||
cd build_rel
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_PACKAGE=universal ..
|
||||
make install package -j4
|
||||
|
||||
- name: Upload binaries
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: astcenc-macos-universal
|
||||
path: |
|
||||
build_rel/*.zip
|
||||
build_rel/*.zip.sha256
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Get Python modules
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install numpy Pillow
|
||||
|
||||
- name: Run system tests
|
||||
run: |
|
||||
python ./Test/astc_test_image.py --test-set Small --encoder universal
|
||||
|
||||
build-windows-multi:
|
||||
name: Windows multi
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Setup Visual Studio x86_64
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Build release x64
|
||||
run: |
|
||||
mkdir build_rel
|
||||
cd build_rel
|
||||
cmake -G "Visual Studio 17 2022" -T ClangCL -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON -DASTCENC_PACKAGE=x64 ..
|
||||
msbuild astcencoder.sln -property:Configuration=Release
|
||||
msbuild PACKAGE.vcxproj -property:Configuration=Release
|
||||
msbuild INSTALL.vcxproj -property:Configuration=Release
|
||||
shell: cmd
|
||||
|
||||
- name: Setup Visual Studio arm64
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x86_arm64
|
||||
|
||||
- name: Build release arm64
|
||||
run: |
|
||||
mkdir build_rel_arm64
|
||||
cd build_rel_arm64
|
||||
cmake -G "Visual Studio 17 2022" -A ARM64 -T ClangCL -DCMAKE_INSTALL_PREFIX=../ -DASTCENC_ISA_NEON=ON -DASTCENC_PACKAGE=arm64 ..
|
||||
msbuild astcencoder.sln -property:Configuration=Release
|
||||
msbuild PACKAGE.vcxproj -property:Configuration=Release
|
||||
msbuild INSTALL.vcxproj -property:Configuration=Release
|
||||
shell: cmd
|
||||
|
||||
- name: Upload binaries
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: astcenc-windows-multi-cl
|
||||
path: |
|
||||
build_rel/*.zip
|
||||
build_rel/*.zip.sha256
|
||||
build_rel_arm64/*.zip
|
||||
build_rel_arm64/*.zip.sha256
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Get Python modules
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install numpy Pillow
|
||||
shell: cmd
|
||||
|
||||
- name: Run system tests
|
||||
run: |
|
||||
python ./Test/astc_test_image.py --test-set Small
|
||||
shell: cmd
|
||||
|
||||
sign-binaries:
|
||||
if: github.repository_owner == 'Arm-software'
|
||||
name: Sign Windows and macOS
|
||||
runs-on: [self-hosted-ubuntu-latest-x64]
|
||||
needs: [build-macos-universal, build-windows-multi]
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
uses: AutoModality/action-clean@v1
|
||||
|
||||
- name: Checkout signing code
|
||||
env:
|
||||
SIGNING_REPO_URL: ${{ secrets.SIGNING_REPO_URL }}
|
||||
run: |
|
||||
git clone --depth 1 ${SIGNING_REPO_URL}
|
||||
|
||||
- name: Install code sign v2 client
|
||||
env:
|
||||
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
|
||||
ARTIFACTORY_APIKEY: ${{ secrets.ARTIFACTORY_APIKEY }}
|
||||
ARTIFACTORY_FQDN: ${{ secrets.ARTIFACTORY_FQDN }}
|
||||
run: |
|
||||
python3.11 -m venv cs
|
||||
. ./cs/bin/activate
|
||||
pip install -i https://${ARTIFACTORY_USER}:${ARTIFACTORY_APIKEY}@${ARTIFACTORY_FQDN}/artifactory/api/pypi/dsgcore.pypi/simple code-signer-client
|
||||
|
||||
- name: Download macOS binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: astcenc-macos-universal
|
||||
path: mac
|
||||
|
||||
- name: Download Windows binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: astcenc-windows-multi-cl
|
||||
path: windows
|
||||
|
||||
- name: Sign macOS binaries
|
||||
env:
|
||||
CODESIGNER_USER: ${{ secrets.CODESIGNER_USER }}
|
||||
run: |
|
||||
. ./cs/bin/activate
|
||||
cd mac
|
||||
python3 ${GITHUB_WORKSPACE}/signing/macos-client-wrapper.py ${CODESIGNER_USER} *.zip
|
||||
|
||||
- name: Sign Windows binaries
|
||||
env:
|
||||
ARTIFACTORY_APIKEY: ${{ secrets.ARTIFACTORY_APIKEY }}
|
||||
run: |
|
||||
. ./cs/bin/activate
|
||||
cd windows
|
||||
for FILENAME in */*; do mv ${FILENAME} .; done
|
||||
for ZIPFILE in *.zip; do python3 ../signing/windows-client-wrapper.py -b ${GITHUB_RUN_NUMBER} -t ${ARTIFACTORY_APIKEY} ${ZIPFILE}; done
|
||||
|
||||
- name: Upload signed binaries
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: signed-binaries
|
||||
path: |
|
||||
windows/*
|
||||
mac/*
|
||||
|
||||
- name: Tidy intermediate artifacts
|
||||
uses: geekyeggo/delete-artifact@v5
|
||||
with:
|
||||
name: |
|
||||
astcenc-windows-multi-cl
|
||||
astcenc-macos-universal
|
||||
|
||||
prepare-release:
|
||||
if: ${{ (startsWith(github.event.ref, 'refs/tags/')) && (github.repository_owner == 'Arm-software') }}
|
||||
name: Prepare release
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [sign-binaries, build-ubuntu-x64]
|
||||
steps:
|
||||
- name: Git checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download signed binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: signed-binaries
|
||||
path: prepare-release
|
||||
|
||||
- name: Download Linux x86_64 binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: astcenc-linux-x86_64
|
||||
path: prepare-release
|
||||
|
||||
- name: Download Linux arm64 binaries
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: astcenc-linux-arm64
|
||||
path: prepare-release
|
||||
|
||||
- name: Flatten file structure
|
||||
run: |
|
||||
cd prepare-release
|
||||
for FILENAME in */*; do mv ${FILENAME} .; done
|
||||
rmdir windows
|
||||
rmdir mac
|
||||
|
||||
- name: Create checksum file
|
||||
run: |
|
||||
cd prepare-release
|
||||
cat *.sha256 > release-sha256.txt
|
||||
rm *.sha256
|
||||
|
||||
- name: Create release body
|
||||
run: |
|
||||
export STATUS_DATE=$(date "+%B %Y")
|
||||
GITHUB_REF=${{ github.ref }} ; export RELEASE_VERSION=${GITHUB_REF##*/}
|
||||
export SHA_CHECKSUMS=$(cat prepare-release/release-sha256.txt)
|
||||
envsubst < .github/workflows/release_body_template.md > prepare-release/release_body.md
|
||||
|
||||
- name: Create release
|
||||
id: create_release
|
||||
uses: comnoco/create-release-action@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
body_path: prepare-release/release_body.md
|
||||
draft: true
|
||||
|
||||
- name: Attach artifacts
|
||||
uses: AButler/upload-release-assets@v3.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
release-id: ${{ steps.create_release.outputs.id }}
|
||||
files: "prepare-release/astcenc-*-*-*.zip;prepare-release/release-sha256.txt"
|
||||
@@ -0,0 +1,13 @@
|
||||
**Status:** ${STATUS_DATE}
|
||||
|
||||
The ${RELEASE_VERSION} release is a minor/major maintenance release.
|
||||
|
||||
* **General:**
|
||||
* **Bug fix:** Text here
|
||||
* **Feature:** Text here
|
||||
|
||||
## Binary release sha256 checksums
|
||||
|
||||
```
|
||||
${SHA_CHECKSUMS}
|
||||
```
|
||||
@@ -0,0 +1,47 @@
|
||||
# Editor and engineering scratch files
|
||||
.cache
|
||||
.vs
|
||||
.vscode
|
||||
.DS_Store
|
||||
*.log
|
||||
*.diff
|
||||
*.user
|
||||
*.o
|
||||
*.a
|
||||
__pycache__
|
||||
Scratch
|
||||
Proto
|
||||
|
||||
# Precompiled reference binaries for comparison tests
|
||||
bin
|
||||
lib
|
||||
Binaries
|
||||
|
||||
# Build artifacts
|
||||
astcenc
|
||||
build*
|
||||
|
||||
# General build artifacts
|
||||
Test/DocOut
|
||||
|
||||
# Test images we download from other sources
|
||||
Test/Images/Kodak*/**/*.png
|
||||
Test/Images/Scratch*
|
||||
|
||||
# Test output
|
||||
TestOutput
|
||||
/*.xlsx
|
||||
/*.jpg
|
||||
/*.json
|
||||
/*.log
|
||||
/*.txt
|
||||
/*.hdr
|
||||
/*.png
|
||||
/*.exr
|
||||
/*.astc
|
||||
astc_reference-main*
|
||||
Docs/Profiling.md
|
||||
Source/astcenccli_version.h
|
||||
|
||||
# Do not ignore workflows
|
||||
!.github/workflows/
|
||||
@@ -0,0 +1,12 @@
|
||||
; DO NOT EDIT (unless you know what you are doing)
|
||||
;
|
||||
; This subdirectory is a git "subrepo", and this file is maintained by the
|
||||
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
|
||||
;
|
||||
[subrepo]
|
||||
remote = https://github.com/ARM-software/astc-encoder.git
|
||||
branch = 5.3.0
|
||||
commit = 30aabb3f42406df45a910d8496f9bee17eeba9bb
|
||||
parent = f9c73388a58de9b83f260f11008b043d8f7c0954
|
||||
method = merge
|
||||
cmdver = 0.4.9
|
||||
@@ -0,0 +1,532 @@
|
||||
[MASTER]
|
||||
|
||||
# Control the amount of potential inferred values when inferring a single
|
||||
# object. This can help the performance when dealing with large functions or
|
||||
# complex, nested conditions.
|
||||
limit-inference-results=100
|
||||
|
||||
# List of plugins (as comma separated values of python module names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=pylint.extensions.docparams
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# When enabled, pylint would attempt to guess common misconfiguration and emit
|
||||
# user-friendly hints instead of false-positive error messages.
|
||||
suggestion-mode=yes
|
||||
|
||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||
# active Python interpreter and may run arbitrary code.
|
||||
unsafe-load-any-extension=no
|
||||
|
||||
# Ignore specific directories we don't author ourselves
|
||||
ignore=Test/DocSource
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
|
||||
confidence=
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once). You can also use "--disable=all" to
|
||||
# disable everything first and then reenable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use "--disable=all --enable=classes
|
||||
# --disable=W".
|
||||
disable=print-statement,
|
||||
parameter-unpacking,
|
||||
unpacking-in-except,
|
||||
old-raise-syntax,
|
||||
backtick,
|
||||
long-suffix,
|
||||
old-ne-operator,
|
||||
old-octal-literal,
|
||||
import-star-module-level,
|
||||
non-ascii-bytes-literal,
|
||||
raw-checker-failed,
|
||||
bad-inline-option,
|
||||
locally-disabled,
|
||||
file-ignored,
|
||||
suppressed-message,
|
||||
useless-suppression,
|
||||
deprecated-pragma,
|
||||
use-symbolic-message-instead,
|
||||
apply-builtin,
|
||||
basestring-builtin,
|
||||
buffer-builtin,
|
||||
cmp-builtin,
|
||||
coerce-builtin,
|
||||
execfile-builtin,
|
||||
file-builtin,
|
||||
long-builtin,
|
||||
raw_input-builtin,
|
||||
reduce-builtin,
|
||||
standarderror-builtin,
|
||||
unicode-builtin,
|
||||
xrange-builtin,
|
||||
coerce-method,
|
||||
delslice-method,
|
||||
getslice-method,
|
||||
setslice-method,
|
||||
no-absolute-import,
|
||||
old-division,
|
||||
dict-iter-method,
|
||||
dict-view-method,
|
||||
next-method-called,
|
||||
metaclass-assignment,
|
||||
indexing-exception,
|
||||
raising-string,
|
||||
reload-builtin,
|
||||
oct-method,
|
||||
hex-method,
|
||||
nonzero-method,
|
||||
cmp-method,
|
||||
input-builtin,
|
||||
round-builtin,
|
||||
intern-builtin,
|
||||
unichr-builtin,
|
||||
map-builtin-not-iterating,
|
||||
zip-builtin-not-iterating,
|
||||
range-builtin-not-iterating,
|
||||
filter-builtin-not-iterating,
|
||||
using-cmp-argument,
|
||||
eq-without-hash,
|
||||
div-method,
|
||||
idiv-method,
|
||||
rdiv-method,
|
||||
exception-message-attribute,
|
||||
invalid-str-codec,
|
||||
sys-max-int,
|
||||
bad-python3-import,
|
||||
deprecated-string-function,
|
||||
deprecated-str-translate-call,
|
||||
deprecated-itertools-function,
|
||||
deprecated-types-field,
|
||||
next-method-defined,
|
||||
dict-items-not-iterating,
|
||||
dict-keys-not-iterating,
|
||||
dict-values-not-iterating,
|
||||
deprecated-operator-function,
|
||||
deprecated-urllib-function,
|
||||
xreadlines-attribute,
|
||||
deprecated-sys-function,
|
||||
exception-escape,
|
||||
comprehension-escape
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once). See also the "--disable" option for examples.
|
||||
enable=c-extension-no-member
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Python expression which should return a score less than or equal to 10. You
|
||||
# have access to the variables 'error', 'warning', 'refactor', and 'convention'
|
||||
# which contain the number of messages in each category, as well as 'statement'
|
||||
# which is the total number of statements analyzed. This score is used by the
|
||||
# global evaluation report (RP0004).
|
||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, json
|
||||
# and msvs (visual studio). You can also give a reporter class, e.g.
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
output-format=text
|
||||
|
||||
# Tells whether to display a full report or only the messages.
|
||||
reports=no
|
||||
|
||||
# Activate the evaluation score.
|
||||
score=yes
|
||||
|
||||
|
||||
[REFACTORING]
|
||||
|
||||
# Maximum number of nested blocks for function / method body
|
||||
max-nested-blocks=5
|
||||
|
||||
# Complete name of functions that never returns.
|
||||
never-returning-functions=sys.exit
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Naming style matching correct argument names.
|
||||
argument-naming-style=camelCase
|
||||
|
||||
# Regular expression matching correct argument names. Overrides argument-
|
||||
# naming-style.
|
||||
#argument-rgx=
|
||||
|
||||
# Naming style matching correct attribute names.
|
||||
attr-naming-style=camelCase
|
||||
|
||||
# Regular expression matching correct attribute names. Overrides attr-naming-
|
||||
# style.
|
||||
#attr-rgx=
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma.
|
||||
bad-names=foo,
|
||||
bar,
|
||||
baz,
|
||||
toto,
|
||||
tutu,
|
||||
tata
|
||||
|
||||
# Naming style matching correct class attribute names.
|
||||
class-attribute-naming-style=any
|
||||
|
||||
# Regular expression matching correct class attribute names. Overrides class-
|
||||
# attribute-naming-style.
|
||||
#class-attribute-rgx=
|
||||
|
||||
# Naming style matching correct class names.
|
||||
class-naming-style=PascalCase
|
||||
|
||||
# Regular expression matching correct class names. Overrides class-naming-
|
||||
# style.
|
||||
#class-rgx=
|
||||
|
||||
# Naming style matching correct constant names.
|
||||
const-naming-style=UPPER_CASE
|
||||
|
||||
# Regular expression matching correct constant names. Overrides const-naming-
|
||||
# style.
|
||||
#const-rgx=
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
# Naming style matching correct function names.
|
||||
function-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct function names. Overrides function-
|
||||
# naming-style.
|
||||
#function-rgx=
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma.
|
||||
good-names=i,j,k,x,y,z,w,r,g,b,a,ex,Run,_
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name.
|
||||
include-naming-hint=no
|
||||
|
||||
# Naming style matching correct inline iteration names.
|
||||
inlinevar-naming-style=any
|
||||
|
||||
# Regular expression matching correct inline iteration names. Overrides
|
||||
# inlinevar-naming-style.
|
||||
#inlinevar-rgx=
|
||||
|
||||
# Naming style matching correct method names.
|
||||
method-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct method names. Overrides method-naming-
|
||||
# style.
|
||||
#method-rgx=
|
||||
|
||||
# Naming style matching correct module names.
|
||||
module-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct module names. Overrides module-naming-
|
||||
# style.
|
||||
#module-rgx=
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=^_
|
||||
|
||||
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||
# to this list to register other decorators that produce valid properties.
|
||||
# These decorators are taken in consideration only for invalid-name.
|
||||
property-classes=abc.abstractproperty
|
||||
|
||||
# Naming style matching correct variable names.
|
||||
variable-naming-style=camelCase
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||
expected-line-ending-format=
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
indent-string=' '
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=79
|
||||
|
||||
# Maximum number of lines in a module.
|
||||
max-module-lines=1000
|
||||
|
||||
# Allow the body of a class to be on the same line as the declaration if body
|
||||
# contains single statement.
|
||||
single-line-class-stmt=no
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=no
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# Format style used to check logging format string. `old` means using %
|
||||
# formatting, `new` is for `{}` formatting,and `fstr` is for f-strings.
|
||||
logging-format-style=old
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format.
|
||||
logging-modules=logging
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME,XXX,TODO
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Ignore comments when computing similarities.
|
||||
ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
|
||||
|
||||
[SPELLING]
|
||||
|
||||
# Limits count of emitted suggestions for spelling mistakes.
|
||||
max-spelling-suggestions=4
|
||||
|
||||
# Spelling dictionary name. Available dictionaries: none. To make it work,
|
||||
# install the python-enchant package.
|
||||
spelling-dict=
|
||||
|
||||
# List of comma separated words that should not be checked.
|
||||
spelling-ignore-words=
|
||||
|
||||
# A path to a file that contains the private dictionary; one word per line.
|
||||
spelling-private-dict-file=
|
||||
|
||||
# Tells whether to store unknown words to the private dictionary (see the
|
||||
# --spelling-private-dict-file option) instead of raising a message.
|
||||
spelling-store-unknown-words=no
|
||||
|
||||
|
||||
[STRING]
|
||||
|
||||
# This flag controls whether the implicit-str-concat-in-sequence should
|
||||
# generate a warning on implicit string concatenation in sequences defined over
|
||||
# several lines.
|
||||
check-str-concat-over-line-jumps=no
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# List of decorators that produce context managers, such as
|
||||
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||
# produce valid context managers.
|
||||
contextmanager-decorators=contextlib.contextmanager
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=
|
||||
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# Tells whether to warn about missing members when the owner of the attribute
|
||||
# is inferred to be None.
|
||||
ignore-none=yes
|
||||
|
||||
# This flag controls whether pylint should warn about no-member and similar
|
||||
# checks whenever an opaque object is returned when inferring. The inference
|
||||
# can return multiple potential results while evaluating a Python object, but
|
||||
# some branches might not be evaluated, which results in partial inference. In
|
||||
# that case, it might be useful to still emit no-member and other checks for
|
||||
# the rest of the inferred objects.
|
||||
ignore-on-opaque-inference=yes
|
||||
|
||||
# List of class names for which member attributes should not be checked (useful
|
||||
# for classes with dynamically set attributes). This supports the use of
|
||||
# qualified names.
|
||||
ignored-classes=optparse.Values,thread._local,_thread._local
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis). It
|
||||
# supports qualified module names, as well as Unix pattern matching.
|
||||
ignored-modules=signal
|
||||
|
||||
# Show a hint with possible names when a member name was not found. The aspect
|
||||
# of finding the hint is based on edit distance.
|
||||
missing-member-hint=yes
|
||||
|
||||
# The minimum edit distance a name should have in order to be considered a
|
||||
# similar match for a missing member name.
|
||||
missing-member-hint-distance=1
|
||||
|
||||
# The total number of similar names that should be taken in consideration when
|
||||
# showing a hint for a missing member.
|
||||
missing-member-max-choices=1
|
||||
|
||||
# List of decorators that change the signature of a decorated function.
|
||||
signature-mutators=
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid defining new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
# Tells whether unused global variables should be treated as a violation.
|
||||
allow-global-unused-variables=yes
|
||||
|
||||
# List of strings which can identify a callback function by name. A callback
|
||||
# name must start or end with one of those strings.
|
||||
callbacks=cb_,_cb
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expected to
|
||||
# not be used).
|
||||
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore.
|
||||
ignored-argument-names=_.*|^ignored_|^unused_
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# List of qualified module names which can have objects that can redefine
|
||||
# builtins.
|
||||
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,
|
||||
__new__,
|
||||
setUp,
|
||||
__post_init__
|
||||
|
||||
# List of member names, which should be excluded from the protected access
|
||||
# warning.
|
||||
exclude-protected=_asdict,
|
||||
_fields,
|
||||
_replace,
|
||||
_source,
|
||||
_make
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=cls
|
||||
|
||||
|
||||
[DESIGN]
|
||||
|
||||
# Maximum number of arguments for function / method.
|
||||
max-args=7
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=16
|
||||
|
||||
# Maximum number of boolean expressions in an if statement (see R0916).
|
||||
max-bool-expr=5
|
||||
|
||||
# Maximum number of branch for function / method body.
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of locals for function / method body.
|
||||
max-locals=16
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
# Maximum number of return / yield for function / method body.
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of statements in function / method body.
|
||||
max-statements=50
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=0
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# List of modules that can be imported at any level, not just the top level
|
||||
# one.
|
||||
allow-any-import-level=
|
||||
|
||||
# Allow wildcard imports from modules that define __all__.
|
||||
allow-wildcard-with-all=no
|
||||
|
||||
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
||||
# 3 compatible code, which means that the block might have code that exists
|
||||
# only in one or another interpreter, leading to false positives when analysed.
|
||||
analyse-fallback-blocks=no
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma.
|
||||
deprecated-modules=optparse,tkinter.tix
|
||||
|
||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||
# not be disabled).
|
||||
ext-import-graph=
|
||||
|
||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||
# given file (report RP0402 must not be disabled).
|
||||
import-graph=
|
||||
|
||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||
# not be disabled).
|
||||
int-import-graph=
|
||||
|
||||
# Force import order to recognize a module as part of the standard
|
||||
# compatibility libraries.
|
||||
known-standard-library=
|
||||
|
||||
# Force import order to recognize a module as part of a third party library.
|
||||
known-third-party=enchant
|
||||
|
||||
# Couples of modules and preferred modules, separated by a comma.
|
||||
preferred-modules=
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "BaseException, Exception".
|
||||
overgeneral-exceptions=BaseException,
|
||||
Exception
|
||||
@@ -0,0 +1,315 @@
|
||||
# Building ASTC Encoder
|
||||
|
||||
This page provides instructions for building `astcenc` from the sources in
|
||||
this repository.
|
||||
|
||||
Builds must use CMake 3.15 or higher as the build system generator. The
|
||||
examples on this page show how to use it to generate build systems for NMake
|
||||
(Windows) and Make (Linux and macOS), but CMake supports other build system
|
||||
backends.
|
||||
|
||||
## Windows
|
||||
|
||||
Builds for Windows are tested with CMake 3.17, and Visual Studio 2019 or newer.
|
||||
|
||||
### Configuring the build
|
||||
|
||||
To use CMake you must first configure the build. Create a build directory in
|
||||
the root of the `astcenc` checkout, and then run `cmake` inside that directory
|
||||
to generate the build system.
|
||||
|
||||
```shell
|
||||
# Create a build directory
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Configure your build of choice, for example:
|
||||
|
||||
# x86-64 using a Visual Studio solution
|
||||
cmake -G "Visual Studio 16 2019" -T ClangCL -DCMAKE_INSTALL_PREFIX=..\ ^
|
||||
-DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON ..
|
||||
|
||||
# x86-64 using NMake
|
||||
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=..\ ^
|
||||
-DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON ..
|
||||
```
|
||||
|
||||
A single CMake configure can build multiple binaries for a single target CPU
|
||||
architecture, for example building x64 for both SSE2 and AVX2. Each binary name
|
||||
will include the build variant as a postfix. It is possible to build any set of
|
||||
the supported SIMD variants by enabling only the ones you require.
|
||||
|
||||
Using the Visual Studio Clang-CL LLVM toolchain (`-T ClangCL`) is optional but
|
||||
produces significantly faster binaries than the default toolchain. The C++ LLVM
|
||||
toolchain component must be installed via the Visual Studio installer.
|
||||
|
||||
### Building
|
||||
|
||||
Once you have configured the build you can use NMake to compile the project
|
||||
from your build dir, and install to your target install directory.
|
||||
|
||||
```shell
|
||||
# Run a build and install build outputs in `${CMAKE_INSTALL_PREFIX}/bin/`
|
||||
cd build
|
||||
nmake install
|
||||
```
|
||||
|
||||
## macOS and Linux using Make
|
||||
|
||||
Builds for macOS and Linux are tested with CMake 3.17, and clang++ 9.0 or
|
||||
newer.
|
||||
|
||||
> Compiling using g++ is supported, but clang++ builds are faster by ~15%.
|
||||
|
||||
### Configuring the build
|
||||
|
||||
To use CMake you must first configure the build. Create a build directory
|
||||
in the root of the astcenc checkout, and then run `cmake` inside that directory
|
||||
to generate the build system.
|
||||
|
||||
```shell
|
||||
# Select your compiler (clang++ recommended, but g++ works)
|
||||
export CXX=clang++
|
||||
|
||||
# Create a build directory
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Configure your build of choice, for example:
|
||||
|
||||
# Arm arch64
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ \
|
||||
-DASTCENC_ISA_NEON=ON ..
|
||||
|
||||
# x86-64
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ \
|
||||
-DASTCENC_ISA_AVX2=ON -DASTCENC_ISA_SSE41=ON -DASTCENC_ISA_SSE2=ON ..
|
||||
|
||||
# macOS universal binary build
|
||||
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ ..
|
||||
```
|
||||
|
||||
A single CMake configure can build multiple binaries for a single target CPU
|
||||
architecture, for example building x64 for both SSE2 and AVX2. Each binary name
|
||||
will include the build variant as a postfix. It is possible to build any set of
|
||||
the supported SIMD variants by enabling only the ones you require.
|
||||
|
||||
For macOS, we additionally support the ability to build a universal binary.
|
||||
This build includes SSE4.1 (`x86_64`), AVX2 (`x86_64h`), and NEON (`arm64`)
|
||||
build slices in a single output binary. The OS will select the correct variant
|
||||
to run for the machine being used. This is the default build target for a macOS
|
||||
build, but single-target binaries can still be built by setting
|
||||
`-DASTCENC_UNIVERSAL_BINARY=OFF` and then manually selecting the specific ISA
|
||||
variants that are required.
|
||||
|
||||
### Building
|
||||
|
||||
Once you have configured the build you can use Make to compile the project from
|
||||
your build dir, and install to your target install directory.
|
||||
|
||||
```shell
|
||||
# Run a build and install build outputs in `${CMAKE_INSTALL_PREFIX}/bin/`
|
||||
# for executable binaries and `${CMAKE_INSTALL_PREFIX}/lib/` for libraries
|
||||
cd build
|
||||
make install -j16
|
||||
```
|
||||
|
||||
## macOS using XCode
|
||||
|
||||
Builds for macOS and Linux are tested with CMake 3.17, and XCode 14.0 or
|
||||
newer.
|
||||
|
||||
### Configuring the build
|
||||
|
||||
To use CMake you must first configure the build. Create a build directory
|
||||
in the root of the astcenc checkout, and then run `cmake` inside that directory
|
||||
to generate the build system.
|
||||
|
||||
```shell
|
||||
# Create a build directory
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
# Configure a universal build
|
||||
cmake -G Xcode -DCMAKE_INSTALL_PREFIX=../ ..
|
||||
```
|
||||
|
||||
### Building
|
||||
|
||||
Once you have configured the build you can use CMake to compile the project
|
||||
from your build dir, and install to your target install directory.
|
||||
|
||||
```shell
|
||||
cmake --build . --config Release
|
||||
|
||||
# Optionally install the binaries to the installation directory
|
||||
cmake --install . --config Release
|
||||
```
|
||||
|
||||
## Advanced build options
|
||||
|
||||
For codec developers and power users there are a number of useful features in
|
||||
the build system.
|
||||
|
||||
### Build Types
|
||||
|
||||
We support and test the following `CMAKE_BUILD_TYPE` options.
|
||||
|
||||
| Value | Description |
|
||||
| ---------------- | -------------------------------------------------------- |
|
||||
| Release | Optimized release build |
|
||||
| RelWithDebInfo | Optimized release build with debug info |
|
||||
| Debug | Unoptimized debug build with debug info |
|
||||
|
||||
Note that optimized release builds are compiled with link-time optimization,
|
||||
which can make profiling more challenging ...
|
||||
|
||||
### Shared Libraries
|
||||
|
||||
We support building the core library as a shared object by setting the CMake
|
||||
option `-DASTCENC_SHAREDLIB=ON` at configure time. For macOS build targets the
|
||||
shared library supports the same universal build configuration as the command
|
||||
line utility.
|
||||
|
||||
Note that the command line tool is always statically linked; the shared objects
|
||||
are an extra build output that are not currently used by the command line tool.
|
||||
|
||||
### Constrained block size builds
|
||||
|
||||
All normal builds will support all ASTC block sizes, including the worst case
|
||||
6x6x6 3D block size (216 texels per block). Compressor memory footprint and
|
||||
performance can be improved by limiting the block sizes supported in the build
|
||||
by adding `-DASTCENC_BLOCK_MAX_TEXELS=<texel_count>` to to CMake command line
|
||||
when configuring. Legal block sizes that are unavailable in a restricted build
|
||||
will return the error `ASTCENC_ERR_NOT_IMPLEMENTED` during context creation.
|
||||
|
||||
### Non-invariant builds
|
||||
|
||||
All normal builds are designed to be invariant, so any build from the same git
|
||||
revision will produce bit-identical results for all compilers and CPU
|
||||
architectures. To achieve this we sacrifice some performance, so if this is
|
||||
not required you can specify `-DASTCENC_INVARIANCE=OFF` to enable additional
|
||||
optimizations. This has most benefit for AVX2 builds where we are able to
|
||||
enable use of the FMA instruction set extensions.
|
||||
|
||||
### No intrinsics builds
|
||||
|
||||
All normal builds will use SIMD accelerated code paths using intrinsics, as all
|
||||
supported target architectures (x86 and arm64) guarantee SIMD availability. For
|
||||
development purposes it is possible to build an intrinsic-free build which uses
|
||||
no explicit SIMD acceleration (the compiler may still auto-vectorize).
|
||||
|
||||
To enable this binary variant add `-DASTCENC_ISA_NONE=ON` to the CMake command
|
||||
line when configuring. It is NOT recommended to use this for production; it is
|
||||
significantly slower than the vectorized SIMD builds.
|
||||
|
||||
### No x86 gather instruction builds
|
||||
|
||||
On many x86 microarchitectures the native AVX gather instructions are slower
|
||||
than simply performing manual scalar loads and combining the results. Gathers
|
||||
are enabled by default, but can be disabled by setting the CMake option
|
||||
`-DASTCENC_X86_GATHERS=OFF` on the command line when configuring.
|
||||
|
||||
Note that we have seen mixed results when compiling the scalar fallback path,
|
||||
so we would recommend testing which option works best for the compiler and
|
||||
microarchitecture pairing that you are targeting.
|
||||
|
||||
### Test builds
|
||||
|
||||
We support building unit tests. These use the `googletest` framework, which is
|
||||
pulled in though a git submodule. On first use, you must fetch the submodule
|
||||
dependency:
|
||||
|
||||
```shell
|
||||
git submodule init
|
||||
git submodule update
|
||||
```
|
||||
|
||||
To build unit tests add `-DASTCENC_UNITTEST=ON` to the CMake command line when
|
||||
configuring.
|
||||
|
||||
To run unit tests use the CMake `ctest` utility from your build directory after
|
||||
you have built the tests.
|
||||
|
||||
```shell
|
||||
cd build
|
||||
ctest --verbose
|
||||
```
|
||||
|
||||
### Sanitizer builds
|
||||
|
||||
We support building with sanitizers on Linux and macOS when using Clang.
|
||||
|
||||
To build binaries with ASAN checking enabled add `-DASTCENC_ASAN=ON` to the
|
||||
CMake command line when configuring.
|
||||
|
||||
To build binaries with UBSAN checking enabled add `-DASTCENC_UBSAN=ON` to the
|
||||
CMake command line when configuring.
|
||||
|
||||
### Android builds
|
||||
|
||||
Builds of the command line utility for Android are not officially supported, but can be a useful
|
||||
development build for testing on e.g. different Arm CPU microarchitectures.
|
||||
|
||||
The build script below shows one possible route to building the command line tool for Android. Once
|
||||
built the application can be pushed to e.g. `/data/local/tmp` and executed from an Android shell
|
||||
terminal over `adb`.
|
||||
|
||||
```shell
|
||||
ANDROID_ABI=arm64-v8a
|
||||
ANDROID_NDK=/work/tools/android/ndk/22.1.7171670
|
||||
|
||||
BUILD_TYPE=RelWithDebInfo
|
||||
|
||||
BUILD_DIR=build
|
||||
|
||||
mkdir -p ${BUILD_DIR}
|
||||
cd ${BUILD_DIR}
|
||||
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=./ \
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
|
||||
-DANDROID_ABI=${ANDROID_ABI} \
|
||||
-DANDROID_ARM_NEON=ON \
|
||||
-DANDROID_PLATFORM=android-21 \
|
||||
-DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang \
|
||||
-DANDROID_TOOLCHAIN=clang \
|
||||
-DANDROID_STL=c++_static \
|
||||
-DARCH=aarch64 \
|
||||
-DASTCENC_ISA_NEON=ON \
|
||||
..
|
||||
|
||||
make -j16
|
||||
```
|
||||
|
||||
## Packaging a release bundle
|
||||
|
||||
We support building a release bundle of all enabled binary configurations in
|
||||
the current CMake configuration using the `package` build target
|
||||
|
||||
Configure CMake with:
|
||||
|
||||
* `-DASTCENC_PACAKGE=<arch>` to set the package architecture/variant name used
|
||||
to name the package archive (not set by default).
|
||||
|
||||
```shell
|
||||
# Run a build and package build outputs in `./astcenc-<ver>-<os>-<arch>.<fmt>`
|
||||
cd build
|
||||
make package -j16
|
||||
```
|
||||
|
||||
Windows packages will use the `.zip` format, other packages will use the
|
||||
`.tar.gz` format.
|
||||
|
||||
## Integrating as a library into another project
|
||||
|
||||
The core codec of `astcenc` is built as a library, and so can be easily
|
||||
integrated into other projects using CMake. An example of the CMake integration
|
||||
and the codec API usage can be found in the `./Utils/Example` directory in the
|
||||
repository. See the [Example Readme](../Utils/Example/README.md) for more
|
||||
details.
|
||||
|
||||
- - -
|
||||
|
||||
_Copyright © 2019-2024, Arm Limited and contributors. All rights reserved._
|
||||
@@ -0,0 +1,328 @@
|
||||
# 2.x series change log
|
||||
|
||||
This page summarizes the major functional and performance changes in each
|
||||
release of the 2.x series.
|
||||
|
||||
All performance data on this page is measured on an Intel Core i5-9600K
|
||||
clocked at 4.2 GHz, running astcenc using 6 threads.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 2.5
|
||||
|
||||
**Status:** Released, March 2021
|
||||
|
||||
The 2.5 release is the last major release in the 2.x series. After this release
|
||||
a `2.x` branch will provide stable long-term support, and the `main` branch
|
||||
will switch to focusing on more radical changes for the 3.x series.
|
||||
|
||||
Reminder for users of the library interface - the API is not designed to be
|
||||
stable across versions, and this release is not compatible with earlier 2.x
|
||||
releases. Please update and rebuild your client-side code using the updated
|
||||
`astcenc.h` header.
|
||||
|
||||
**General:**
|
||||
* **Feature:** The `ISA_INVARIANCE` build option is no longer supported, as
|
||||
there is no longer any performance benefit from the variant paths. All
|
||||
builds are now using the equivalent of the `ISA_INVARIANCE=ON` setting, and
|
||||
all builds (except Armv7) are now believed to be invariant across operating
|
||||
systems, compilers, CPU architectures, and SIMD instruction sets.
|
||||
* **Feature:** Armv8 32-bit builds with NEON are now supported, with
|
||||
out-of-the-box support for Arm Linux soft-float and hard-float ABIs. There
|
||||
are no pre-built binaries for these targets; support is included for
|
||||
library users targeting older 32-bit Android and iOS devices.
|
||||
* **Feature:** A compressor mode for encoding HDR textures that have been
|
||||
encoded into LDR RGBM wrapper format is now supported. Note that this
|
||||
encoding has some strong recommendations for how the RGBM encoding is
|
||||
implemented to avoid block artifacts in the compressed image.
|
||||
* **Core API:**
|
||||
* **API Change:** The core API has been changed to be a pure C API, making it
|
||||
easier to wrap the codec in a stable shared library ABI. Some entry points
|
||||
that used to accept references now expect pointers.
|
||||
* **API Change:** The decompression functionality in the core API has been
|
||||
changed to allow use of multiple threads. The design pattern matches the
|
||||
compression functionality, requiring the caller to create the threads,
|
||||
synchronize them between images, and to call the new
|
||||
`astcenc_decompress_reset()` function between images.
|
||||
* **API Feature:** Defines to support exporting public API entry point
|
||||
symbols from a shared object are provided, but not exposed off-the-shelf by
|
||||
the CMake provided by the project.
|
||||
* **API Feature:** New `astcenc_get_block_info()` function added to the core
|
||||
API to allow users to perform high level analysis of compressed data. This
|
||||
API is not implemented in decompressor-only builds.
|
||||
* **API Feature:** Codec configuration structure has been extended to expose
|
||||
the new RGBM compression mode. See the API header for details.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 2.4
|
||||
|
||||
**Status:** Released, February 2021
|
||||
|
||||
The 2.4 release is the fifth release in the 2.x series. It is primarily a bug
|
||||
fix release for HDR image handling, which impacts all earlier 2.x series
|
||||
releases.
|
||||
|
||||
**General:**
|
||||
* **Feature:** When using the `-a` option, or the equivalent config option
|
||||
for the API, any 2D blocks that are entirely zero alpha after the alpha
|
||||
filter radius is taken into account are replaced by transparent black
|
||||
constant color blocks. This is an RDO-like technique to improve compression
|
||||
ratios of any additional application packaging compression that is applied.
|
||||
**Command Line:**
|
||||
* **Bug fix:** The command line wrapper now correctly loads HDR images that
|
||||
have a non-square aspect ratio.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 2.3
|
||||
|
||||
**Status:** Released, January 2021
|
||||
|
||||
The 2.3 release is the fourth release in the 2.x series. It includes a number
|
||||
of performance improvements and new features.
|
||||
|
||||
Reminder for users of the library interface - the API is not designed to be
|
||||
stable across versions, and this release is not compatible with 2.2. Please
|
||||
recompile your client-side code using the updated `astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** Decompressor-only builds of the codec are supported again.
|
||||
While this is primarily a feature for library users who want to shrink
|
||||
binary size, a variant command line tool `astcdec` can be built by
|
||||
specifying `DECOMPRESSOR=ON` on the CMake configure command line.
|
||||
* **Feature:** Diagnostic builds of the codec can now be built. These builds
|
||||
generate a JSON file containing a trace of the compressor execution.
|
||||
Diagnostic builds are only suitable for codec development; they are slower
|
||||
and JSON generation cannot be disabled. Build by setting `DIAGNOSTICS=ON`
|
||||
on the CMake configure command line.
|
||||
* **Feature:** Code compatibility improved with older versions of GCC,
|
||||
earliest compiler now tested is GCC 7.5 (was GCC 9.3).
|
||||
* **Feature:** Code compatibility improved with newer versions of LLVM,
|
||||
latest compiler now tested is Clang 12.0 (was Clang 9.0).
|
||||
* **Feature:** Code compatibility improved with the Visual Studio 2019 LLVM
|
||||
toolset (`clang-cl`). Using the LLVM toolset gives 25% performance
|
||||
improvements and is recommended.
|
||||
* **Command Line:**
|
||||
* **Feature:** Quality level now accepts either a preset (`-fast`, etc) or a
|
||||
float value between 0 and 100, allowing more control over the compression
|
||||
quality vs performance trade-off. The presets are not evenly spaced in the
|
||||
float range; they have been spaced to give the best distribution of points
|
||||
between the fast and thorough presets.
|
||||
* `-fastest`: 0.0
|
||||
* `-fast`: 10.0
|
||||
* `-medium`: 60.0
|
||||
* `-thorough`: 98.0
|
||||
* `-exhaustive`: 100.0
|
||||
* **Core API:**
|
||||
* **API Change:** Quality level preset enum replaced with a float value
|
||||
between 0 (`-fastest`) and 100 (`-exhaustive`). See above for more info.
|
||||
|
||||
### Performance
|
||||
|
||||
This release includes a number of optimizations to improve performance.
|
||||
|
||||
* New compressor algorithm for handling encoding candidates and refinement.
|
||||
* Vectorized implementation of `compute_error_of_weight_set()`.
|
||||
* Unrolled implementation of `encode_ise()`.
|
||||
* Many other small improvements!
|
||||
|
||||
The most significant change is the change to the compressor path, which now
|
||||
uses an adaptive approach to candidate trials and block refinement.
|
||||
|
||||
In earlier releases the quality level will determine the number of encoding
|
||||
candidates and the number of iterative refinement passes that are used for each
|
||||
major encoding trial. This is a fixed behavior; it will always try the full N
|
||||
candidates and M refinement iterations specified by the quality level for each
|
||||
encoding trial.
|
||||
|
||||
The new approach implements two optimizations for this:
|
||||
|
||||
* Compression will complete when a block candidate hits the specified target
|
||||
quality, after its M refinement iterations have been applied. Later block
|
||||
candidates are simply abandoned.
|
||||
* Block candidates will predict how much refinement can improve them, and
|
||||
abandon refinement if they are unlikely to improve upon the best known
|
||||
encoding already in-hand.
|
||||
|
||||
This pair of optimizations provides significant performance improvement to the
|
||||
high quality modes which use the most block candidates and refinement
|
||||
iterations. A minor loss of image quality is expected, as the blocks we no
|
||||
longer test or refine may have been better coding choices.
|
||||
|
||||
**Absolute performance vs 2.2 release:**
|
||||
|
||||

|
||||
|
||||
**Relative performance vs 2.2 release:**
|
||||
|
||||

|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 2.2
|
||||
|
||||
**Status:** Released, January 2021
|
||||
|
||||
The 2.2 release is the third release in the 2.x series. It includes a number
|
||||
of performance improvements and new features.
|
||||
|
||||
Reminder for users of the library interface - the API is not designed to be
|
||||
stable across versions, and this release is not compatible with 2.1. Please
|
||||
recompile your client-side code using the updated `astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** New Arm aarch64 NEON accelerated vector library support.
|
||||
* **Improvement:** New CMake build system for all platforms.
|
||||
* **Improvement:** SSE4.2 feature profile changed to SSE4.1, which more
|
||||
accurately reflects the feature set used.
|
||||
* **Binary releases:**
|
||||
* **Improvement:** Linux binaries changed to use Clang 9.0, which gives
|
||||
up to 15% performance improvement.
|
||||
* **Improvement:** Windows binaries are now code signed.
|
||||
* **Improvement:** macOS binaries for Apple silicon platforms now provided.
|
||||
* **Improvement:** macOS binaries are now code signed and notarized.
|
||||
* **Command Line:**
|
||||
* **Feature:** New image preprocess `-pp-normalize` option added. This forces
|
||||
normal vectors to be unit length, which is useful when compressing source
|
||||
textures that use normal length to encode an NDF, which is incompatible
|
||||
with ASTC's two channel encoding.
|
||||
* **Feature:** New image preprocess `-pp-premultiply` option added. This
|
||||
scales RGB values by the alpha value. This can be useful to minimize
|
||||
cross-channel color bleed caused by GPU post-multiply filtering/blending.
|
||||
* **Improvements:** Command line tool cleanly traps and reports errors for
|
||||
corrupt input images rather than relying on standard library `assert()`
|
||||
calls in release builds.
|
||||
* **Core API:**
|
||||
* **API Change:** Images using region-based metrics no longer need to include
|
||||
padding; all input images should be tightly packed and `dim_pad` is removed
|
||||
from the `astcenc_image` structure. This makes it easier to directly use
|
||||
images loaded from other libraries.
|
||||
* **API Change:** Image `data` is no longer a 3D array accessed using
|
||||
`data[z][y][x]` indexing, it's an array of 2D slices. This makes it easier
|
||||
to directly use images loaded from other libraries.
|
||||
* **API Change:** New `ASTCENC_FLG_SELF_DECOMPRESS_ONLY` flag added to the
|
||||
codec config. Using this flag enables additional optimizations that
|
||||
aggressively exploit implementation- and configuration-specific, behavior
|
||||
to gain performance. When using this flag the codec can only reliably
|
||||
decompress images that were compressed in the same context session. Images
|
||||
produced via other means may fail to decompress correctly, even if they are
|
||||
otherwise valid ASTC files.
|
||||
|
||||
### Performance
|
||||
|
||||
There is one major set of optimizations in this release, related to the new
|
||||
`ASTCENC_FLG_SELF_DECOMPRESS_ONLY` mode. These allow the compressor to only
|
||||
create data tables it knows that it is going to use, based on its current set
|
||||
of heuristics, rather than needing the full set the format allows.
|
||||
|
||||
The first benefit of these changes is a reduced context creation time, which
|
||||
can be reduced by up to 250ms on our test machine. This is a significant
|
||||
percentage of the command line utility runtime for a small image when using a
|
||||
quick search preset. Compressing the whole Kodak test suite using the command
|
||||
line utility and the `-fastest` preset is ~30% faster with this release, which
|
||||
is mostly due to faster startup.
|
||||
|
||||
The reduction in the data table size in this mode also improve the core codec
|
||||
speed. Our test sets show an average of 12% improvement in the codec for
|
||||
`-fastest` mode, and an average of 3% for `-medium` mode.
|
||||
|
||||
Key for performance charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Absolute performance vs 2.1 release:**
|
||||
|
||||

|
||||
|
||||
**Relative performance vs 2.1 release:**
|
||||
|
||||

|
||||
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 2.1
|
||||
|
||||
**Status:** Released, November 2020
|
||||
|
||||
The 2.1 release is the second release in the 2.x series. It includes a number
|
||||
of performance optimizations and new features.
|
||||
|
||||
Reminder for users of the library interface - the API is not designed to be
|
||||
stable across versions, and this release is not compatible with 2.0. Please
|
||||
recompile your client-side code using the updated `astcenc.h` header.
|
||||
|
||||
### Features:
|
||||
|
||||
* **Command line:**
|
||||
* **Bug fix:** The meaning of the `-tH\cH\dH` and `-th\ch\dh` compression
|
||||
modes was inverted. They now match the documentation; use `-*H` for HDR
|
||||
RGBA, and `-*h` for HDR RGB with LDR alpha.
|
||||
* **Feature:** A new `-fastest` quality preset is now available. This is
|
||||
designed for fast "roughing out" of new content, and sacrifices significant
|
||||
image quality compared to `-fast`. We do not recommend its use for
|
||||
production builds.
|
||||
* **Feature:** A new `-candidatelimit` compression tuning option is now
|
||||
available. This is a power-user control to determine how many candidates
|
||||
are returned for each block mode encoding trial. This feature is used
|
||||
automatically by the search presets; see `-help` for details.
|
||||
* **Improvement:** The compression test modes (`-tl\ts\th\tH`) now emit a
|
||||
MTex/s performance metric, in addition to coding time.
|
||||
* **Core API:**
|
||||
* **Feature:** A new quality preset `ASTCENC_PRE_FASTEST` is available. See
|
||||
`-fastest` above for details.
|
||||
* **Feature:** A new tuning option `tune_candidate_limit` is available in
|
||||
the config structure. See `-candidatelimit` above for details.
|
||||
* **Feature:** Image input/output can now use `ASTCENC_TYPE_F32` data types.
|
||||
* **Stability:**
|
||||
* **Feature:** The SSE2, SSE4.2, and AVX2 variants now produce identical
|
||||
compressed output when run on the same CPU when compiled with the
|
||||
preprocessor define `ASTCENC_ISA_INVARIANCE=1`. For Make builds this can
|
||||
be set on the command line by setting `ISA_INV=1`. ISA invariance is off
|
||||
by default; it reduces performance by 1-3%.
|
||||
|
||||
### Performance
|
||||
|
||||
Key for performance charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Absolute performance vs 2.0 release:**
|
||||
|
||||

|
||||
|
||||
**Relative performance vs 2.0 release:**
|
||||
|
||||

|
||||
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 2.0
|
||||
|
||||
**Status:** Released, August 2020
|
||||
|
||||
The 2.0 release is first release in the 2.x series. It includes a number of
|
||||
major changes over the earlier 1.7 series, and is not command-line compatible.
|
||||
|
||||
### Features:
|
||||
|
||||
* The core codec can be built as a library, exposed via a new codec API.
|
||||
* The core codec supports accelerated SIMD paths for SSE2, SSE4.2, and AVX2.
|
||||
* The command line syntax has a clearer mapping to Khronos feature profiles.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for performance charts
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Absolute performance vs 1.7 release:**
|
||||
|
||||

|
||||
|
||||
**Relative performance vs 1.7 release:**
|
||||
|
||||

|
||||
|
||||
- - -
|
||||
|
||||
_Copyright © 2020-2022, Arm Limited and contributors. All rights reserved._
|
||||
@@ -0,0 +1,308 @@
|
||||
# 3.x series change log
|
||||
|
||||
This page summarizes the major functional and performance changes in each
|
||||
release of the 3.x series.
|
||||
|
||||
All performance data on this page is measured on an Intel Core i5-9600K
|
||||
clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 3.7
|
||||
|
||||
**Status:** April 2022
|
||||
|
||||
The 3.7 release contains another round of performance optimizations, including
|
||||
significant improvements to the command line front-end (faster PNG loader) and
|
||||
the arm64 build of the codec (faster NEON implementation).
|
||||
|
||||
* **General:**
|
||||
* **Feature:** The command line tool PNG loader has been switched to use
|
||||
the Wuffs library, which is robust and significantly faster than the
|
||||
current stb_image implementation.
|
||||
* **Feature:** Support for non-invariant builds returns. Opt-in to slightly
|
||||
faster, but not bit-exact, builds by setting `-DNO_INVARIANCE=ON` for the
|
||||
CMake configuration. This improves performance by around 2%.
|
||||
* **Optimization:** Changed SIMD `select()` so that it matches the default
|
||||
NEON behavior (bitwise select), rather than the default x86-64 behavior
|
||||
(lane select on MSB). Specialization `select_msb()` added for the one case
|
||||
we want to select on a sign-bit, where NEON needs a different
|
||||
implementation. This provides a significant (>25%) performance uplift on
|
||||
NEON implementations.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 3.5 release:**
|
||||
|
||||

|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 3.6
|
||||
|
||||
**Status:** April 2022
|
||||
|
||||
The 3.6 release contains another round of performance optimizations.
|
||||
|
||||
There are no interface changes in this release, but in general the API is not
|
||||
designed to be binary compatible across versions. We always recommend
|
||||
rebuilding your client-side code using the updated `astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** Data tables are now optimized for contexts without the
|
||||
`SELF_DECOMPRESS_ONLY` flag set. The flag therefore no longer improves
|
||||
compression performance, but still reduces context creation time and
|
||||
context data table memory footprint.
|
||||
* **Feature:** Image quality for 4x4 `-fastest` configuration has been
|
||||
improved.
|
||||
* **Optimization:** Decimation modes are reliably excluded from processing
|
||||
when they are only partially selected in the compressor configuration (e.g.
|
||||
if used for single plane, but not dual plane modes). This is a significant
|
||||
performance optimization for all quality levels.
|
||||
* **Optimization:** Fast-path block load function variant added for 2D LDR
|
||||
images with no swizzle. This is a moderate performance optimization for the
|
||||
fast and fastest quality levels.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 3.5 release:**
|
||||
|
||||

|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 3.5
|
||||
|
||||
**Status:** March 2022
|
||||
|
||||
The 3.5 release contains another round of performance optimizations.
|
||||
|
||||
There are no interface changes in this release, but in general the API is not
|
||||
designed to be binary compatible across versions. We always recommend
|
||||
rebuilding your client-side code using the updated `astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** Compressor configurations using `SELF_DECOMPRESS_ONLY` mode
|
||||
store compacted partition tables, which significantly improves both
|
||||
context create time and runtime performance.
|
||||
* **Feature:** Bilinear infill for decimated weight grids supports a new
|
||||
variant for half-decimated grids which are only decimated in one axis.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 3.4 release:**
|
||||
|
||||

|
||||
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 3.4
|
||||
|
||||
**Status:** February 2022
|
||||
|
||||
The 3.4 release introduces another round of optimizations, removing a number
|
||||
of power-user configuration options to simplify the core compressor data path.
|
||||
|
||||
Reminder for users of the library interface - the API is not designed to be
|
||||
binary compatible across versions, and this release is not compatible with
|
||||
earlier releases. Please update and rebuild your client-side code using the
|
||||
updated `astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** Many memory allocations have been moved off the stack into
|
||||
dynamically allocated working memory. This significantly reduces the peak
|
||||
stack usage, allowing the compressor to run in systems with 128KB stack
|
||||
limits.
|
||||
* **Feature:** Builds now support `-DBLOCK_MAX_TEXELS=<count>` to allow a
|
||||
compressor to support a subset of block sizes. This can reduce binary size
|
||||
and runtime memory footprint, and improve performance.
|
||||
* **Feature:** The `-v` and `-va` options to set a per-texel error weight
|
||||
function are no longer supported.
|
||||
* **Feature:** The `-b` option to set a per-texel error weight boost for
|
||||
block border texels is no longer supported.
|
||||
* **Feature:** The `-a` option to set a per-texel error weight based on texel
|
||||
alpha value is no longer supported as an error weighting tool, but is still
|
||||
supported for providing sprite-sheet RDO.
|
||||
* **Feature:** The `-mask` option to set an error metric for mask map
|
||||
textures is still supported, but is currently a no-op in the compressor.
|
||||
* **Feature:** The `-perceptual` option to set a perceptual error metric is
|
||||
still supported, but is currently a no-op in the compressor for mask map
|
||||
and normal map textures.
|
||||
* **Bug-fix:** Corrected decompression of error blocks in some cases, so now
|
||||
returning the expected error color (magenta for LDR, NaN for HDR). Note
|
||||
that astcenc determines the error color to use based on the output image
|
||||
data type not the decoder profile.
|
||||
* **Binary releases:**
|
||||
* **Improvement:** Windows binaries changed to use ClangCL 12.0, which gives
|
||||
up to 10% performance improvement.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 3.3 release:**
|
||||
|
||||

|
||||
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 3.3
|
||||
|
||||
**Status:** November 2021
|
||||
|
||||
The 3.3 release improves image quality for normal maps, and two component
|
||||
textures. Normal maps are expected to compress 25% slower than the 3.2
|
||||
release, although it should be noted that they are still faster to compress
|
||||
in 3.3 than when using the 2.5 series. This release also fixes one reported
|
||||
stability issue.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** Normal map image quality has been improved.
|
||||
* **Feature:** Two component image quality has been improved, provided
|
||||
that unused components are correctly zero-weighted using e.g. `-cw` on the
|
||||
command line.
|
||||
* **Bug-fix:** Improved stability when trying to compress complex blocks that
|
||||
could not beat even the starting quality threshold. These will now always
|
||||
compress in to a constant color blocks.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 3.2
|
||||
|
||||
**Status:** August 2021
|
||||
|
||||
The 3.2 release is a bugfix release; no significant image quality or
|
||||
performance differences are expected.
|
||||
|
||||
* **General:**
|
||||
* **Bug-fix:** Improved stability when new contexts were created while other
|
||||
contexts were compressing or decompressing an image.
|
||||
* **Bug-fix:** Improved stability when decompressing blocks with invalid
|
||||
block encodings.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 3.1
|
||||
|
||||
**Status:** July 2021
|
||||
|
||||
The 3.1 release gives another performance boost, typically between 5 and 20%
|
||||
faster than the 3.0 release, as well as further incremental improvements to
|
||||
image quality. A number of build system improvements make astcenc easier and
|
||||
faster to integrate into other projects as a library, including support for
|
||||
building universal binaries on macOS. Full change list is shown below.
|
||||
|
||||
Reminder for users of the library interface - the API is not designed to be
|
||||
binary compatible across versions, and this release is not compatible with
|
||||
earlier releases. Please update and rebuild your client-side code using the
|
||||
updated `astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** RGB color data now supports `-perceptual` operation. The
|
||||
current implementation is simple, weighting color channel errors by their
|
||||
contribution to perceived luminance. This mimics the behavior of the human
|
||||
visual system, which is most sensitive to green, then red, then blue.
|
||||
* **Feature:** Codec supports a new low weight search mode, which is a
|
||||
simpler weight assignment for encodings with a low number of weights in the
|
||||
weight grid. The weight threshold can be overridden using the new
|
||||
`-lowweightmodelimit` command line option.
|
||||
* **Feature:** All platform builds now support building a native binary.
|
||||
Native binaries automatically select the SIMD level based on the default
|
||||
configuration of the compiler in use. Native binaries built on one machine
|
||||
may use different SIMD options than native binaries build on another.
|
||||
* **Feature:** macOS platform builds now support building universal binaries
|
||||
containing both `x86_64` and `arm64` target support.
|
||||
* **Feature:** Building the command line can be disabled when using as a
|
||||
library in another project. Set `-DCLI=OFF` during the CMake configure
|
||||
step.
|
||||
* **Feature:** A standalone minimal example of the core codec API usage has
|
||||
been added in the `./Utils/Example/` directory.
|
||||
* **Core API:**
|
||||
* **Feature:** Config flag `ASTCENC_FLG_USE_PERCEPTUAL` works for color data.
|
||||
* **Feature:** Config option `tune_low_weight_count_limit` added.
|
||||
* **Feature:** New heuristic added which prunes dual weight plane searches if
|
||||
they are unlikely to help. This heuristic is not user controllable.
|
||||
* **Feature:** Image quality has been improved. In general we see significant
|
||||
improvements (up to 0.2dB) for high bitrate encodings (4x4, 5x4), and a
|
||||
smaller improvement (up to 0.1dB) for lower bitrate encodings.
|
||||
* **Bug fix:** Arm "none" SIMD builds could be invariant with other builds.
|
||||
This fix has also been back-ported to the 2.x LTS branch.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 3.0 release:**
|
||||
|
||||

|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 3.0
|
||||
|
||||
**Status:** June 2021
|
||||
|
||||
The 3.0 release is the first in a series of updates to the compressor that are
|
||||
making more radical changes than we felt we could make with the 2.x series.
|
||||
The primary goals of the 3.x series are to keep the image quality ~static or
|
||||
better compared to the 2.5 release, but continue to improve performance.
|
||||
|
||||
Reminder for users of the library interface - the API is not designed to be
|
||||
binary compatible across versions, and this release is not compatible with
|
||||
earlier releases. Please update and rebuild your client-side code using the
|
||||
updated `astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** The code has been significantly cleaned up, with improved
|
||||
comments, API documentation, function naming, and variable naming.
|
||||
* **Core API:**
|
||||
* **API Change:** The core APIs for `astcenc_compress_image()` and for
|
||||
`astcenc_decompress_image()` now accept swizzle structures by `const`
|
||||
pointer, instead of pass-by-value.
|
||||
* **API Change:** Calling the `astcenc_compress_reset()` and the
|
||||
`astcenc_decompress_reset()` functions between images is no longer required
|
||||
if the context was created for use by a single thread.
|
||||
* **Feature:** New heuristics have been added for controlling when to search
|
||||
beyond 2 partitions and 1 plane, and when to search beyond 3 partitions and
|
||||
1 plane. The previous `tune_partition_early_out_limit` config option has
|
||||
been removed, and replaced with two new options
|
||||
`tune_2_partition_early_out_limit_factor` and
|
||||
`tune_3_partition_early_out_limit_factor`. See command line help for more
|
||||
detailed documentation.
|
||||
* **Feature:** New heuristics have been added for controlling when to use
|
||||
dual weight planes. The previous `tune_two_plane_early_out_limit` has been
|
||||
renamed to`tune_2_plane_early_out_limit_correlation`. See command line help
|
||||
for more detailed documentation.
|
||||
* **Feature:** Support for using dual weight planes has been restricted to
|
||||
single partition blocks; it rarely helps blocks with 2 or more partitions
|
||||
and takes considerable compression search time.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 2.5 release:**
|
||||
|
||||

|
||||
|
||||
- - -
|
||||
|
||||
_Copyright © 2021-2022, Arm Limited and contributors. All rights reserved._
|
||||
@@ -0,0 +1,416 @@
|
||||
# 4.x series change log
|
||||
|
||||
This page summarizes the major functional and performance changes in each
|
||||
release of the 4.x series.
|
||||
|
||||
All performance data on this page is measured on an Intel Core i5-9600K
|
||||
clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.8.0
|
||||
|
||||
**Status:** May 2024
|
||||
|
||||
The 4.8.0 release is a minor maintenance release.
|
||||
|
||||
* **General:**
|
||||
* **Bug fix:** Native builds on macOS will now correctly build for arm64 when
|
||||
run outside of Rosetta on an Apple silicon device.
|
||||
* **Bug fix:** Multiple small improvements to remove use of undefined
|
||||
language behavior, to improve support for deployment using Emscripten.
|
||||
* **Feature:** Builds using Clang can now build with undefined behavior
|
||||
sanitizer by setting `-DASTCENC_UBSAN=ON` on the CMake configure line.
|
||||
* **Feature:** Updated to Wuffs library 0.3.4, which ignores tRNS alpha
|
||||
chunks for type 4 (LA) and 6 (RGBA) PNGs, to improve compatibility with
|
||||
libpng.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.7.0
|
||||
|
||||
**Status:** January 2024
|
||||
|
||||
The 4.7.0 release is a major maintenance release, fixing rounding behavior in
|
||||
the decompressor to match the Khronos specification. This fix includes the
|
||||
addition of explicit support for optimizing for `decode_unorm8` rounding.
|
||||
|
||||
Reminder - the codec library API is not designed to be binary compatible across
|
||||
versions. We always recommend rebuilding your client-side code using the
|
||||
updated `astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Bug fix:** sRGB LDR decompression now uses the correct endpoint expansion
|
||||
method to create the 16-bit RGB endpoint colors, and removes the previous
|
||||
correction code from the interpolation function. This bug could result in
|
||||
LSB bit flips relative to the standard specification.
|
||||
* **Bug fix:** Decompressing to an 8-bit per component output image now
|
||||
matches the `decode_unorm8` extension rounding rules. This bug could result
|
||||
in LSB bit flips relative to the standard specification.
|
||||
* **Bug fix:** Code now avoids using `alignas()` in the reference C
|
||||
implementation, as the default `alignas(16)` is narrower than the
|
||||
native minimum alignment requirement on some CPUs.
|
||||
* **Feature:** Library configuration supports a new flag,
|
||||
`ASTCENC_FLG_USE_DECODE_UNORM8`. This flag indicates that the image will be
|
||||
used with the `decode_unorm8` decode mode. When set during compression
|
||||
this allows the compressor to use the correct rounding when determining the
|
||||
best encoding.
|
||||
* **Feature:** Command line tool supports a new option, `-decode_unorm8`.
|
||||
This option indicates that the image will be used with the `decode_unorm8`
|
||||
decode mode. This option will automatically be set for decompression
|
||||
(`-d*`) and trial (`-t*`) tool operation if the decompressed output image
|
||||
is stored to an 8-bit per component file format. This option must be set
|
||||
manually for compression (`-c*`) tool operation, as the desired decode mode
|
||||
cannot be reliably determined.
|
||||
* **Feature:** Library configuration supports a new optional progress
|
||||
reporting callback to be specified. This is called during compression to
|
||||
to allow interactive tooling use cases to display incremental progress. The
|
||||
command line tool uses this feature to show compression progress unless
|
||||
`-silent` is used.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.6.1
|
||||
|
||||
**Status:** November 2023
|
||||
|
||||
The 4.6.1 release is a minor maintenance release to fix a scaling bug on
|
||||
large core count Windows systems.
|
||||
|
||||
* **General:**
|
||||
* **Optimization:** Windows builds of the `astcenc` command line tool can now
|
||||
use more than 64 cores on large core count systems. This change doubled
|
||||
command line performance for `-exhaustive` compression when testing on an
|
||||
96 core/192 thread system.
|
||||
* **Feature:** Windows Arm64 native builds of the `astcenc` command line tool
|
||||
are now included in the prebuilt release binaries.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.6.0
|
||||
|
||||
**Status:** November 2023
|
||||
|
||||
The 4.6.0 release retunes the compressor heuristics to give improvements to
|
||||
performance for trivial losses to image quality. It also includes some minor
|
||||
bug fixes and code quality improvements.
|
||||
|
||||
Reminder - the codec library API is not designed to be binary compatible across
|
||||
versions. We always recommend rebuilding your client-side code using the updated
|
||||
`astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Bug-fix:** Fixed context allocation for contexts allocated with the
|
||||
`ASTCENC_FLG_DECOMPRESS_ONLY` flag.
|
||||
* **Bug-fix:** Reduced use of `reinterpret_cast` in the core codec to
|
||||
avoid strict aliasing violations.
|
||||
* **Optimization:** `-medium` search quality no longer tests 4 partition
|
||||
encodings for block sizes between 25 and 83 texels (inclusive). This
|
||||
improves performance for a tiny drop in image quality.
|
||||
* **Optimization:** `-thorough` and higher search qualities no longer test the
|
||||
mode0 first search for block sizes between 25 and 83 texels (inclusive).
|
||||
This improves performance for a tiny drop in image quality.
|
||||
* **Optimization:** `TUNE_MAX_PARTITIONING_CANDIDATES` reduced from 32 to 8
|
||||
to reduce the size of stack allocated data structures. This causes a tiny
|
||||
drop in image quality for the `-verythorough` and `-exhaustive` presets.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.5.0
|
||||
|
||||
**Status:** June 2023
|
||||
|
||||
The 4.5.0 release is a maintenance release with small image quality
|
||||
improvements, and a number of build system quality of life improvements.
|
||||
|
||||
* **General:**
|
||||
* **Bug-fix:** Improved handling compiler arguments in CMake, including
|
||||
consistent use of MSVC-style command line arguments for ClangCL.
|
||||
* **Bug-fix:** Invariant Clang builds now use `-ffp-model=precise` with
|
||||
`-ffp-contract=off` which is needed to restore invariance due to recent
|
||||
changes in compiler defaults.
|
||||
* **Change:** macOS binary releases are now distributed as a single universal
|
||||
binary for all platforms.
|
||||
* **Change:** Windows binary releases are now compiled with VS2022.
|
||||
* **Change:** Invariant MSVC builds for VS2022 now use `/fp:precise` instead
|
||||
of `/fp:strict`, which is is now possible because precise no longer implies
|
||||
contraction. This should improve performance for MSVC builds.
|
||||
* **Change:** Non-invariant Clang builds now use `-ffp-model=precise` with
|
||||
`-ffp-contract=on`. This should improve performance on older Clang
|
||||
versions which defaulted to no contraction.
|
||||
* **Change:** Non-invariant MSVC builds for VS2022 now use `/fp:precise`
|
||||
with `/fp:contract`. This should improve performance for MSVC builds.
|
||||
* **Change:** CMake config variables now use an `ASTCENC_` prefix to add a
|
||||
namespace and group options when the library is used in a larger project.
|
||||
* **Change:** CMake config `ASTCENC_UNIVERSAL_BUILD` for building macOS
|
||||
universal binaries has been improved to include the `x86_64h` slice for
|
||||
AVX2 builds. Universal builds are now on by default for macOS, and always
|
||||
include NEON (arm64), SSE4.1 (x86_64), and AVX2 (x86_64h) variants.
|
||||
* **Change:** CMake config `ASTCENC_NO_INVARIANCE` has been inverted to
|
||||
remove the negated option, and is now `ASTCENC_INVARIANCE` with a default
|
||||
of `ON`. Disabling this option can substantially improve performance, but
|
||||
images can different across platforms and compilers.
|
||||
* **Optimization:** Color quantization and packing for LDR RGB and RGBA has
|
||||
been vectorized to improve performance.
|
||||
* **Change:** Color quantization for LDR RGB and RGBA endpoints will now try
|
||||
multiple quantization packing methods, and pick the one with the lowest
|
||||
endpoint encoding error. This gives a minor image quality improvement, for
|
||||
no significant performance impact when combined with the vectorization
|
||||
optimizations.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.4.0
|
||||
|
||||
**Status:** March 2023
|
||||
|
||||
The 4.4.0 release is a minor release with image quality improvements, a small
|
||||
performance boost, and a few new quality-of-life features.
|
||||
|
||||
* **General:**
|
||||
* **Change:** Core library no longer checks availability of required
|
||||
instruction set extensions, such as SSE4.1 or AVX2. Checking compatibility
|
||||
is now the responsibility of the caller. See `astcenccli_entry.cpp` for
|
||||
an example of code performing this check.
|
||||
* **Change:** Core library can be built as a shared object by setting the
|
||||
`-DSHAREDLIB=ON` CMake option, resulting in e.g. `libastcenc-avx2-shared.so`.
|
||||
Note that the command line tool is always statically linked.
|
||||
* **Change:** Decompressed 3D images will now write one output file per
|
||||
slice, if the target format is a 2D image format.
|
||||
* **Change:** Command line errors print to stderr instead of stdout.
|
||||
* **Change:** Color encoding uses new quantization tables, that now factor
|
||||
in floating-point rounding if a distance tie is found when using the
|
||||
integer quant256 value. This improves image quality for 4x4 and 5x5 block
|
||||
sizes.
|
||||
* **Optimization:** Partition selection uses a simplified line calculation
|
||||
with a faster approximation. This improves performance for all block sizes.
|
||||
* **Bug-fix:** Fixed missing symbol error in decompressor-only builds.
|
||||
* **Bug-fix:** Fixed infinity handling in debug trace JSON files.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 4.3 release:**
|
||||
|
||||

|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.3.1
|
||||
|
||||
**Status:** January 2023
|
||||
|
||||
The 4.3.1 release is a minor maintenance release. No performance or image
|
||||
quality changes are expected.
|
||||
|
||||
* **General:**
|
||||
* **Bug-fix:** Fixed typo in `-2/3/4partitioncandidatelimit` CLI options.
|
||||
* **Bug-fix:** Fixed handling for `-3/4partitionindexlimit` CLI options.
|
||||
* **Bug-fix:** Updated to `stb_image.h` v2.28, which includes multiple fixes
|
||||
and improvements for image loading.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.3.0
|
||||
|
||||
**Status:** January 2023
|
||||
|
||||
The 4.3.0 release is an optimization release. There are minor performance
|
||||
and image quality improvements in this release.
|
||||
|
||||
Reminder - the codec library API is not designed to be binary compatible across
|
||||
versions. We always recommend rebuilding your client-side code using the updated
|
||||
`astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Bug-fix:** Use lower case `windows.h` include for MinGW compatibility.
|
||||
* **Change:** The `-mask` command line option, `ASTCENC_FLG_MAP_MASK` in the
|
||||
library API, has been removed.
|
||||
* **Optimization:** Always skip blue-contraction for `QUANT_256` encodings.
|
||||
This gives a small image quality improvement for the 4x4 block size.
|
||||
* **Optimization:** Always skip RGBO vector calculation for LDR encodings.
|
||||
* **Optimization:** Defer color packing and scrambling to physical layer.
|
||||
* **Optimization:** Remove folded `decimation_info` lookup tables. This
|
||||
significantly reduces compressor memory footprint and improves context
|
||||
creation time. Impact increases with the active block size.
|
||||
* **Optimization:** Increased trial and refinement pruning by using stricter
|
||||
target errors when determining whether to skip iterations.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 4.2 release:**
|
||||
|
||||

|
||||
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.2.0
|
||||
|
||||
**Status:** November 2022
|
||||
|
||||
The 4.2.0 release is an optimization release. There are significant performance
|
||||
improvements, minor image quality improvements, and library interface changes in
|
||||
this release.
|
||||
|
||||
Reminder - the codec library API is not designed to be binary compatible across
|
||||
versions. We always recommend rebuilding your client-side code using the updated
|
||||
`astcenc.h` header.
|
||||
|
||||
* **General:**
|
||||
* **Bug-fix:** Compression for RGB and RGBA base+offset encodings no
|
||||
longer generate endpoints with the incorrect blue-contract behavior.
|
||||
* **Bug-fix:** Lowest channel correlation calculation now correctly ignores
|
||||
constant color channels for the purposes of filtering 2 plane encodings.
|
||||
On average this improves both performance and image quality.
|
||||
* **Bug-fix:** ISA compatibility now checked in `config_init()` as well as
|
||||
in `context_alloc()`.
|
||||
* **Change:** Removed the low-weight count optimization, as more recent
|
||||
changes had significantly reduced its performance benefit. Option removed
|
||||
from both command line and configuration structure.
|
||||
* **Feature:** The `-exhaustive` mode now runs full trials on more
|
||||
partitioning candidates and block candidates. This improves image quality
|
||||
by 0.1 to 0.25 dB, but slows down compression by 3x. The `-verythorough`
|
||||
and `-thorough` modes also test more candidates.
|
||||
* **Feature:** A new preset, `-verythorough`, has been introduced to provide
|
||||
a standard performance point between `-thorough` and the re-tuned
|
||||
`-exhaustive` mode. This new mode is faster and higher quality than the
|
||||
`-exhaustive` preset in the 4.1 release.
|
||||
* **Feature:** The compressor can now independently vary the number of
|
||||
partitionings considered for error estimation for 2/3/4 partitions. This
|
||||
allows heuristics to put more effort into 2 partitions, and less in to
|
||||
3/4 partitions.
|
||||
* **Feature:** The compressor can now run trials on a variable number of
|
||||
candidate partitionings, allowing high quality modes to explore more of the
|
||||
search space at the expense of slower compression. The number of trials is
|
||||
independently configurable for 2/3/4 partition cases.
|
||||
* **Optimization:** Introduce early-out threshold for 2/3/4 partition
|
||||
searches based on the results after 1 of 2 trials. This significantly
|
||||
improves performance for `-medium` and `-thorough` searches, for a minor
|
||||
loss in image quality.
|
||||
* **Optimization:** Reduce early-out threshold for 3/4 partition searches
|
||||
based on 2/3 partition results. This significantly improves performance,
|
||||
especially for `-thorough` searches, for a minor loss in image quality.
|
||||
* **Optimization:** Use direct vector compare to create a SIMD mask instead
|
||||
of a scalar compare that is broadcast to a vector mask.
|
||||
* **Optimization:** Remove obsolete partition validity masks from the
|
||||
partition selection algorithm.
|
||||
* **Optimization:** Removed obsolete channel scaling from partition
|
||||
`avgs_and_dirs()` calculation.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 4.0 and 4.1 release:**
|
||||
|
||||

|
||||
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.1.0
|
||||
|
||||
**Status:** August 2022
|
||||
|
||||
The 4.1.0 release is a maintenance release. There is no performance or image
|
||||
quality change in this release.
|
||||
|
||||
* **General:**
|
||||
* **Change:** Command line decompressor no longer uses the legacy
|
||||
`GL_LUMINANCE` or `GL_LUMINANCE_ALPHA` format enums when writing KTX
|
||||
output files. Luminance textures now use the `GL_RED` format and
|
||||
luminance_alpha textures now use the `GL_RG` format.
|
||||
* **Change:** Command line tool gains a new `-dimage` option to generate
|
||||
diagnostic images showing aspects of the compression encoding. The output
|
||||
file name with its extension stripped is used as the stem of the diagnostic
|
||||
image file names.
|
||||
* **Bug-fix:** Library decompressor builds for SSE no longer use masked store
|
||||
`maskmovdqu` instructions, as they can generate faults on masked lanes.
|
||||
* **Bug-fix:** Command line decompressor now correctly uses sized type enums
|
||||
for the internal format when writing output KTX files.
|
||||
* **Bug-fix:** Command line compressor now correctly loads 16 and 32-bit per
|
||||
component input KTX files.
|
||||
* **Bug-fix:** Fixed GCC9 compiler warnings on Arm aarch64.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 4.0.0
|
||||
|
||||
**Status:** July 2022
|
||||
|
||||
The 4.0.0 release introduces some major performance enhancement, and a number
|
||||
of larger changes to the heuristics used in the codec to find a more effective
|
||||
cost:quality trade off.
|
||||
|
||||
* **General:**
|
||||
* **Change:** The `-array` option for specifying the number of image planes
|
||||
for ASTC 3D volumetric block compression been renamed to `-zdim`.
|
||||
* **Change:** The build root package directory is now `bin` instead of
|
||||
`astcenc`, allowing the CMake install step to write binaries into
|
||||
`/usr/local/bin` if the user wishes to do so.
|
||||
* **Feature:** A new `-ssw` option for specifying the shader sampling swizzle
|
||||
has been added as convenience alternative to the `-cw` option. This is
|
||||
needed to correct error weighting during compression if not all components
|
||||
are read in the shader. For example, to extract and compress two components
|
||||
from an RGBA input image, weighting the two components equally when
|
||||
sampling through .ra in the shader, use `-esw ggga -ssw ra`. In this
|
||||
example `-ssw ra` is equivalent to the alternative `-cw 1 0 0 1` encoding.
|
||||
* **Feature:** The `-a` alpha weighting option has been re-enabled in the
|
||||
backend, and now again applies alpha scaling to the RGB error metrics when
|
||||
encoding. This is based on the maximum alpha in each block, not the
|
||||
individual texel alpha values used in the earlier implementation.
|
||||
* **Feature:** The command line tool now has `-repeats <count>` for testing,
|
||||
which will iterate around compression and decompression `count` times.
|
||||
Reported performance metrics also now separate compression and
|
||||
decompression scores.
|
||||
* **Feature:** The core codec is now warning clean up to /W4 for both MSVC
|
||||
`cl.exe` and `clangcl.exe` compilers.
|
||||
* **Feature:** The core codec now supports arm64 for both MSVC `cl.exe` and
|
||||
`clangcl.exe` compilers.
|
||||
* **Feature:** `NO_INVARIANCE` builds will enable the `-ffp-contract=fast`
|
||||
option for all targets when using Clang or GCC. In addition AVX2 targets
|
||||
will also set the `-mfma` option. This reduces image quality by up to 0.2dB
|
||||
(normally much less), but improves performance by up to 5-20%.
|
||||
* **Optimization:** Angular endpoint min/max weight selection is restricted
|
||||
to weight `QUANT_11` or lower. Higher quantization levels assume default
|
||||
0-1 range, which is less accurate but much faster.
|
||||
* **Optimization:** Maximum weight quantization for later trials is selected
|
||||
based on the weight quantization of the best encoding from the 1 plane 1
|
||||
partition trial. This significantly reduces the search space for the later
|
||||
trials with more planes or partitions.
|
||||
* **Optimization:** Small data tables now use in-register SIMD permutes
|
||||
rather than gathers (AVX2) or unrolled scalar lookups (SSE/NEON). This can
|
||||
be a significant optimization for paths that are load unit limited.
|
||||
* **Optimization:** Decompressed image block writes in the decompressor now
|
||||
use a vectorized approach to writing each row of texels in the block,
|
||||
including to ability to exploit masked stores if the target supports them.
|
||||
* **Optimization:** Weight scrambling has been moved into the physical layer;
|
||||
the rest of the codec now uses linear order weights.
|
||||
* **Optimization:** Weight packing has been moved into the physical layer;
|
||||
the rest of the codec now uses unpacked weights in the 0-64 range.
|
||||
* **Optimization:** Consistently vectorize the creation of unquantized weight
|
||||
grids when they are needed.
|
||||
* **Optimization:** Remove redundant per-decimation mode copies of endpoint
|
||||
and weight structures, which were really read-only duplicates.
|
||||
* **Optimization:** Early-out the same endpoint mode color calculation if it
|
||||
cannot be applied.
|
||||
* **Optimization:** Numerous type size reductions applied to arrays to reduce
|
||||
both context working buffer size usage and stack usage.
|
||||
|
||||
### Performance:
|
||||
|
||||
Key for charts:
|
||||
|
||||
* Color = block size (see legend).
|
||||
* Letter = image format (N = normal map, G = grayscale, L = LDR, H = HDR).
|
||||
|
||||
**Relative performance vs 3.7 release:**
|
||||
|
||||

|
||||
|
||||
|
||||
- - -
|
||||
|
||||
_Copyright © 2022-2024, Arm Limited and contributors. All rights reserved._
|
||||
@@ -0,0 +1,105 @@
|
||||
# 5.x series change log
|
||||
|
||||
This page summarizes the major functional and performance changes in each
|
||||
release of the 5.x series.
|
||||
|
||||
All performance data on this page is measured on an Intel Core i5-9600K
|
||||
clocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 5.3.0
|
||||
|
||||
**Status:** March 2025
|
||||
|
||||
The 5.3.0 release is a minor maintenance release.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** Reference C builds (`ASTCENC_ISA_NONE`) now support compiling
|
||||
for big-endian CPUs. Compile with `-DASTCENC_BIG_ENDIAN=ON` when compiling
|
||||
for a big-endian target; it is not auto-detected.
|
||||
* **Improvement:** Builds using GCC now specify `-flto=auto` to allow
|
||||
parallel link steps, and remove the log warnings about not setting a CPU
|
||||
count parameter value.
|
||||
* **Bug fix:** Builds using MSVC `cl.exe` that do not specify an explicit
|
||||
ISA using the preprocessor configuration defines will now correctly
|
||||
default to the SSE2 backend on x86-64 and the NEON backend on Arm64. Previously they would have defaulted to the reference C implementation,
|
||||
which is around 3.25 times slower.
|
||||
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 5.2.0
|
||||
|
||||
**Status:** February 2025
|
||||
|
||||
The 5.2.0 release is a minor maintenance release.
|
||||
|
||||
This release includes changes to the public interface in the `astcenc.h`
|
||||
header. We always recommend rebuilding your client-side code using the
|
||||
header from the same release to avoid compatibility issues.
|
||||
|
||||
* **General:**
|
||||
* **Change:** Changed sRGB alpha channel endpoint expansion to match the
|
||||
revised Khronos Data Format Specification (v1.4.0), which reverts an
|
||||
unintended specification change. Compared to previous releases, this change
|
||||
can cause LSB bit differences in the alpha channel of compressed images.
|
||||
* **Feature:** Arm64 builds for Linux added to the GitHub Actions builds, and
|
||||
Arm64 binaries for NEON, 128-bit SVE 128 and 256-bit SVE added to release
|
||||
builds.
|
||||
* **Feature:** Added a new codec API, `astcenc_compress_cancel()`, which can
|
||||
be used to cancel an in-flight compression. This is designed to help make
|
||||
it easier to integrate the codec into an interactive user interface that
|
||||
can respond to user events with low latency.
|
||||
* **Bug fix:** Removed incorrect `static` variable qualifier, which could
|
||||
result in an incorrect `tune_mse_overshoot` heuristic threshold being used
|
||||
if a user ran multiple concurrent compressions with different settings.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 5.1.0
|
||||
|
||||
**Status:** November 2024
|
||||
|
||||
The 5.1.0 release is an optimization release, giving moderate performance
|
||||
improvements on all platforms. There are no image quality differences.
|
||||
|
||||
* **General:**
|
||||
* **Feature:** Added a new CMake build option to control use of native
|
||||
gathers, as they can be slower than scalar loads on some common x86
|
||||
microarchitectures. Build with `-DASTCENC_X86_GATHERS=OFF` to disable use
|
||||
of native gathers in AVX2 builds.
|
||||
* **Optimization:** Added new `gather()` abstraction for gathers using byte
|
||||
indices, allowing implementations without gather hardware to skip the
|
||||
byte-to-int index conversion.
|
||||
* **Optimization:** Optimized `compute_lowest_and_highest_weight()` to
|
||||
pre-compute min/max outside of the main loop.
|
||||
* **Optimization:** Added improved intrinsics sequence for SSE and AVX2
|
||||
integer `hmin()` and `hmax()`.
|
||||
* **Optimization:** Added improved intrinsics sequence for `vint4(uint8_t*)`
|
||||
on systems implementing Arm SVE.
|
||||
|
||||
<!-- ---------------------------------------------------------------------- -->
|
||||
## 5.0.0
|
||||
|
||||
**Status:** November 2024
|
||||
|
||||
The 5.0.0 release is the first stable release in the 5.x series. The main new
|
||||
feature is support for the Arm Scalable Vector Extensions (SVE) SIMD instruction
|
||||
set.
|
||||
|
||||
* **General:**
|
||||
* **Bug fix:** Fixed incorrect return type in "None" vector library
|
||||
reference implementation.
|
||||
* **Bug fix:** Fixed sincos table index under/overflow.
|
||||
* **Feature:** Changed `ASTCENC_ISA_NATIVE` builds to use `-march=native` and
|
||||
`-mcpu=native`.
|
||||
* **Feature:** Added backend for Arm SVE fixed-width 256-bit builds. These
|
||||
can only run on hardware implementing 256-bit SVE.
|
||||
* **Feature:** Added backend for Arm SVE 128-bit builds. These are portable
|
||||
builds and can run on hardware implementing any SVE vector length, but the
|
||||
explicit SVE use is augmented NEON and will only use the bottom 128-bits of
|
||||
each SVE vector.
|
||||
* **Feature:** Optimized NEON mask `any()` and `all()` functions.
|
||||
* **Feature:** Migrated build and test to GitHub Actions pipelines.
|
||||
|
||||
- - -
|
||||
|
||||
_Copyright © 2022-2025, Arm Limited and contributors. All rights reserved._
|
||||
|
After Width: | Height: | Size: 111 KiB |
|
After Width: | Height: | Size: 148 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 149 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 126 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 108 KiB |
@@ -0,0 +1,235 @@
|
||||
# Effective ASTC Encoding
|
||||
|
||||
Most texture compression schemes encode a single color format at single
|
||||
bitrate, so there are relatively few configuration options available to content
|
||||
creators beyond selecting which compressed format to use.
|
||||
|
||||
ASTC on the other hand is an extremely flexible container format which can
|
||||
compress multiple color formats at multiple bit rates. Inevitably this
|
||||
flexibility gives rise to questions about how to best use ASTC to encode a
|
||||
specific color format, or what the equivalent settings are to get a close
|
||||
match to another compression format.
|
||||
|
||||
This page aims to give some guidelines, but note that they are only guidelines
|
||||
and are not exhaustive so please deviate from them as needed.
|
||||
|
||||
## Traditional format reference
|
||||
|
||||
The most commonly used non-ASTC compressed formats, their color format, and
|
||||
their compressed bitrate are shown in the table below.
|
||||
|
||||
| Name | Color Format | Bits/Pixel | Notes |
|
||||
| -------- | ------------ | ---------- | ---------------- |
|
||||
| BC1 | RGB+A | 4 | RGB565 + 1-bit A |
|
||||
| BC3 | RGB+A | 8 | BC1 RGB + BC4 A |
|
||||
| BC3nm | G+R | 8 | BC1 G + BC4 R |
|
||||
| BC4 | R | 4 | L8 |
|
||||
| BC5 | R+G | 8 | BC1 R + BC1 G |
|
||||
| BC6H | RGB (HDR) | 8 | |
|
||||
| BC7 | RGB / RGBA | 8 | |
|
||||
| EAC_R11 | R | 4 | R11 |
|
||||
| EAC_RG11 | RG | 8 | RG11 |
|
||||
| ETC1 | RGB | 4 | RGB565 |
|
||||
| ETC2 | RGB+A | 4 | RGB565 + 1-bit A |
|
||||
| ETC2+EAC | RGB+A | 8 | RGB565 + EAC A |
|
||||
| PVRTC | RGBA | 2 or 4 | |
|
||||
|
||||
**Note:** BC2 (RGB+A) is not included in the table because it's rarely used in
|
||||
practice due to poor quality alpha encoding; BC3 is nearly always used instead.
|
||||
|
||||
**Note:** Color representations shown with a `+` symbol indicate non-correlated
|
||||
compression groups; e.g. an `RGB + A` format compresses `RGB` and `A`
|
||||
independently and does not assume the two signals are correlated. This can be
|
||||
a strength (it improves quality when compressing non-correlated signals), but
|
||||
also a weakness (it reduces quality when compressing correlated signals).
|
||||
|
||||
# ASTC Format Mapping
|
||||
|
||||
The main question which arises with the mapping of another format on to ASTC
|
||||
is how to handle cases where the input isn't a 4 component RGBA input. ASTC is
|
||||
a container format which always decompresses in to a 4 component RGBA result.
|
||||
However, the internal compressed representation is very flexible and can store
|
||||
1-4 components as needed on a per-block basis.
|
||||
|
||||
To get the best quality for a given bitrate, or the lowest bitrate for a given
|
||||
quality, it is important that as few components as possible are stored in the
|
||||
internal representation to avoid wasting coding space.
|
||||
|
||||
Specific optimizations in the ASTC coding scheme exist for:
|
||||
|
||||
* Encoding the RGB components as a single luminance component, so only a single
|
||||
value needs to be stored in the coding instead of three.
|
||||
* Encoding the A component as a constant 1.0 value, so the coding doesn't
|
||||
actually need to store a per-pixel alpha value at all.
|
||||
|
||||
... so mapping your inputs given to the compressor to hit these paths is
|
||||
really important if you want to get the best output quality for your chosen
|
||||
bitrate.
|
||||
|
||||
## Encoding 1-4 component data
|
||||
|
||||
The table below shows the recommended component usage for data with different
|
||||
numbers of color components present in the data.
|
||||
|
||||
The coding swizzle should be applied when compressing an image. This can be
|
||||
handled by the compressor when reading an uncompressed input image by
|
||||
specifying the swizzle using the `-esw` command line option.
|
||||
|
||||
The sampling swizzle is what you should use in your shader programs to read
|
||||
the data from the compressed texture, assuming no additional API-level
|
||||
component swizzling is specified by the application.
|
||||
|
||||
| Input components | ASTC Endpoint | Coding Swizzle | Sampling Swizzle |
|
||||
| -------------- | ------------- | -------------- | ------------------ |
|
||||
| 1 | L + 1 | `rrr1` | `.g` <sup>1</sup> |
|
||||
| 2 | L + A | `rrrg` | `.ga` <sup>1</sup> |
|
||||
| 3 | RGB + 1 | `rgb1` | `.rgb` |
|
||||
| 4 | RGB + A | `rgba` | `.rgba` |
|
||||
|
||||
**1:** Sampling from `g` is preferred to sampling from `r` because it allows a
|
||||
single shader to be compatible with ASTC, BC1, or ETC formats. BC1 and ETC1
|
||||
store color endpoints as RGB565 data, so the `g` component will have higher
|
||||
precision. For ASTC it doesn't actually make any difference; the same single
|
||||
component luminance will be returned for all three of the `.rgb` components.
|
||||
|
||||
## Equivalence with other formats
|
||||
|
||||
Based on these component encoding requirements we can now derive the the ASTC
|
||||
coding equivalents for most of the other texture compression formats in common
|
||||
use today.
|
||||
|
||||
| Formant | ASTC Coding Swizzle | ASTC Sampling Swizzle | Notes |
|
||||
| -------- | ------------------- | --------------------- | ---------------- |
|
||||
| BC1 | `rgba` <sup>1</sup> | `.rgba` | |
|
||||
| BC3 | `rgba` | `.rgba` | |
|
||||
| BC3nm | `gggr` | `.ag` | |
|
||||
| BC4 | `rrr1` | `.r` | |
|
||||
| BC5 | `rrrg` | `.ra` <sup>2</sup> | |
|
||||
| BC6H | `rgb1` | `.rgb` <sup>3</sup> | HDR profile only |
|
||||
| BC7 | `rgba` | `.rgba` | |
|
||||
| EAC_R11 | `rrr1` | `.r` | |
|
||||
| EAC_RG11 | `rrrg` | `.ra` <sup>2</sup> | |
|
||||
| ETC1 | `rgb1` | `.rgb` | |
|
||||
| ETC2 | `rgba` <sup>1</sup> | `.rgba` | |
|
||||
| ETC2+EAC | `rgba` | `.rgba` | |
|
||||
| ETC2+EAC | `rgba` | `.rgba` | |
|
||||
|
||||
**1:** ASTC has no equivalent of the 1-bit punch-through alpha encoding
|
||||
supported by BC1 or ETC2; if alpha is present it will be a full alpha
|
||||
component.
|
||||
|
||||
**2:** ASTC relies on using the L+A color endpoint type for coding efficiency
|
||||
for two component data. It therefore has no direct equivalent of a two-plane
|
||||
format sampled though the `.rg` components such as BC5 or EAC_RG11. This can
|
||||
be emulated by setting texture component swizzles in the runtime API - e.g. via
|
||||
`glTexParameteri()` for OpenGL ES - although it has been noted that API
|
||||
controlled swizzles are not available in WebGL.
|
||||
|
||||
**3:** ASTC can only store unsigned values, and has no equivalent of the BC6
|
||||
signed endpoint mode.
|
||||
|
||||
# Other Considerations
|
||||
|
||||
This section outlines some of the other things to consider when encoding
|
||||
textures using ASTC.
|
||||
|
||||
## Decode mode extensions
|
||||
|
||||
ASTC is specified to decompress into a 16-bit per component RGBA output by
|
||||
default, with the exception of the sRGB format which uses an 8-bit value for the
|
||||
RGB components.
|
||||
|
||||
Decompressing in to a 16-bit per component output format is often higher than
|
||||
many use cases require, especially for LDR textures which originally came from
|
||||
an 8-bit per component source image. Most implementations of ASTC support the
|
||||
decode mode extensions, which allow an application to opt-in to a lower
|
||||
precision decompressed format (RGBA8 for LDR, RGB9E5 for HDR). Using these
|
||||
extensions can improve GPU texture cache efficiency, and even improve texturing
|
||||
filtering throughput, for use cases that do not need the higher precision.
|
||||
|
||||
The ASTC format uses different data rounding rules when the decode mode
|
||||
extensions are used. To ensure that the compressor chooses the best encodings
|
||||
for the RGBA8 rounding rules, you can specify `-decode_unorm8` when compressing
|
||||
textures that will be decompressed into the RGBA8 intermediate. This gives a
|
||||
small image quality boost.
|
||||
|
||||
**Note:** This mode is automatically enabled if you use the `astcenc`
|
||||
decompressor to write an 8-bit per component output image.
|
||||
|
||||
## Encoding non-correlated components
|
||||
|
||||
Most other texture compression formats have a static component assignment in
|
||||
terms of the expected data correlation. For example, ETC2+EAC assumes that RGB
|
||||
are always correlated and that alpha is non-correlated. ASTC can automatically
|
||||
encode data as either fully correlated across all 4 components, or with any one
|
||||
component assigned to a separate non-correlated partition to the other three.
|
||||
|
||||
The non-correlated component can be changed on a block-by-block basis, so the
|
||||
compressor can dynamically adjust the coding based on the data present in the
|
||||
image. This means that there is no need for non-correlated data to be stored
|
||||
in a specific component in the input image.
|
||||
|
||||
It is however worth noting that the alpha component is treated differently to
|
||||
the RGB color components in some circumstances:
|
||||
|
||||
* When coding for sRGB the alpha component will always be stored in linear
|
||||
space.
|
||||
* When coding for HDR the alpha component can optionally be kept as LDR data.
|
||||
|
||||
## Encoding normal maps
|
||||
|
||||
The best way to store normal maps using ASTC is similar to the scheme used by
|
||||
BC5; store the X and Y components of a unit-length normal. The Z component of
|
||||
the normal can be reconstructed in shader code based on the knowledge that the
|
||||
vector is unit length.
|
||||
|
||||
To encode this we need to store only two input components in the compressed
|
||||
data, and therefore use the `rrrg` coding swizzle to align the data with the
|
||||
ASTC luminance+alpha endpoint. We can sample this in shader code using the
|
||||
`.ga` sampling swizzle, and reconstruct the Z value with:
|
||||
|
||||
vec3 nml;
|
||||
nml.xy = texture(...).ga; // Load normals (range 0 to 1)
|
||||
nml.xy = nml.xy * 2.0 - 1.0; // Unpack normals (range -1 to +1)
|
||||
nml.z = sqrt(1 - dot(nml.xy, nml.xy)); // Compute Z, given unit length
|
||||
|
||||
The encoding swizzle and appropriate component weighting is enabled by using
|
||||
the `-normal` command line option. If you wish to use a different pair of
|
||||
components you can specify a custom swizzle after setting the `-normal`
|
||||
parameter. For example, to match BC5n component ordering use
|
||||
`-normal -esw gggr` for compression and `-normal -dsw arz1` for decompression.
|
||||
|
||||
## Encoding sRGB data
|
||||
|
||||
The ASTC LDR profile can compress sRGB encoded color, which is a more
|
||||
efficient use of bits than storing linear encoded color because the gamma
|
||||
corrected value distribution more closely matches human perception of
|
||||
luminance.
|
||||
|
||||
For color data it is nearly always a perceptual quality win to use sRGB input
|
||||
source textures that are then compressed using the ASTC sRGB compression mode
|
||||
(compress using the `-cs` command line option rather than the `-cl` command
|
||||
line option). Note that sRGB gamma correction is only applied to the RGB
|
||||
components during decode; the alpha component is always treated as linear
|
||||
encoded data.
|
||||
|
||||
*Important:* The uncompressed input texture provided on the command line must
|
||||
be stored in the sRGB color space for `-cs` to function correctly.
|
||||
|
||||
## Encoding HDR data
|
||||
|
||||
HDR data can be encoded just like LDR data, but with some caveats around
|
||||
handling the alpha component.
|
||||
|
||||
For many use cases the alpha component is an actual alpha opacity component and
|
||||
is therefore used for storing an LDR value between 0 and 1. For these cases use
|
||||
the `-ch` compressor option which will treat the RGB components as HDR, but the
|
||||
A component as LDR.
|
||||
|
||||
For other use cases the alpha component is simply a fourth data component which
|
||||
is also storing an HDR value. For these cases use the `-cH` compressor option
|
||||
which will treat all components as HDR data.
|
||||
|
||||
- - -
|
||||
|
||||
_Copyright © 2019-2024, Arm Limited and contributors. All rights reserved._
|
||||
@@ -0,0 +1,71 @@
|
||||
# The .astc File Format
|
||||
|
||||
The default file format for compressed textures generated by `astcenc`, as well
|
||||
as from many other ASTC compressors, is the `.astc` format. This is a very
|
||||
simple format consisting of a small header followed immediately by the binary
|
||||
payload for a single image surface.
|
||||
|
||||
Header
|
||||
======
|
||||
|
||||
The header is a fixed 16 byte structure, defined as storing only bytes to avoid
|
||||
any endianness issues or incur any padding overhead.
|
||||
|
||||
```
|
||||
struct astc_header
|
||||
{
|
||||
uint8_t magic[4];
|
||||
uint8_t block_x;
|
||||
uint8_t block_y;
|
||||
uint8_t block_z;
|
||||
uint8_t dim_x[3];
|
||||
uint8_t dim_y[3];
|
||||
uint8_t dim_z[3];
|
||||
};
|
||||
```
|
||||
|
||||
Magic number
|
||||
------------
|
||||
|
||||
The 4 byte magic number at the start of the file acts as a format identifier.
|
||||
|
||||
```
|
||||
magic[0] = 0x13;
|
||||
magic[1] = 0xAB;
|
||||
magic[2] = 0xA1;
|
||||
magic[3] = 0x5C;
|
||||
```
|
||||
|
||||
Block size
|
||||
----------
|
||||
|
||||
The `block_*` fields store the ASTC block dimensions in texels. For 2D images
|
||||
the Z dimension must be set to 1.
|
||||
|
||||
Image dimensions
|
||||
----------------
|
||||
|
||||
The `dim_*` fields store the image dimensions in texels. For 2D images the
|
||||
Z dimension must be set to 1.
|
||||
|
||||
Note that the image is not required to be an exact multiple of the compressed
|
||||
block size; the compressed data may include padding that is discarded during
|
||||
decompression.
|
||||
|
||||
Each dimension is a 24 bit unsigned value that is reconstructed from the stored
|
||||
byte values as:
|
||||
|
||||
```
|
||||
decoded_dim = dim[0] + (dim[1] << 8) + (dim[2] << 16);
|
||||
```
|
||||
|
||||
Binary payload
|
||||
==============
|
||||
|
||||
The binary payload is a byte stream that immediately follows the header. It
|
||||
contains 16 bytes per compressed block. The number of compressed blocks is
|
||||
determined from the header information.
|
||||
|
||||
- - -
|
||||
|
||||
_Copyright © 2020-2022, Arm Limited and contributors. All rights reserved._
|
||||
@@ -0,0 +1,488 @@
|
||||
# ASTC Format Overview
|
||||
|
||||
Adaptive Scalable Texture Compression (ASTC) is an advanced lossy texture
|
||||
compression technology developed by Arm and AMD. It has been adopted as an
|
||||
official Khronos extension to the OpenGL and OpenGL ES APIs, and as a standard
|
||||
optional feature for the Vulkan API.
|
||||
|
||||
ASTC offers a number of advantages over earlier texture compression formats:
|
||||
|
||||
* **Format flexibility:** ASTC supports compressing between 1 and 4 channels of
|
||||
data, including support for one non-correlated channel such as RGB+A
|
||||
(correlated RGB, non-correlated alpha).
|
||||
* **Bit rate flexibility:** ASTC supports compressing images with a fine
|
||||
grained choice of bit rates between 0.89 and 8 bits per texel (bpt). The bit
|
||||
rate choice is independent to the color format choice.
|
||||
* **Advanced format support:** ASTC supports compressing images in either low
|
||||
dynamic range (LDR), LDR sRGB, or high dynamic range (HDR) color spaces, as
|
||||
well as support for compressing 3D volumetric textures.
|
||||
* **Improved image quality:** Despite the high degree of format flexibility,
|
||||
ASTC manages to beat nearly all legacy texture compression formats -- such as
|
||||
ETC2, PVRCT, and the BC formats -- on image quality at equivalent bit
|
||||
rates.
|
||||
|
||||
This article explores the ASTC format, and how it manages to generate the
|
||||
flexibility and quality improvements that it achieves.
|
||||
|
||||
|
||||
Why ASTC?
|
||||
=========
|
||||
|
||||
Before the creation of ASTC, the format and bit rate coverage of the available
|
||||
formats was very sparse:
|
||||
|
||||

|
||||
|
||||
In reality the situation is even worse than this diagram shows, as many of
|
||||
these formats are proprietary or simply not available on some operating
|
||||
systems, so any single platform will have very limited compression choices.
|
||||
|
||||
For developers this situation makes developing content which is portable across
|
||||
multiple platforms a tricky proposition. It's almost certain that differently
|
||||
compressed assets will be needed for different platforms. Each asset pack would
|
||||
likely then need to use different levels of compression, and may even have to
|
||||
fall back to no compression for some assets on some platforms, which leaves
|
||||
either some image quality or some memory bandwidth efficiency untapped.
|
||||
|
||||
It was clear a better way was needed, so the Khronos group asked members to
|
||||
submit proposals for a new compression algorithm to be adopted in the same
|
||||
manner that the earlier ETC algorithm was adopted for OpenGL ES. ASTC was the
|
||||
result of this, and has been adopted as an official algorithm for OpenGL,
|
||||
OpenGL ES, and Vulkan.
|
||||
|
||||
|
||||
Format overview
|
||||
===============
|
||||
|
||||
Given the fragmentation issues with the existing compression formats, it should
|
||||
be no surprise that the high level design objectives for ASTC were to have
|
||||
something which could be used across the whole range of art assets found in
|
||||
modern content, and which allows artists to have more control over the quality
|
||||
to bit rate tradeoff.
|
||||
|
||||
There are quite a few technical components which make up the ASTC format, so
|
||||
before we dive into detail it will be useful to give an overview of how ASTC
|
||||
works at a higher level.
|
||||
|
||||
|
||||
Block compression
|
||||
-----------------
|
||||
|
||||
Compression formats for real-time graphics need the ability to quickly and
|
||||
efficiently make random samples into a texture. This places two technical
|
||||
requirements on any compression format:
|
||||
|
||||
* It must be possible to compute the address of data in memory given only a
|
||||
sample coordinate.
|
||||
* It must be possible to decompress random samples without decompressing too
|
||||
much surrounding data.
|
||||
|
||||
The standard solution for this used by all contemporary real-time formats,
|
||||
including ASTC, is to divide the image into fixed-size blocks of texels, each
|
||||
of which is compressed into a fixed number of output bits. This feature makes
|
||||
it possible to access texels quickly, in any order, and with a well-bounded
|
||||
decompression cost.
|
||||
|
||||
The 2D block footprints in ASTC range from 4x4 texels up to 12x12 texels, which
|
||||
all compress into 128-bit output blocks. By dividing 128 bits by the number of
|
||||
texels in the footprint, we derive the format bit rates which range from 8 bpt
|
||||
(`128/(4*4)`) down to 0.89 bpt (`128/(12*12)`).
|
||||
|
||||
|
||||
Color encoding
|
||||
--------------
|
||||
|
||||
ASTC uses gradients to assign the color values of each texel. Each compressed
|
||||
block stores the end-point colors for a gradient, and an interpolation weight
|
||||
for each texel which defines the texel's location along that gradient. During
|
||||
decompression the color value for each texel is generated by interpolating
|
||||
between the two end-point colors, based on the per-texel weight.
|
||||
|
||||

|
||||
|
||||
In many cases a block will contain a complex distribution of colors, for
|
||||
example a red ball sitting on green grass. In these scenarios a single color
|
||||
gradient will not be able to accurately represent all of the texels' values. To
|
||||
support this ASTC allows a block to define up to four distinct color gradients,
|
||||
known as partitions, and can assign each texel to a single partition. For our
|
||||
example we require two partitions, one for our ball texels and one for our
|
||||
grass texels.
|
||||
|
||||

|
||||
|
||||
Now that you know the high level operation of the format, we can dive into more
|
||||
detail.
|
||||
|
||||
|
||||
Integer encoding
|
||||
================
|
||||
|
||||
Initially the idea of fractional bits per texel sounds implausible, or even
|
||||
impossible, because we're so used to storing numbers as a whole number of bits.
|
||||
However, it's not quite as strange as it sounds. ASTC uses an encoding
|
||||
technique called Bounded Integer Sequence Encoding (BISE), which makes heavy
|
||||
use of storing numbers with a fractional number of bits to pack information
|
||||
more efficiently.
|
||||
|
||||
|
||||
Storing alphabets
|
||||
-----------------
|
||||
|
||||
Even though color and weight values per texel are notionally floating-point
|
||||
values, we have far too few bits available to directly store the actual values,
|
||||
so they must be quantized during compression to reduce the storage size. For
|
||||
example, if we have a floating-point weight for each texel in the range 0.0 to
|
||||
1.0 we could choose to quantize it to five values - 0.0, 0.25, 0.5, 0.75, and
|
||||
1.0 - which we can then represent in storage using the integer values 0 to 4.
|
||||
|
||||
In the general case we need to be able to efficiently store characters of an
|
||||
alphabet containing N symbols if we choose quantize to N levels. An N symbol
|
||||
alphabet contains `log2(N)` bits of information per character. If we have an
|
||||
alphabet of 5 possible symbols then each character contains ~2.32 bits of
|
||||
information, but simple binary storage would require us to round up to 3 bits.
|
||||
This wastes 22.3% of our storage capacity. The chart below shows the percentage
|
||||
of our bit-space wasted when using simple binary encoding to store an arbitrary
|
||||
N symbol alphabet:
|
||||
|
||||

|
||||
|
||||
... which shows for most alphabet sizes we waste a lot of our storage capacity
|
||||
when using an integer number of bits per character. Efficiency is of critical
|
||||
importance to a compression format, so this is something we needed to be able
|
||||
to improve.
|
||||
|
||||
**Note:** We could have chosen to round-up the quantization level to the next
|
||||
power of two, and at least use the bits we're spending. However, this forces
|
||||
the encoder to spend bits which could be used elsewhere for a bigger benefit,
|
||||
so it will reduce image quality and is a sub-optimal solution.
|
||||
|
||||
|
||||
Quints
|
||||
------
|
||||
|
||||
Instead of rounding up a 5 symbol alphabet - called a "quint" in BISE - to
|
||||
three bits, we could choose to instead pack three quint characters together.
|
||||
Three characters in a 5-symbol alphabet have 5<sup>3</sup> (125) combinations,
|
||||
and contain 6.97 bits of information. We can store this in 7 bits and have a
|
||||
storage waste of only 0.5%.
|
||||
|
||||
|
||||
Trits
|
||||
-----
|
||||
|
||||
We can similarly construct a 3-symbol alphabet - called a "trit" in BISE - and
|
||||
pack trit characters in groups of five. Each character group has 3<sup>5</sup>
|
||||
(243) combinations, and contains 7.92 bits of information. We can store this in
|
||||
8 bits and have a storage waste of only 1%.
|
||||
|
||||
|
||||
BISE
|
||||
----
|
||||
|
||||
The BISE encoding used by ASTC allows storage of character sequences using
|
||||
arbitrary alphabets of up to 256 symbols, encoding each alphabet size in the
|
||||
most space-efficient choice of bits, trits, and quints.
|
||||
|
||||
* Alphabets with up to (2<sup>n</sup> - 1) symbols can be encoded using n bits
|
||||
per character.
|
||||
* Alphabets with up (3 * 2<sup>n</sup> - 1) symbols can be encoded using n bits
|
||||
(m) and a trit (t) per character, and reconstructed using the equation
|
||||
(t * 2<sup>n</sup> + m).
|
||||
* Alphabets with up to (5 * 2<sup>n</sup> - 1) symbols can be encoded using n
|
||||
bits (m) and a quint (q) per character, and reconstructed using the equation
|
||||
(q * 2<sup>n</sup> + m).
|
||||
|
||||
When the number of characters in a sequence is not a multiple of three or five
|
||||
we need to avoid wasting storage at the end of the sequence, so we add another
|
||||
constraint on the encoding. If the last few values in the sequence to encode
|
||||
are zero, the last few bits in the encoded bit string must also be zero.
|
||||
Ideally, the number of non-zero bits should be easily calculated and not depend
|
||||
on the magnitudes of the previous encoded values. This is a little tricky to
|
||||
arrange during compression, but it is possible. This means that we do not need
|
||||
to store any padding after the end of the bit sequence, as we can safely assume
|
||||
that they are zero bits.
|
||||
|
||||
With this constraint in place - and by some smart packing the bits, trits, and
|
||||
quints - BISE encodes an string of S characters in an N symbol alphabet using a
|
||||
fixed number of bits:
|
||||
|
||||
* S values up to (2<sup>n</sup> - 1) uses (NS) bits.
|
||||
* S values up to (3 * 2<sup>n</sup> - 1) uses (NS + ceil(8S / 5)) bits.
|
||||
* S values up to (5 * 2<sup>n</sup> - 1) uses (NS + ceil(7S / 3)) bits.
|
||||
|
||||
... and the compressor will choose the one of these which produces the smallest
|
||||
storage for the alphabet size being stored; some will use binary, some will use
|
||||
bits and a trit, and some will use bits and a quint. If we compare the storage
|
||||
efficiency of BISE against simple binary for the range of possible alphabet
|
||||
sizes we might want to encode we can see that it is much more efficient.
|
||||
|
||||

|
||||
|
||||
|
||||
Block sizes
|
||||
===========
|
||||
|
||||
ASTC always compresses blocks of texels into 128-bit outputs, but allows the
|
||||
developer to select from a range of block sizes to enable a fine-grained
|
||||
tradeoff between image quality and size.
|
||||
|
||||
| Block footprint | Bits/texel | | Block footprint | Bits/texel |
|
||||
| --------------- | ---------- | --- | --------------- | ---------- |
|
||||
| 4x4 | 8.00 | | 10x5 | 2.56 |
|
||||
| 5x4 | 6.40 | | 10x6 | 2.13 |
|
||||
| 5x5 | 5.12 | | 8x8 | 2.00 |
|
||||
| 6x5 | 4.27 | | 10x8 | 1.60 |
|
||||
| 6x6 | 3.56 | | 10x10 | 1.28 |
|
||||
| 8x5 | 3.20 | | 12x10 | 1.07 |
|
||||
| 8x6 | 2.67 | | 12x12 | 0.89 |
|
||||
|
||||
|
||||
|
||||
Color endpoints
|
||||
===============
|
||||
|
||||
The color data for a block is encoded as a gradient between two color
|
||||
endpoints, with each texel selecting a position along that gradient which is
|
||||
then interpolated during decompression. ASTC supports 16 color endpoint
|
||||
encoding schemes, known as "endpoint modes". Options for endpoint modes
|
||||
include:
|
||||
|
||||
* Varying the number of color channels: e.g. luminance, luminance + alpha, rgb,
|
||||
and rgba.
|
||||
* Varying the encoding method: e.g. direct, base+offset, base+scale,
|
||||
quantization level.
|
||||
* Varying the data range: e.g. low dynamic range, or high dynamic range
|
||||
|
||||
The endpoint modes, and the endpoint color BISE quantization level, can be
|
||||
chosen on a per-block basis.
|
||||
|
||||
|
||||
Color partitions
|
||||
================
|
||||
|
||||
Colors within a block are often complex, and cannot be accurately captured by a
|
||||
single color gradient, as discussed earlier with our example of a red ball
|
||||
lying on green grass. ASTC allows up to four color gradients - known as
|
||||
"partitions" - to be assigned to a single block. Each texel is then assigned to
|
||||
a single partition for the purposes of decompression.
|
||||
|
||||
Rather then directly storing the partition assignment for each texel, which
|
||||
would need a lot of decompressor hardware to store it for all block sizes, we
|
||||
generate it procedurally. Each block only needs to store the partition index -
|
||||
which is the seed for the procedural generator - and the per texel assignment
|
||||
can then be generated on-the-fly during decompression. The image below shows
|
||||
the generated texel assignments for two (top), three (middle), and four
|
||||
(bottom) partitions for the 8x8 block size.
|
||||
|
||||

|
||||
|
||||
The number of partitions and the partition index can be chosen on a per-block
|
||||
basis, and a different color endpoint mode can be chosen per partition.
|
||||
|
||||
**Note:** ASTC uses a 10-bit seed to drive the partition assignments. The hash
|
||||
used will introduce horizontal bias in a third of the partitions, vertical bias
|
||||
in a third, and no bias in the rest. As they are procedurally generated not all
|
||||
of the partitions are useful, in particular with the smaller block sizes.
|
||||
|
||||
* Many partitions are duplicates.
|
||||
* Many partitions are degenerate (an N partition hash results in at least one
|
||||
partition assignment that contains no texels).
|
||||
|
||||
|
||||
Texel weights
|
||||
=============
|
||||
|
||||
Each texel requires a weight, which defines the relative contribution of each
|
||||
color endpoint when interpolating the color gradient.
|
||||
|
||||
For smaller block sizes we can choose to store the weight directly, with one
|
||||
weight per texel, but for the larger block sizes we simply do not have enough
|
||||
bits of storage to do this. To work around this ASTC allows the weight grid to
|
||||
be stored at a lower resolution than the texel grid. The per-texel weights are
|
||||
interpolated from the stored weight grid during decompression using a bilinear
|
||||
interpolation.
|
||||
|
||||
The number of texel weights, and the weight value BISE quantization level, can
|
||||
be chosen on a per-block basis.
|
||||
|
||||
|
||||
Dual-plane weights
|
||||
------------------
|
||||
|
||||
Using a single weight for all color channels works well when there is good
|
||||
correlation across the channels, but this is not always the case. Common
|
||||
examples where we would expect to get low correlation at least some of the time
|
||||
are textures storing RGBA data - alpha masks are not usually closely
|
||||
correlated with the color value - or normal data - the X and Y normal values
|
||||
often change independently.
|
||||
|
||||
ASTC allows a dual-plane mode, which uses two separate weight grids for each
|
||||
texel. A single channel can be assigned to a second plane of weights, while
|
||||
the other three use the first plane of weights.
|
||||
|
||||
The use of dual-plane mode can be chosen on a per-block basis, but its use
|
||||
prevents the use of four color partitions as we do not have enough bits to
|
||||
concurrently store both an extra plane of weights and an extra set of color
|
||||
endpoints.
|
||||
|
||||
|
||||
End results
|
||||
===========
|
||||
|
||||
So, if we pull all of this together what do we end up with?
|
||||
|
||||
|
||||
Adaptive
|
||||
--------
|
||||
|
||||
The first word in the name of ASTC is "adaptive", and it should now hopefully
|
||||
be clear why. Each block always compresses into 128-bits of storage, but the
|
||||
developer can choose from a wide range of texel block sizes and the compressor
|
||||
gets a huge amount of latitude to determine how those 128 bits are used.
|
||||
|
||||
The compressor can trade off the number of bits assigned to colors (number of
|
||||
partitions, endpoint mode, and stored quantization level) and weights (number
|
||||
of weights per block, use of dual-plane, and stored quantization level) on a
|
||||
per-block basis to get the best image quality possible.
|
||||
|
||||

|
||||
|
||||
|
||||
Format support
|
||||
--------------
|
||||
|
||||
The compression scheme used by ASTC effectively compresses arbitrary sequences
|
||||
of floating point numbers, with a flexible number of channels, across any of
|
||||
the supported block sizes. There is no real notion of "color format" in the
|
||||
format itself at all, beyond the color endpoint mode selection, although a
|
||||
sensible compressor will want to use some format-specific heuristics to drive
|
||||
an efficient state-space search.
|
||||
|
||||
The orthogonal encoding design allows ASTC to provide almost complete coverage
|
||||
of our desirable format matrix from earlier, across a wide range of bit rates:
|
||||
|
||||

|
||||
|
||||
The only significant omission is the absence of a dedicated two channel
|
||||
encoding for HDR textures. We simply ran out of entries in the space we had for
|
||||
encoding color endpoint modes, and this one didn't make the cut.
|
||||
|
||||
The flexibility allowed by ASTC ticks the requirement that almost any asset can
|
||||
be compressed to some degree, at an appropriate bitrate for its quality needs.
|
||||
This is a powerful enabler for a compression format, because it puts control in
|
||||
the hands of content creators and not arbitrary format restrictions.
|
||||
|
||||
|
||||
Image quality
|
||||
-------------
|
||||
|
||||
The normal expectation would be that this level of format flexibility would
|
||||
come at a cost of image quality; it has to cost something, right? Luckily this
|
||||
isn't true. The high packing efficiency allowed by BISE encoding, and the
|
||||
ability to dynamically choose where to spend encoding space on a per-block
|
||||
basis, means that an ASTC compressor is not forced to spend bits on things that
|
||||
don't help image quality.
|
||||
|
||||
This gives some significant improvements in image quality compared to the older
|
||||
texture formats, even though ASTC also handles a much wider range of options.
|
||||
|
||||
* ASTC at 2 bpt outperforms PVRTC at 2 bpt by ~2.0dB.
|
||||
* ASTC at 3.56 bpt outperforms PVRTC and BC1 at 4 bpt by ~1.5dB, and ETC2 by
|
||||
~0.7dB, despite a 10% bit rate disadvantage.
|
||||
* ASTC at 8 bpt for LDR formats is comparable in quality to BC7 at 8 bpt.
|
||||
* ASTC at 8 bpt for HDR formats is comparable in quality to BC6H at 8 bpt.
|
||||
|
||||
Differences as small as 0.25dB are visible to the human eye, and remember that
|
||||
dB uses a logarithmic scale, so these are significant image quality
|
||||
improvements.
|
||||
|
||||
|
||||
3D compression
|
||||
--------------
|
||||
|
||||
One of the nice bonus features of ASTC is that the techniques which underpin
|
||||
the format generalize to compressing volumetric texture data without needing
|
||||
very much additional decompression hardware.
|
||||
|
||||
ASTC is therefore also able to optionally support compression of 3D textures,
|
||||
which is a unique feature not found in any earlier format, at the following
|
||||
bit rates:
|
||||
|
||||
| Block footprint | Bits/texel | | Block footprint | Bits/texel |
|
||||
| --------------- | ---------- | --- | --------------- | ---------- |
|
||||
| 3x3x3 | 4.74 | | 5x5x4 | 1.28 |
|
||||
| 4x3x3 | 3.56 | | 5x5x5 | 1.02 |
|
||||
| 4x4x3 | 2.67 | | 6x5x5 | 0.85 |
|
||||
| 4x4x4 | 2.00 | | 6x6x5 | 0.71 |
|
||||
| 5x4x4 | 1.60 | | 6x6x6 | 0.59 |
|
||||
|
||||
|
||||
Availability
|
||||
============
|
||||
|
||||
The ASTC functionality is specified as a set of feature profiles, allowing
|
||||
GPU hardware manufacturers to select which parts of the standard they
|
||||
implement. There are four commonly seen profiles:
|
||||
|
||||
* "LDR":
|
||||
* 2D blocks.
|
||||
* LDR and sRGB color space.
|
||||
* [KHR_texture_compression_astc_ldr][astc_ldr]: KHR OpenGL ES extension.
|
||||
* "LDR + Sliced 3D":
|
||||
* 2D blocks and sliced 3D blocks.
|
||||
* LDR and sRGB color space.
|
||||
* [KHR_texture_compression_astc_sliced_3d][astc_3d]: KHR OpenGL ES extension.
|
||||
* "HDR":
|
||||
* 2D and sliced 3D blocks.
|
||||
* LDR, sRGB, and HDR color spaces.
|
||||
* [KHR_texture_compression_astc_hdr][astc_ldr]: KHR OpenGL ES extension.
|
||||
* "Full":
|
||||
* 2D, sliced 3D, and volumetric 3D blocks.
|
||||
* LDR, sRGB, and HDR color spaces.
|
||||
* [OES_texture_compression_astc][astc_full]: OES OpenGL ES extension.
|
||||
|
||||
The LDR profile is mandatory in OpenGL ES 3.2 and a standardized optional
|
||||
feature for Vulkan, and therefore widely supported on contemporary mobile
|
||||
devices. The 2D HDR profile is not mandatory, but is widely supported.
|
||||
|
||||
3D texturing
|
||||
------------
|
||||
|
||||
The APIs expose 3D textures in two flavors.
|
||||
|
||||
The sliced 3D texture support builds a 3D texture from an array of 2D image
|
||||
slices that have each been individually compressed using 2D ASTC compression.
|
||||
This is required for the HDR profile, so is also widely supported.
|
||||
|
||||
The volumetric 3D texture support uses the native 3D block sizes provided by
|
||||
ASTC to implement true volumetric compression. This enables a wider choice of
|
||||
low bitrate options than the 2D blocks, which is particularly important for 3D
|
||||
textures of any non-trivial size. Volumetric formats are not widely supported,
|
||||
but are supported on all of the Arm Mali GPUs that support ASTC.
|
||||
|
||||
ASTC decode mode
|
||||
----------------
|
||||
|
||||
ASTC is specified to decompress texels into fp16 intermediate values, except
|
||||
for sRGB which always decompresses into 8-bit UNORM intermediates. For many use
|
||||
cases this gives more dynamic range and precision than required. This can cause
|
||||
a reduction in both texture cache efficiency and texture filtering performance
|
||||
due to the larger decompressed data size.
|
||||
|
||||
A pair of extensions exist, and are widely supported on recent mobile GPUs,
|
||||
which allow applications to reduce the intermediate precision to either UNORM8
|
||||
(recommended for LDR textures) or RGB9e5 (recommended for HDR textures).
|
||||
|
||||
* [OES_texture_compression_astc_decode_mode][astc_decode]: Allow UNORM8
|
||||
intermediates
|
||||
* [OES_texture_compression_astc_decode_mode_rgb9e5][astc_decode]: Allow RGB9e5
|
||||
intermediates
|
||||
|
||||
[astc_ldr]: https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_texture_compression_astc_hdr.txt
|
||||
[astc_3d]: https://www.khronos.org/registry/OpenGL/extensions/KHR/KHR_texture_compression_astc_sliced_3d.txt
|
||||
[astc_full]: https://www.khronos.org/registry/OpenGL/extensions/OES/OES_texture_compression_astc.txt
|
||||
[astc_decode]: https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_texture_compression_astc_decode_mode.txt
|
||||
|
||||
- - -
|
||||
|
||||
_Copyright © 2019-2022, Arm Limited and contributors. All rights reserved._
|
||||
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
After Width: | Height: | Size: 76 KiB |