From d6e33d1418dd310857667a6471382c022bdc0b5c Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Wed, 26 Jul 2023 17:49:20 +0900 Subject: [PATCH 1/9] Add KTX_WERROR config option. - OFF by default. All build scripts have been modified to pass it through. CI .yml files have not yet been modified to turn it ON to test the default case. - Incidental to the main topic, build_android.sh has been modifed to build either configuration and android_debug.sh deleted. All CMake option help prompts have been made into proper sentences. - Temporarily forces tools to use C++17 to prompt a warning for testing purposes. Will be reverted before this is committed to main. --- .github/workflows/android.yml | 6 +++- CMakeLists.txt | 36 ++++++++++++++--------- ci_scripts/build_android.sh | 21 ++++++++----- ci_scripts/build_android_debug.sh | 49 ------------------------------- ci_scripts/build_ios.sh | 4 ++- ci_scripts/build_linux.sh | 4 ++- ci_scripts/build_macos.sh | 4 ++- ci_scripts/build_wasm_docker.sh | 2 ++ ci_scripts/build_win.ps1 | 2 ++ tools/CMakeLists.txt | 4 +++ 10 files changed, 58 insertions(+), 74 deletions(-) delete mode 100755 ci_scripts/build_android_debug.sh diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index b52c09b4f3..108a08c51e 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -28,6 +28,9 @@ jobs: linux: runs-on: ubuntu-latest + #env: + # WERROR: ON + steps: - uses: actions/checkout@v3 with: @@ -50,7 +53,7 @@ jobs: run: sudo apt-get install -y ninja-build - name: android_Debug_arm64-v8a - run: ./ci_scripts/build_android_debug.sh + run: ./ci_scripts/build_android.sh env: ANDROID_ABI: arm64-v8a ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }} @@ -63,6 +66,7 @@ jobs: ANDROID_ABI: arm64-v8a ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }} ASTCENC_ISA: "ASTCENC_ISA_NEON=ON" + CONFIGURATION: Release # Android ABI x86 is obsolete # and not supported by ARM ASTC encoder diff --git a/CMakeLists.txt b/CMakeLists.txt index 430cee458f..4239211292 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,17 +37,17 @@ CMAKE_DEPENDENT_OPTION( KTX_FEATURE_TOOLS "NOT IOS;NOT ANDROID;NOT EMSCRIPTEN" OFF ) -option( KTX_FEATURE_DOC "Create KTX documentation" OFF ) -option( KTX_FEATURE_STATIC_LIBRARY "Create static libraries (shared otherwise)" ${LIB_TYPE_DEFAULT} ) -option( KTX_FEATURE_JNI "Create Java bindings for libktx" OFF ) -option( KTX_FEATURE_TESTS "Create unit tests" ON ) -option( KTX_FEATURE_TOOLS_CTS "Enable KTX CLI Tools CTS tests (requires CTS submodule)" OFF ) +option( KTX_FEATURE_DOC "Create KTX documentation." OFF ) +option( KTX_FEATURE_STATIC_LIBRARY "Create static libraries (shared otherwise)." ${LIB_TYPE_DEFAULT} ) +option( KTX_FEATURE_JNI "Create Java bindings for libktx." OFF ) +option( KTX_FEATURE_TESTS "Create unit tests." ON ) +option( KTX_FEATURE_TOOLS_CTS "Enable KTX CLI Tools CTS tests (requires CTS submodule)." OFF ) if(KTX_FEATURE_TOOLS_CTS AND NOT KTX_FEATURE_TOOLS) - message(WARNING "KTX_FEATURE_TOOLS is not set -> disabling KTX_FEATURE_TOOLS_CTS") + message(WARNING "KTX_FEATURE_TOOLS is not set -> disabling KTX_FEATURE_TOOLS_CTS.") set(KTX_FEATURE_TOOLS_CTS "OFF") elseif(KTX_FEATURE_TOOLS_CTS AND NOT KTX_FEATURE_TESTS) - message(WARNING "KTX_FEATURE_TESTS is not set -> disabling KTX_FEATURE_TOOLS_CTS") + message(WARNING "KTX_FEATURE_TESTS is not set -> disabling KTX_FEATURE_TOOLS_CTS.") set(KTX_FEATURE_TOOLS_CTS "OFF") endif() @@ -92,16 +92,16 @@ endif() CMAKE_DEPENDENT_OPTION( KTX_EMBED_BITCODE - "Embed bitcode in binaries" + "Embed bitcode in binaries." OFF "APPLE AND IOS" OFF ) -option( KTX_FEATURE_KTX1 "Enable KTX 1 support" ON ) -option( KTX_FEATURE_KTX2 "Enable KTX 2 support" ON ) -option( KTX_FEATURE_VK_UPLOAD "Enable Vulkan texture upload" ON ) -option( KTX_FEATURE_GL_UPLOAD "Enable OpenGL texture upload" ON ) +option( KTX_FEATURE_KTX1 "Enable KTX 1 support." ON ) +option( KTX_FEATURE_KTX2 "Enable KTX 2 support." ON ) +option( KTX_FEATURE_VK_UPLOAD "Enable Vulkan texture upload." ON ) +option( KTX_FEATURE_GL_UPLOAD "Enable OpenGL texture upload." ON ) # When a variable like this is set via CMakeUserPresets.json, it no longer # shows the selectable options provided by the STRINGS property. set( KTX_FEATURE_LOADTEST_APPS @@ -233,12 +233,20 @@ endif() include(cmake/mkvk.cmake) # Global compile & link options including optimization flags + +option( KTX_WERROR "Make all warnings in KTX code into errors." OFF) + +add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "Generator expression result is $<$:-Werror>") if(MSVC) - add_compile_options( /W4;/WX ) + # Reminder: separate multiple options with ";". + add_compile_options( /W4 ) + # Not sure how to conditionally provide the ; separator if gen ex is + # included above. Will try later after getting this onto Windows. + add_compile_options( $<$:/WX> ) add_compile_options( $,/Gz,/O2> ) elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") - add_compile_options(-Wall -Wextra -Werror) + add_compile_options( -Wall -Wextra $<$:-Werror>) add_compile_options( $,-O0,-O3> ) if(EMSCRIPTEN) add_link_options( $,-gsource-map,-O3> ) diff --git a/ci_scripts/build_android.sh b/ci_scripts/build_android.sh index 82df1876a0..5965ce0bd8 100755 --- a/ci_scripts/build_android.sh +++ b/ci_scripts/build_android.sh @@ -7,9 +7,17 @@ set -e # Fallback to arm64-v8a ANDROID_ABI=${ANDROID_ABI:-'arm64-v8a'} ASTCENC_ISA=${ASTCENC_ISA:-'ASTCENC_ISA_NONE=ON'} -CONFIGURATION=${CONFIGURATION:-Release} -BUILD_DIR="build-android-$ANDROID_ABI" +CONFIGURATION=${CONFIGURATION:-Release} +WERROR=${WERROR:-OFF} + +if [ "$CONFIGURATION" = "Debug" ]; then + BUILD_DIR="build-android-$ANDROID_ABI-Debug" + INSTALL_DIR="install-android-debug/$ANDROID_ABI" +else + BUILD_DIR="build-android-$ANDROID_ABI" + INSTALL_DIR="install-android/$ANDROID_ABI" +fi # You need to set the following environment variables first # ANDROID_NDK= @@ -23,6 +31,7 @@ cmake_args=("-G" "Ninja" \ "-D" "CMAKE_BUILD_TYPE=$CONFIGURATION" \ "-D" "BASISU_SUPPORT_SSE=OFF" \ "-D" "${ASTCENC_ISA}" + "-D" "KTX_WERROR=$WERROR" ) config_display="Configure KTX-Software (Android $ANDROID_ABI $CONFIGURATION): " @@ -43,10 +52,8 @@ pushd "$BUILD_DIR" echo "Build KTX-Software (Android $ANDROID_ABI $CONFIGURATION)" cmake --build . --config $CONFIGURATION -j # echo "Test KTX-Software (Android $ANDROID_ABI Release)" -# ctest -C Release # --verbose -if [ "$CONFIGURATION" = "Release" ]; then - echo "Install KTX-Software (Android $ANDROID_ABI $CONFIGURATION)" - cmake --install . --config Release --prefix ../install-android/$ANDROID_ABI -fi +# ctest -C $CONFIGURATION # --verbose +echo "Install KTX-Software (Android $ANDROID_ABI $CONFIGURATION)" +cmake --install . --config $CONFIGURATION --prefix ../$INSTALL_DIR popd diff --git a/ci_scripts/build_android_debug.sh b/ci_scripts/build_android_debug.sh deleted file mode 100755 index 9a44f02447..0000000000 --- a/ci_scripts/build_android_debug.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -# Copyright 2020 Andreas Atteneder -# SPDX-License-Identifier: Apache-2.0 - -set -e - -# Fallback to arm64-v8a -ANDROID_ABI=${ANDROID_ABI:-'arm64-v8a'} -ASTCENC_ISA=${ASTCENC_ISA:-'ASTCENC_ISA_NONE=ON'} - -BUILD_DIR="build-android-$ANDROID_ABI-debug" - -# You need to set the following environment variables first -# ANDROID_NDK= - -cmake_args=("-G" "Ninja" \ - "-B" "$BUILD_DIR" \ - "-D" "ANDROID_PLATFORM=android-24" \ - "-D" "ANDROID_ABI=$ANDROID_ABI" \ - "-D" "ANDROID_NDK=$ANDROID_NDK" \ - "-D" "CMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake" \ - "-D" "CMAKE_BUILD_TYPE=Debug" \ - "-D" "BASISU_SUPPORT_SSE=OFF" \ - "-D" "${ASTCENC_ISA}" -) - -config_display="Configure KTX-Software (Android $ANDROID_ABI Debug): " -for arg in "${cmake_args[@]}"; do - case $arg in - "-G") config_display+="Generator=" ;; - "-B") config_display+="Build Dir=" ;; - "-D") ;; - *) config_display+="$arg, " ;; - esac -done - -echo ${config_display%??} -cmake . "${cmake_args[@]}" - -pushd "$BUILD_DIR" - -echo "Build KTX-Software (Android $ANDROID_ABI Debug)" -cmake --build . --config Debug -j -# echo "Test KTX-Software (Android $ANDROID_ABI Debug)" -# ctest -C Debug # --verbose -echo "Install KTX-Software (Android $ANDROID_ABI Debug)" -cmake --install . --config Debug --prefix ../install-android-debug/$ANDROID_ABI - -popd diff --git a/ci_scripts/build_ios.sh b/ci_scripts/build_ios.sh index 866f825d57..eaaa5833a1 100755 --- a/ci_scripts/build_ios.sh +++ b/ci_scripts/build_ios.sh @@ -25,6 +25,7 @@ FEATURE_TOOLS=${FEATURE_TOOLS:-OFF} PACKAGE=${PACKAGE:-NO} SUPPORT_OPENCL=${SUPPORT_OPENCL:-OFF} SUPPORT_SSE=OFF +WERROR=${WERROR:-OFF} BUILD_DIR=${BUILD_DIR:-build/ios} @@ -67,7 +68,8 @@ cmake_args=("-G" "Xcode" \ "-D" "KTX_FEATURE_TESTS=$FEATURE_TESTS" \ "-D" "KTX_FEATURE_TOOLS=$FEATURE_TOOLS" \ "-D" "BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL" \ - "-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE" + "-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE" \ + "-D" "KTX_WERROR=$WERROR" ) config_display="Configure KTX-Software (iOS): " for arg in "${cmake_args[@]}"; do diff --git a/ci_scripts/build_linux.sh b/ci_scripts/build_linux.sh index 47b7f42554..8e3a842939 100755 --- a/ci_scripts/build_linux.sh +++ b/ci_scripts/build_linux.sh @@ -45,6 +45,7 @@ FEATURE_VK_UPLOAD=${FEATURE_VK_UPLOAD:-ON} PACKAGE=${PACKAGE:-NO} SUPPORT_SSE=${SUPPORT_SSE:-ON} SUPPORT_OPENCL=${SUPPORT_OPENCL:-OFF} +WERROR=${WERROR:-OFF} if [[ "$ARCH" = "aarch64" && "$FEATURE_LOADTESTS" =~ "Vulkan" ]]; then if [[ "$FEATURE_LOADTESTS" = "Vulkan" ]]; then @@ -84,7 +85,8 @@ cmake_args=("-G" "$CMAKE_GEN" "-D" "KTX_FEATURE_GL_UPLOAD=$FEATURE_GL_UPLOAD" \ "-D" "KTX_FEATURE_VK_UPLOAD=$FEATURE_VK_UPLOAD" \ "-D" "BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL" \ - "-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE" + "-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE" \ + "-D" "KTX_WERROR=$WERROR" ) if [ "$ARCH" != $(uname -m) ]; then cmake_args+=("--toolchain", "cmake/linux-$ARCH-toolchain.cmake") diff --git a/ci_scripts/build_macos.sh b/ci_scripts/build_macos.sh index 7b79678140..e140344523 100755 --- a/ci_scripts/build_macos.sh +++ b/ci_scripts/build_macos.sh @@ -31,6 +31,7 @@ FEATURE_TOOLS_CTS=${FEATURE_TOOLS_CTS:-ON} PACKAGE=${PACKAGE:-NO} SUPPORT_SSE=${SUPPORT_SSE:-ON} SUPPORT_OPENCL=${SUPPORT_OPENCL:-OFF} +WERROR=${WERROR:-OFF} if [ "$ARCHS" = '(ARCHS_STANDARD)' ]; then BUILD_DIR=${BUILD_DIR:-build/macos-universal} @@ -73,7 +74,8 @@ cmake_args=("-G" "Xcode" \ "-D" "KTX_FEATURE_TOOLS=$FEATURE_TOOLS" \ "-D" "KTX_FEATURE_TOOLS_CTS=$FEATURE_TOOLS_CTS" \ "-D" "BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL" \ - "-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE" + "-D" "BASISU_SUPPORT_SSE=$SUPPORT_SSE" \ + "-D" "KTX_WERROR=$WERROR" ) if [ "$ARCHS" = "x86_64" ]; then cmake_args+=("-D" "ASTCENC_ISA_SSE41=ON"); fi if [ -n "$MACOS_CERTIFICATES_P12" ]; then diff --git a/ci_scripts/build_wasm_docker.sh b/ci_scripts/build_wasm_docker.sh index 2bf77a01a8..a03c90a8c9 100755 --- a/ci_scripts/build_wasm_docker.sh +++ b/ci_scripts/build_wasm_docker.sh @@ -28,6 +28,7 @@ FEATURE_TOOLS=${FEATURE_TOOLS:-OFF} PACKAGE=${PACKAGE:-NO} SUPPORT_SSE=OFF SUPPORT_OPENCL=${SUPPORT_OPENCL:-OFF} +WERROR=${WERROR:-OFF} BUILD_DIR=${BUILD_DIR:-build/web-$CONFIGURATION} @@ -76,6 +77,7 @@ docker exec -it emscripten sh -c "emcmake cmake -B$BUILD_DIR . \ -D CMAKE_BUILD_TYPE=$CONFIGURATION \ -D KTX_FEATURE_DOC=OFF \ -D KTX_FEATURE_LOADTEST_APPS=$FEATURE_LOADTESTS \ + -D KTX_WERROR=$WERROR \ && cmake --build $BUILD_DIR" if [ "$PACKAGE" = "YES" ]; then diff --git a/ci_scripts/build_win.ps1 b/ci_scripts/build_win.ps1 index d192acfcfc..a8c1badc96 100644 --- a/ci_scripts/build_win.ps1 +++ b/ci_scripts/build_win.ps1 @@ -52,6 +52,7 @@ $FEATURE_TOOLS_CTS = Set-ConfigVariable FEATURE_TOOLS_CTS "ON" $PACKAGE = Set-ConfigVariable PACKAGE "NO" $SUPPORT_SSE = Set-ConfigVariable SUPPORT_SSE "ON" $SUPPORT_OPENCL = Set-ConfigVariable SUPPORT_OPENCL "OFF" +$WERROR = Set-ConfigVariable WERROR "OFF" $OPENGL_ES_EMULATOR = Set-ConfigVariable OPENGL_ES_EMULATOR ` "c:/Imagination` Technologies/PowerVR_Graphics/PowerVR_Tools/PVRVFrame/Library/Windows_x86_64" $CODE_SIGN_KEY_VAULT = Set-ConfigVariable CODE_SIGN_KEY_VAULT "" @@ -94,6 +95,7 @@ $cmake_args += @( "-D", "KTX_FEATURE_TOOLS_CTS=$FEATURE_TOOLS_CTS" "-D", "BASISU_SUPPORT_SSE=$SUPPORT_SSE" "-D", "BASISU_SUPPORT_OPENCL=$SUPPORT_OPENCL" + "-D", "KTX_WERROR=$WERROR" "-D", "CODE_SIGN_KEY_VAULT=$CODE_SIGN_KEY_VAULT" ) if ($CODE_SIGN_KEY_VAULT) { diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index ae3ef4f950..255e05170b 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -19,6 +19,10 @@ function(set_tool_properties tool_target) CXX_VISIBILITY_PRESET ${STATIC_APP_LIB_SYMBOL_VISIBILITY} ) endif() + set_target_properties(${tool_target} PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED YES + ) endfunction() add_subdirectory(imageio) From d235f7647b03a445152e3137bced5196b62208f0 Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Thu, 27 Jul 2023 14:32:08 +0900 Subject: [PATCH 2/9] Make correct generator expression for MSVC. --- CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4239211292..a7f3971c47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,13 +236,8 @@ include(cmake/mkvk.cmake) option( KTX_WERROR "Make all warnings in KTX code into errors." OFF) -add_custom_target(genexdebug COMMAND ${CMAKE_COMMAND} -E echo "Generator expression result is $<$:-Werror>") if(MSVC) - # Reminder: separate multiple options with ";". - add_compile_options( /W4 ) - # Not sure how to conditionally provide the ; separator if gen ex is - # included above. Will try later after getting this onto Windows. - add_compile_options( $<$:/WX> ) + add_compile_options( $,/W4;/WX,/W4> ) add_compile_options( $,/Gz,/O2> ) elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") From 1e062eed6da6e6fce1b6bd1fb16e48c66158b94b Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Thu, 27 Jul 2023 17:39:50 +0900 Subject: [PATCH 3/9] Fix MSVC genex so compimler sees properly separated arguments. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7f3971c47..afac48cc00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -237,7 +237,9 @@ include(cmake/mkvk.cmake) option( KTX_WERROR "Make all warnings in KTX code into errors." OFF) if(MSVC) - add_compile_options( $,/W4;/WX,/W4> ) + # ";" argument separator is problematic. Can't use a GenEx `$:/WX> ) add_compile_options( $,/Gz,/O2> ) elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") From 2a4f2ed8842a05b51de902af1e19678320eea548 Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Thu, 27 Jul 2023 17:40:59 +0900 Subject: [PATCH 4/9] Add fake unused variable for testing. --- lib/astc_encode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/astc_encode.cpp b/lib/astc_encode.cpp index 657b518d12..a2088026c8 100644 --- a/lib/astc_encode.cpp +++ b/lib/astc_encode.cpp @@ -209,6 +209,7 @@ unorm8x4ArrayToImage(const uint8_t *data, uint32_t dim_x, uint32_t dim_y) { */ static ktxAstcParams astcDefaultOptions() { + int unused_variable; ktxAstcParams params{}; params.structSize = sizeof(params); params.threadCount = 1; From c2b76318840a749205d1a4fa82a655951e5d7057 Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Thu, 27 Jul 2023 17:43:32 +0900 Subject: [PATCH 5/9] Remove cmake_minimum_required to avoid warning. --- cmake/cputypetest.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmake/cputypetest.cmake b/cmake/cputypetest.cmake index 31d38882d7..d839d2d4cc 100644 --- a/cmake/cputypetest.cmake +++ b/cmake/cputypetest.cmake @@ -1,8 +1,6 @@ # Copyright 2016, Simon Werta (@webmaster128). # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 2.8.12) - set(cputypetest_code " // // https://gist.github.com/webmaster128/e08067641df1dd784eb195282fd0912f From c1819d5aab71ab6619fb5f057fab5a3928e95b7b Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Thu, 27 Jul 2023 17:44:13 +0900 Subject: [PATCH 6/9] Set FMT_SYSTEM_HEADERS to avoid compiler warnings. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index afac48cc00..ad9fd5e62a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -960,6 +960,7 @@ else() endif() # Other external projects +set(FMT_SYSTEM_HEADERS ON) add_subdirectory(other_projects/fmt) add_subdirectory(other_projects/cxxopts) From 2dd4d11cf7741cf92bc7f02e55573629e75cdbe2 Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Thu, 27 Jul 2023 19:41:36 +0900 Subject: [PATCH 7/9] Turn on WERROR in CI. --- .github/workflows/android.yml | 4 ++-- .github/workflows/mingw.yml | 2 ++ .github/workflows/windows.yml | 1 + .travis.yml | 17 +++++++++-------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 108a08c51e..a5880af795 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -28,8 +28,8 @@ jobs: linux: runs-on: ubuntu-latest - #env: - # WERROR: ON + env: + WERROR: ON steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 835fa625a8..db34aeb895 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -27,6 +27,8 @@ on: jobs: mingw: runs-on: windows-latest + env: + WERROR: ON steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index be819fe305..6a586d76cf 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -94,6 +94,7 @@ jobs: PACKAGE: ${{ matrix.options.package }} SUPPORT_OPENCL: ${{ matrix.options.opencl }} SUPPORT_SSE: ${{ matrix.options.sse }} + WERROR: ON CODE_SIGN_TIMESTAMP_URL: "http://timestamp.digicert.com" AZURE_KEY_VAULT_URL: ${{ secrets.AZURE_KEY_VAULT_URL }} diff --git a/.travis.yml b/.travis.yml index 52a0053c8f..3bd7aa81ab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,7 @@ env: - VULKAN_INSTALL_DIR: "$HOME/VulkanSDK/$VULKAN_SDK_VER" - VULKAN_SDK: "$VULKAN_INSTALL_DIR/macOS" - WASM_BUILD: NO + - WERROR: ON jobs: # FEATURE_TESTS is off for arm64 macOS because we can't even build # them during CI. CI runs on x86_64 and there is a PostBuild command @@ -89,7 +90,7 @@ jobs: - CMAKE_GEN: Ninja - CONFIGURATION=Debug FEATURE_DOC=OFF FEATURE_JNI=ON FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TOOLS=ON - SUPPORT_SSE=ON SUPPORT_OPENCL=OFF + SUPPORT_SSE=ON SUPPORT_OPENCL=OFF WERROR=ON - os: linux dist: jammy compiler: gcc @@ -100,7 +101,7 @@ jobs: - CMAKE_GEN: Ninja - CONFIGURATION=Release FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TOOLS=ON - SUPPORT_SSE=ON SUPPORT_OPENCL=OFF PACKAGE=YES + SUPPORT_SSE=ON SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=YES - os: linux arch: arm64 dist: jammy @@ -113,7 +114,7 @@ jobs: - CONFIGURATION=Release FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_LOADTESTS=OpenGL FEATURE_TOOLS=ON FEATURE_TOOLS_CTS=OFF - SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF PACKAGE=YES + SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=YES - os: linux dist: jammy compiler: gcc @@ -122,7 +123,7 @@ jobs: - CONFIGURATION=Release FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF - SUPPORT_SSE=ON SUPPORT_OPENCL=ON PACKAGE=NO + SUPPORT_SSE=ON SUPPORT_OPENCL=ON WERROR=ON PACKAGE=NO - os: linux dist: jammy compiler: gcc @@ -131,7 +132,7 @@ jobs: - CONFIGURATION=Release FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF - SUPPORT_SSE=OFF SUPPORT_OPENCL=ON PACKAGE=NO + SUPPORT_SSE=OFF SUPPORT_OPENCL=ON WERROR=ON PACKAGE=NO - os: linux dist: jammy compiler: gcc @@ -140,7 +141,7 @@ jobs: - CONFIGURATION=Release FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=OFF FEATURE_TOOLS=OFF FEATURE_TOOLS_CTS=OFF - SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF PACKAGE=NO + SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=NO - os: linux dist: jammy compiler: clang @@ -149,7 +150,7 @@ jobs: - WASM_BUILD=YES - CONFIGURATION=Debug FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=OpenGL - SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF + SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON - os: linux dist: jammy compiler: clang @@ -158,7 +159,7 @@ jobs: - WASM_BUILD=YES - CONFIGURATION=Release FEATURE_DOC=OFF FEATURE_JNI=OFF FEATURE_LOADTESTS=OpenGL - SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF PACKAGE=YES + SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=YES # Phase 1: Git clone - done automatically. # Phase 2: Install apt addons. From 1c87108ac10a2f321748a5dad4c7697c4c3b911a Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Thu, 27 Jul 2023 20:16:05 +0900 Subject: [PATCH 8/9] Set KTX_WERROR in config step. --- .github/workflows/mingw.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index db34aeb895..0c6aca0e4d 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -50,7 +50,7 @@ jobs: - name: Install Ninja run: choco install ninja --no-progress - name: Configure Mingw x64 - run: cmake -B build -G "Ninja Multi-Config" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DKTX_FEATURE_TOOLS=TRUE -DKTX_FEATURE_TOOLS_CTS=TRUE + run: cmake -B build -G "Ninja Multi-Config" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DKTX_FEATURE_TOOLS=TRUE -DKTX_FEATURE_TOOLS_CTS=TRUE -DKTX_WERROR=$WERROR - name: Build Mingw x64 Debug run: cmake --build build --config Debug - name: Build Mingw x64 Release From 94f6690285ae5bdd6235c95ef1e084ee37eb5b13 Mon Sep 17 00:00:00 2001 From: Mark Callow Date: Thu, 27 Jul 2023 21:15:07 +0900 Subject: [PATCH 9/9] Remove artificial warnings. --- lib/astc_encode.cpp | 1 - tools/CMakeLists.txt | 4 ---- tools/ktx2ktx2/ktx2ktx2.cpp | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/astc_encode.cpp b/lib/astc_encode.cpp index a2088026c8..657b518d12 100644 --- a/lib/astc_encode.cpp +++ b/lib/astc_encode.cpp @@ -209,7 +209,6 @@ unorm8x4ArrayToImage(const uint8_t *data, uint32_t dim_x, uint32_t dim_y) { */ static ktxAstcParams astcDefaultOptions() { - int unused_variable; ktxAstcParams params{}; params.structSize = sizeof(params); params.threadCount = 1; diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 255e05170b..ae3ef4f950 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -19,10 +19,6 @@ function(set_tool_properties tool_target) CXX_VISIBILITY_PRESET ${STATIC_APP_LIB_SYMBOL_VISIBILITY} ) endif() - set_target_properties(${tool_target} PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES - ) endfunction() add_subdirectory(imageio) diff --git a/tools/ktx2ktx2/ktx2ktx2.cpp b/tools/ktx2ktx2/ktx2ktx2.cpp index cfba395797..010d64d016 100644 --- a/tools/ktx2ktx2/ktx2ktx2.cpp +++ b/tools/ktx2ktx2/ktx2ktx2.cpp @@ -187,7 +187,7 @@ ktxUpgrader::main(int argc, _TCHAR* argv[]) processCommandLine(argc, argv); validateOptions(); - std::vector<_tstring>::const_iterator it, s, e; + std::vector<_tstring>::const_iterator it; for (it = options.infiles.begin(); it < options.infiles.end(); it++) { _tstring infile = *it; _tstring outfile;