diff --git a/.gitignore b/.gitignore index 93524df8..82608382 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -build/ + +CMakeUserPresets.json # VS project and working files *.vcxproj.user diff --git a/.reuse/dep5 b/.reuse/dep5 deleted file mode 100644 index cdba7ccf..00000000 --- a/.reuse/dep5 +++ /dev/null @@ -1,30 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: basis_universal -Source: https://github.com/BinomialLLC/basis_universal - -# We have asked Binomial about REUSE compliance for their repo, see https://github.com/BinomialLLC/basis_universal/issues/165 -Files: * -Copyright: 2019-2024 Binomial LLC - 2016 The Android Open Source Project -License: Apache-2.0 - -Files: OpenCL/* -Copyright: 2008-2020 The Khronos Group Inc. -License: Apache-2.0 - -Files: zstd/* -Copyright: 2016-present Facebook, Inc. -License: BSD-3-Clause - -Files: encoder/3rdparty/tinyexr.h -Copyright: 2014 - 2021, Syoyo Fujita and many contributors. - 2002 Industrial Light & Magic, a division of Lucas -License: BSD-3-Clause - -Files: encoder/3rdparty/qoi.h -Copyright: 2021 Dominic Szablewski - https://phoboslab.org -License: MIT - -Files: encoder/3rdparty/tinydds.h -Copyright: 2019 DeanoC -License: MIT diff --git a/CMakeLists.txt b/CMakeLists.txt index f1d0abab..086208e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,43 +2,63 @@ # It should also work without this option, but we do not test with it. cmake_minimum_required(VERSION 3.20) +if (NOT CMAKE_OSX_DEPLOYMENT_TARGET) + # Needed otherwise Xcode builds with the default installed SDK which can often be + # more recent than the macOS version being used. + set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "macOS Deployment Target") +endif() + project(basisu C CXX) -set(CMAKE_CXX_STANDARD 17) -option(STATIC "static linking" FALSE) -option(SAN "sanitize" FALSE) -option(EXAMPLES "build examples" TRUE) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) +option(BASISU_TOOL "Include basisu tool in build" TRUE) +option(BASISU_EXAMPLES "Include examples in build" TRUE) + +option(BASISU_STATIC "static linking" TRUE) +option(BASISU_SAN "sanitize" FALSE) + +# Using a generator expression here prevents multi-config generators (VS, Xcode, Ninja Multi-Config) +# from appending a per-configuration subdirectory. NOTE: This means the output could be overwritten +# by a subsequent build for a different configuration. +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_CURRENT_SOURCE_DIR}/bin>) # For MSVC builds default to SSE enabled, and determine if it's a 64-bit (-A x64) vs. 32-bit (-A Win32) build. if (MSVC) - option(SSE "SSE 4.1 support" TRUE) - if ( CMAKE_GENERATOR_PLATFORM STREQUAL Win32 ) - set(BUILD_X64 0) + # TODO: Fix me for Windows ARM + option(BASISU_SSE "SSE 4.1 support" TRUE) + if ( CMAKE_GENERATOR_PLATFORM STREQUAL "Win32" ) + set(BASISU_BUILD_X64 0) else() - set(BUILD_X64 1) + set(BASISU_BUILD_X64 1) endif() - add_compile_options(/W4) + add_compile_options(/W4) else() - option(SSE "SSE 4.1 support" FALSE) - option(BUILD_X64 "build 64-bit" TRUE) + option(BASISU_SSE "SSE 4.1 support" FALSE) + option(BASISU_BUILD_X64 "build 64-bit" TRUE) endif() -option(ZSTD "ZSTD support for KTX2 transcoding/encoding" TRUE) -option(OPENCL "OpenCL support in encoder" FALSE) +option(BASISU_ZSTD "ZSTD support for KTX2 transcoding/encoding" TRUE) +option(BASISU_OPENCL "OpenCL support in encoder" FALSE) -message("Initial BUILD_X64=${BUILD_X64}") +message("Initial BASISU_BUILD_X64=${BASISU_BUILD_X64}") message("Initial CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") -message("Initial SSE=${SSE}") -message("Initial ZSTD=${ZSTD}") -message("Initial OPENCL=${OPENCL}") -message("Initial SAN=${SAN}") -message("Initial EXAMPLES=${EXAMPLES}") - -if ((NOT MSVC) AND OPENCL) - # With MSVC builds we use the Khronos lib/include files in the project's "OpenCL" directory, to completely avoid requiring fiddly to install vendor SDK's. +message("Initial BASISU_SSE=${BASISU_SSE}") +message("Initial BASISU_ZSTD=${BASISU_ZSTD}") +message("Initial BASISU_OPENCL=${BASISU_OPENCL}") +message("Initial BASISU_SAN=${BASISU_SAN}") +message("initial BASISU_TOOL=${BASISU_TOOL}") +message("initial BASISU_EXAMPLES=${BASISU_EXAMPLES}") + +if(MINGW) + # Check if the Threads package is provided; if using Mingw it MIGHT be + find_package(Threads) +elseif(LINUX) + find_package(Threads REQUIRED) +endif() + +if ((NOT WIN32) AND BASISU_OPENCL) + # For Windows builds we use the Khronos lib/include files in the project's "OpenCL" directory, to completely avoid requiring fiddly to install vendor SDK's. # Otherwise we use the system's (if any). - find_package(OpenCL) + find_package(OpenCL REQUIRED) message(STATUS "OpenCL found: ${OPENCL_FOUND}") message(STATUS "OpenCL includes: ${OpenCL_INCLUDE_DIRS}") message(STATUS "OpenCL libraries: ${OpenCL_LIBRARIES}") @@ -50,92 +70,119 @@ endif() message(${PROJECT_NAME} " build type: " ${CMAKE_BUILD_TYPE}) -if (BUILD_X64) +if (BASISU_BUILD_X64) message("Building 64-bit") else() message("Building 32-bit") endif() -if (SSE) +if (BASISU_SSE) message("SSE enabled") else() message("SSE disabled") endif() -if (ZSTD) +if (BASISU_ZSTD) message("Zstandard enabled") else() message("Zstandard disabled") endif() -if (NOT MSVC) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") +####################################################################### +# Specify floating point handling +# +# For deterministic results specify FP compile options for uniform +# handling of floating point operations across platforms and compilers - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") +# Compiler info query helpers - if (SAN) - message("Enabling SAN") +# On CMake 3.25 or older CXX_COMPILER_FRONTEND_VARIANT is not always set +if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "") + set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "${CMAKE_CXX_COMPILER_ID}") +endif() - set(SANITIZE_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize=alignment") +#cmake_print_variables( +# CMAKE_CXX_COMPILER_ID +# CMAKE_CXX_COMPILER_VERSION +# CMAKE_CXX_COMPILER_FRONTEND_VARIANT +#) + +# Compiler accepts MSVC-style command line options +set(is_msvc_fe "$") +# Compiler accepts GNU-style command line options +set(is_gnu_fe1 "$") +# Compiler accepts AppleClang-style command line options, which is also GNU-style +set(is_gnu_fe2 "$") +# Compiler accepts GNU-style command line options +set(is_gnu_fe "$") + +# Compiler is Visual Studio cl.exe +set(is_msvccl "$>") +# Compiler is Visual Studio clangcl.exe +set(is_clangcl "$>") +# Compiler is upstream clang with the standard frontend +set(is_clang "$>") + +# Genex debug helper. Note that CXX_COMPILER_ID can only be used in +# compilation targets so won't work in a custom target. +#if(NOT TARGET debug_isgnufe1) +# add_custom_target(debug_isgnufe1 +# COMMAND ${CMAKE_COMMAND} -E echo "is_gnufe1_exp = $" +# ) +#endif() - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${SANITIZE_FLAGS}") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${SANITIZE_FLAGS}") +# On MSVC and CLangCL, set /fp:strict and /fp:precise, on clang +# -ffp-model=precise and on GNU CC -ffp-contract=off. These result in +# precise semantics always being used and fused multiply-add never +# being used, +add_compile_options( + $<$,19.30>>:/fp:strict> + $<$,19.30>>:/fp:precise> + $<${is_clangcl}:/fp:precise> + $<$,14.0.0>>:-Xclang$-ffp-contract=off> + $<$,10.0.0>>:-ffp-model=precise> + $<${is_gnu_fe}:-ffp-contract=off> + # Hide noise from clang and clangcl 20 warning the 2nd fp option changes + # one of the settings made the first. + $<$,20.0.0>>:-Wno-overriding-option> +) +####################################################################### - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SANITIZE_FLAGS}") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${SANITIZE_FLAGS}") - endif() +if (NOT MSVC) + add_compile_options($<$:-g>) + # If you want to set an optimization option for non-debug too, use this instead. + #add_compile_options($,-g,-O3>) - set(CMAKE_CXX_FLAGS -std=c++17) - set(GCC_COMPILE_FLAGS "-fvisibility=hidden -fPIC -fno-strict-aliasing -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-local-typedefs -Wno-unused-value -Wno-unused-parameter -Wno-unused-variable -Wno-reorder -Wno-misleading-indentation -Wno-class-memaccess -Wno-deprecated-copy -Wno-maybe-uninitialized -Wno-unused-function -Wno-stringop-overflow -Wno-unknown-warning-option") + if (BASISU_SAN) + message("Enabling SAN") - if (NOT BUILD_X64) - set(GCC_COMPILE_FLAGS "${GCC_COMPILE_FLAGS} -m32") + add_compile_options(-fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize=alignment) endif() - if (EMSCRIPTEN) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -DBASISU_SUPPORT_SSE=0") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s ALLOW_MEMORY_GROWTH=1 -DBASISU_SUPPORT_SSE=0") - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_LINK_FLAGS}") - elseif (STATIC) - if (SSE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_SSE=1 -msse4.1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_SSE=1 -msse4.1") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_SSE=0") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_SSE=0") - endif() - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_LINK_FLAGS} -static-libgcc -static-libstdc++ -static") - else() - if (SSE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_SSE=1 -msse4.1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_SSE=1 -msse4.1") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_SSE=0") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_SSE=0") - endif() - - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_LINK_FLAGS} -Wl,-rpath .") + # Add common non-MSVC flags excluding -fPIC. + add_compile_options(-fvisibility=hidden -fno-strict-aliasing -D_LARGEFILE64_SOURCE=1 + -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-unused-local-typedefs + -Wno-unused-value -Wno-unused-parameter -Wno-unused-variable + -Wno-misleading-indentation + -Wno-maybe-uninitialized -Wno-unused-function + -Wno-stringop-overflow -Wno-unknown-warning-option) + # Add -fPIC ONLY on non-Windows platforms + if (NOT WIN32) + add_compile_options(-fPIC) endif() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COMPILE_FLAGS}") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${GCC_COMPILE_FLAGS}") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${GCC_COMPILE_FLAGS} -D_DEBUG") + # AppleClang 14 raises this warning in zstd.cpp. + add_compile_options("$<$,$,17>>:-Wno-bitwise-instead-of-logical>") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COMPILE_FLAGS}") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${GCC_COMPILE_FLAGS}") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${GCC_COMPILE_FLAGS} -D_DEBUG") -else() - if (SSE) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_SSE=1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_SSE=1") - else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_SSE=0") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_SSE=0") + add_compile_options("$<$:-Wno-reorder;-Wno-class-memaccess;-Wno-deprecated-copy>") + + add_compile_options($<$>:-m32>) + add_compile_definitions($<$:_DEBUG>) + if (EMSCRIPTEN) + add_link_options("SHELL:-s ALLOW_MEMORY_GROWTH=1") endif() +else() + add_compile_options("$<$:-Wno-unused-variable;-Wno-unused-function>") endif() # Define the source files for the static library @@ -163,8 +210,10 @@ set(ENCODER_LIB_SRC_LIST encoder/3rdparty/android_astc_decomp.cpp encoder/3rdparty/tinyexr.cpp transcoder/basisu_transcoder.cpp +) - encoder/basisu_astc_hdr_6x6_enc.h +set(ENCODER_LIB_HDR_LIST + encoder/basisu_astc_hdr_6x6_enc.h encoder/basisu_astc_hdr_common.h encoder/basisu_backend.h encoder/basisu_basis_file.h @@ -205,121 +254,103 @@ set(ENCODER_LIB_SRC_LIST transcoder/basisu_transcoder_uastc.h transcoder/basisu_transcoder.h transcoder/basisu.h - zstd/zstd.h ) -if (ZSTD) +if (BASISU_ZSTD) set(ENCODER_LIB_SRC_LIST ${ENCODER_LIB_SRC_LIST} zstd/zstd.c) + set(ENCODER_LIB_HDR_LIST ${ENCODER_LIB_HDR_LIST} zstd/zstd.h) endif() # Create the static library -add_library(basisu_encoder STATIC ${ENCODER_LIB_SRC_LIST}) +add_library(basisu_encoder STATIC ${ENCODER_LIB_SRC_LIST} ${ENCODER_LIB_HDR_LIST}) -# Create the basisu executable and link against the static library -add_executable(basisu basisu_tool.cpp) -target_link_libraries(basisu PRIVATE basisu_encoder) +target_include_directories(basisu_encoder +INTERFACE + $ + $ # So KTX-Software can use it. +) +# PUBLIC so it will be exported to dependent programs. +target_compile_features(basisu_encoder PUBLIC cxx_std_17) -# Create the new example executable and link against the static library -if(EXAMPLES) - add_executable(examples example/example.cpp) - target_link_libraries(examples PRIVATE basisu_encoder) +if (EMSCRIPTEN) + target_compile_definitions(basisu_encoder PUBLIC BASISU_SUPPORT_SSE=0) +else() + target_compile_definitions(basisu_encoder PUBLIC + BASISU_SUPPORT_SSE=$,1,0> + ) + target_compile_options(basisu_encoder PRIVATE + "$<$,$>:-msse4.1>" + ) endif() -#if (MSVC) - target_sources(basisu PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/basisu.manifest") - if(EXAMPLES) - target_sources(examples PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/basisu.manifest") - endif() -#endif() - -if (ZSTD) - target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=1) - if(EXAMPLES) - target_compile_definitions(examples PRIVATE BASISD_SUPPORT_KTX2_ZSTD=1) - endif() +target_compile_definitions(basisu_encoder PRIVATE "BASISD_SUPPORT_KTX2_ZSTD=$,1,0>") +if (BASISU_OPENCL) + # basisu uses this to confirm the library has been compiled with OpenCL support hence PUBLIC. + target_compile_definitions(basisu_encoder PUBLIC BASISU_SUPPORT_OPENCL=1) + if (NOT WIN32) # True when the target system is Windows. + # For Non-Windows builds, use the system OpenCL headers/libs, if cmake found them. + target_include_directories(basisu_encoder PRIVATE ${OpenCL_INCLUDE_DIRS}) + target_link_libraries(basisu_encoder PRIVATE ${OpenCL_LIBRARIES}) + else() + # For Windows builds, we use our local copies of the OpenCL import lib and Khronos headers. + target_include_directories(basisu_encoder PRIVATE "OpenCL") + if (BASISU_BUILD_X64) + target_link_libraries(basisu_encoder PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/OpenCL/lib/OpenCL64.lib") + else() + target_link_libraries(basisu_encoder PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/OpenCL/lib/OpenCL.lib") + endif() + endif() else() - target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0) - if(EXAMPLES) - target_compile_definitions(examples PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0) - endif() + target_compile_definitions(basisu_encoder PUBLIC BASISU_SUPPORT_OPENCL=0) endif() if (NOT MSVC) - # For Non-Windows builds, let cmake try and find the system OpenCL headers/libs for us. - if (OPENCL AND OPENCL_FOUND) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_OPENCL=1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_OPENCL=1") - - target_include_directories(basisu PRIVATE ${OpenCL_INCLUDE_DIRS}) - if(EXAMPLES) - target_include_directories(examples PRIVATE ${OpenCL_INCLUDE_DIRS}) - endif() - target_include_directories(basisu_encoder PRIVATE ${OpenCL_INCLUDE_DIRS}) - set(BASISU_EXTRA_LIBS ${OpenCL_LIBRARIES}) + # Only link 'm' on non-Windows platforms (Linux, macOS) + if (NOT WIN32) + target_link_libraries(basisu_encoder INTERFACE m) endif() -else() - # For Windows builds, we use our local copies of the OpenCL import lib and Khronos headers. - if (OPENCL) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBASISU_SUPPORT_OPENCL=1") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASISU_SUPPORT_OPENCL=1") - - target_include_directories(basisu PRIVATE "OpenCL") - if(EXAMPLES) - target_include_directories(examples PRIVATE "OpenCL") - endif() - target_include_directories(basisu_encoder PRIVATE "OpenCL") - - if (BUILD_X64) - target_link_libraries(basisu PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/OpenCL/lib/OpenCL64.lib") - if(EXAMPLES) - target_link_libraries(examples PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/OpenCL/lib/OpenCL64.lib") - endif() - else() - target_link_libraries(basisu PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/OpenCL/lib/OpenCL.lib") - if(EXAMPLES) - target_link_libraries(examples PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/OpenCL/lib/OpenCL.lib") - endif() - endif() + if(Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) + target_link_libraries(basisu_encoder INTERFACE Threads::Threads) + elseif(LINUX) + target_link_libraries(basisu_encoder INTERFACE dl Threads::Threads) + endif() + if (BASISU_STATIC AND MINGW) + target_link_options(basisu_encoder INTERFACE -static-libgcc -static-libstdc++ -static) endif() endif() -if (NOT MSVC) - target_link_libraries(basisu PRIVATE m pthread ${BASISU_EXTRA_LIBS}) - if(EXAMPLES) - target_link_libraries(examples PRIVATE m pthread ${BASISU_EXTRA_LIBS}) - endif() +macro(set_common_executable_properties target) + #if (MSVC) + target_sources(${target} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/basisu.manifest") + #endif() + target_link_libraries(${target} PRIVATE basisu_encoder) + if (NOT BASISU_STATIC AND NOT EMSCRIPTEN AND NOT WIN32) + target_link_options(${target} PUBLIC -Wl,-rpath .) + endif() +endmacro() + +if (BASISU_TOOL) + # Create the basisu executable and link against the static library + add_executable(basisu basisu_tool.cpp) + set_common_executable_properties(basisu) +endif() + +if (BASISU_EXAMPLES) + # Create the new example executable and link against the static library + add_executable(examples example/example.cpp) + set_common_executable_properties(examples) endif() -if (NOT EMSCRIPTEN) +if (BASISU_TOOL AND NOT EMSCRIPTEN) if (UNIX) - if (CMAKE_BUILD_TYPE STREQUAL Release) + if (CMAKE_BUILD_TYPE STREQUAL "Release") if (APPLE) add_custom_command(TARGET basisu POST_BUILD COMMAND strip -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu) - #message("strip command: strip -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu") + #message("strip command: strip -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu") else() add_custom_command(TARGET basisu POST_BUILD COMMAND strip -g -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu) - #message("strip command: strip -g -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu") + #message("strip command: strip -g -X -x ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/basisu") endif() endif() endif() endif() - -if (MSVC) - set_target_properties(basisu PROPERTIES - RUNTIME_OUTPUT_NAME "basisu" - RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ) - - if(EXAMPLES) - set_target_properties(examples PROPERTIES - RUNTIME_OUTPUT_NAME "examples" - RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ) - endif() -endif() diff --git a/LICENSES/BSD-3-clause.txt b/LICENSES/BSD-3-Clause.txt similarity index 100% rename from LICENSES/BSD-3-clause.txt rename to LICENSES/BSD-3-Clause.txt diff --git a/LICENSES/Zlib.txt b/LICENSES/Zlib.txt deleted file mode 100644 index 508a9b5b..00000000 --- a/LICENSES/Zlib.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) - -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. diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 00000000..a63c36ac --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,39 @@ +version = 1 +SPDX-PackageName = "basis_universal" +SPDX-PackageDownloadLocation = "https://github.com/BinomialLLC/basis_universal" + +[[annotations]] +path = "**" +precedence = "aggregate" +SPDX-FileCopyrightText = ["2019-2024 Binomial LLC", "2016 The Android Open Source Project"] +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = "OpenCL/**" +precedence = "aggregate" +SPDX-FileCopyrightText = "2008-2020 The Khronos Group Inc." +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = "zstd/**" +precedence = "aggregate" +SPDX-FileCopyrightText = "2016-present Facebook, Inc." +SPDX-License-Identifier = "BSD-3-Clause" + +[[annotations]] +path = "encoder/3rdparty/tinyexr.h" +precedence = "aggregate" +SPDX-FileCopyrightText = ["2014 - 2021, Syoyo Fujita and many contributors.", "2002 Industrial Light & Magic, a division of Lucas"] +SPDX-License-Identifier = "BSD-3-Clause" + +[[annotations]] +path = "encoder/3rdparty/qoi.h" +precedence = "aggregate" +SPDX-FileCopyrightText = "2021 Dominic Szablewski - https://phoboslab.org" +SPDX-License-Identifier = "MIT" + +[[annotations]] +path = "encoder/3rdparty/tinydds.h" +precedence = "aggregate" +SPDX-FileCopyrightText = "2019 DeanoC" +SPDX-License-Identifier = "MIT" diff --git a/basisu_tool.cpp b/basisu_tool.cpp index 430f9d69..4c63f461 100644 --- a/basisu_tool.cpp +++ b/basisu_tool.cpp @@ -4670,10 +4670,10 @@ static int main_internal(int argc, const char **argv) opencl_force_serialization = true; } -#ifndef BASISU_SUPPORT_OPENCL +#if !BASISU_SUPPORT_OPENCL if (use_opencl) { - fprintf(stderr, "WARNING: -opencl specified, but OpenCL support was not enabled at compile time! With cmake, use -D OPENCL=1. Falling back to CPU compression.\n"); + fprintf(stderr, "WARNING: -opencl specified, but OpenCL support was not enabled at compile time! With cmake, use -D BASISU_OPENCL=1. Falling back to CPU compression.\n"); } #endif diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 00000000..ecb3b59e --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,7 @@ + +* + +!.gitignore +!ocl_kernels.cl +!clean.bat +!readme.txt diff --git a/build/.gitignore b/build/.gitignore new file mode 100644 index 00000000..3467e412 --- /dev/null +++ b/build/.gitignore @@ -0,0 +1,5 @@ + +* + +!.gitignore +!readme.txt