early-access version 2853

This commit is contained in:
pineappleEA
2022-07-23 03:01:36 +02:00
parent 1f2b5081b5
commit 1f111bb69c
8955 changed files with 418777 additions and 999 deletions

View File

@@ -0,0 +1,108 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ca40f8..84fcb18 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -174,7 +174,6 @@ set(KTX_MAIN_SRC
lib/basisu/transcoder/basisu_transcoder.cpp
lib/basisu/transcoder/basisu_transcoder.h
lib/basisu/transcoder/basisu.h
- lib/basisu/zstd/zstd.c
lib/checkheader.c
lib/dfdutils/createdfd.c
lib/dfdutils/colourspaces.c
@@ -284,7 +283,6 @@ macro(commom_lib_settings lib write)
$<INSTALL_INTERFACE:lib/basisu/transcoder>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib/basisu/zstd>
- $<INSTALL_INTERFACE:lib/basisu/zstd>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/other_include>
$<INSTALL_INTERFACE:other_include>
@@ -361,6 +359,11 @@ macro(commom_lib_settings lib write)
endif()
if(WIN32)
+ find_package(zstd CONFIG REQUIRED)
+ target_link_libraries(
+ ${lib} PRIVATE
+ $<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>
+ )
# By wrapping in generator expression we force multi configuration
# generators (like Visual Studio) to take the exact path and not
# change it.
diff --git a/lib/basisu/CMakeLists.txt b/lib/basisu/CMakeLists.txt
index 492233a..8786d16 100644
--- a/lib/basisu/CMakeLists.txt
+++ b/lib/basisu/CMakeLists.txt
@@ -146,7 +146,7 @@ set(BASISU_SRC_LIST ${COMMON_SRC_LIST}
)
if (ZSTD)
- set(BASISU_SRC_LIST ${BASISU_SRC_LIST} zstd/zstd.c)
+ set(ZSTD_LIBRARIES "$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>")
endif()
if (APPLE)
@@ -165,6 +165,10 @@ else()
target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0)
endif()
+if(ZSTD_LIBRARIES)
+ target_link_libraries(basisu ${ZSTD_LIBRARIES})
+endif()
+
if (NOT MSVC)
# For Non-Windows builds, let cmake try and find the system OpenCL headers/libs for us.
if (OPENCL_FOUND)
diff --git a/lib/basisu/webgl/encoder/CMakeLists.txt b/lib/basisu/webgl/encoder/CMakeLists.txt
index 588d91b..0b38012 100644
--- a/lib/basisu/webgl/encoder/CMakeLists.txt
+++ b/lib/basisu/webgl/encoder/CMakeLists.txt
@@ -34,9 +34,7 @@ if (EMSCRIPTEN)
)
if (KTX2_ZSTANDARD)
- set(SRC_LIST ${SRC_LIST}
- ../../zstd/zstd.c
- )
+ set(ZSTD_LIBRARIES "$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>")
set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=1)
else()
set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=0)
@@ -56,6 +54,10 @@ if (EMSCRIPTEN)
target_include_directories(basis_encoder.js PRIVATE ../../transcoder)
+ if(ZSTD_LIBRARIES)
+ target_link_libraries(basis_encoder.js ${ZSTD_LIBRARIES})
+ endif()
+
set_target_properties(basis_encoder.js PROPERTIES
OUTPUT_NAME "basis_encoder"
SUFFIX ".js"
diff --git a/lib/basisu/webgl/transcoder/CMakeLists.txt b/lib/basisu/webgl/transcoder/CMakeLists.txt
index 372653d..f75e3a3 100644
--- a/lib/basisu/webgl/transcoder/CMakeLists.txt
+++ b/lib/basisu/webgl/transcoder/CMakeLists.txt
@@ -28,9 +28,7 @@ if (EMSCRIPTEN)
endif()
if (KTX2_ZSTANDARD)
- set(SRC_LIST ${SRC_LIST}
- ../../zstd/zstddeclib.c
- )
+ set(ZSTD_LIBRARIES "$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>")
set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=1)
else()
set(ZSTD_DEFINITION BASISD_SUPPORT_KTX2_ZSTD=0)
@@ -45,6 +43,10 @@ if (EMSCRIPTEN)
target_compile_options(basis_transcoder.js PRIVATE -O3 -fno-strict-aliasing)
target_include_directories(basis_transcoder.js PRIVATE ../../transcoder)
+ if(ZSTD_LIBRARIES)
+ target_link_libraries(basis_transcoder.js ${ZSTD_LIBRARIES})
+ endif()
+
set_target_properties(basis_transcoder.js PROPERTIES
OUTPUT_NAME "basis_transcoder"
SUFFIX ".js"

View File

@@ -0,0 +1,17 @@
diff --git a/cmake/version.cmake b/cmake/version.cmake
index 4094df1a..3b2af3bb 100644
--- a/cmake/version.cmake
+++ b/cmake/version.cmake
@@ -108,8 +108,10 @@ function(generate_version _var )
set(${_var} "${KTX_VERSION}" PARENT_SCOPE)
endfunction()
-# Get latest tag
-git_describe_raw(KTX_VERSION_FULL --abbrev=0 --match v[0-9]*)
+if (!KTX_VERSION_FULL)
+ # Get latest tag
+ git_describe_raw(KTX_VERSION_FULL --abbrev=0 --match v[0-9]*)
+endif()
#message("KTX full version: ${KTX_VERSION_FULL}")
# generate_version(TOKTX_VERSION tools/toktx)

77
externals/vcpkg/ports/ktx/portfile.cmake vendored Executable file
View File

@@ -0,0 +1,77 @@
set(PORT_VERSION 4.1.0-rc1)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/KTX-Software
REF af6df0267b07bf5d4278837e5350f97bcbdcc870 #v${PORT_VERSION}
SHA512 00e5c37ec1922bae7903e3b51ac61e44d815bd606e12104c87b3c8d89e04b5d81f8d502712d8d6c9420aa21289c93c6ef01d0a4091062d03aae07b7fbfce5f74
HEAD_REF master
FILE_DISAMBIGUATOR 1
PATCHES
0001-Use-vcpkg-zstd.patch
0002-Fix-versioning.patch
)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_acquire_msys(MSYS_ROOT
PACKAGES
bash
DIRECT_PACKAGES
# Required for "getopt"
"https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-1-x86_64.pkg.tar.zst"
ff951c2cd96d0fda87bacb505c93e4aa1f9aeb35f829c52b5a7862d05e167f69605a4927a0e7197b5ee2b2fa5cb56619ad7a6ba293ede4765fdcacedf2ed35da
)
vcpkg_add_to_path("${MSYS_ROOT}/usr/bin")
file(REMOVE
"${SOURCE_PATH}/other_include/zstd.h"
"${SOURCE_PATH}/other_include/zstd_errors.h")
endif()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
tools KTX_FEATURE_TOOLS
vulkan KTX_FEATURE_VULKAN
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DKTX_VERSION_FULL=v${PORT_VERSION}
-DKTX_FEATURE_TESTS=OFF
-DKTX_FEATURE_LOADTEST_APPS=OFF
-DKTX_FEATURE_STATIC_LIBRARY=${ENABLE_STATIC}
${FEATURE_OPTIONS}
DISABLE_PARALLEL_CONFIGURE
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
if(tools IN_LIST FEATURES)
vcpkg_copy_tools(
TOOL_NAMES
toktx
ktxsc
ktxinfo
ktx2ktx2
ktx2check
AUTO_CLEAN
)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
endif()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ktx)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
if("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
configure_file("${SOURCE_PATH}/LICENSE.md" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
file(GLOB LICENSE_FILES "${SOURCE_PATH}/LICENSES/*")
file(COPY ${LICENSE_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSES")

27
externals/vcpkg/ports/ktx/vcpkg.json vendored Executable file
View File

@@ -0,0 +1,27 @@
{
"name": "ktx",
"version-semver": "4.1.0-rc1",
"description": "A small library of functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™ and Vulkan® textures from them",
"homepage": "https://github.com/KhronosGroup/KTX-Software",
"license": "Apache-2.0",
"supports": "!(uwp | x86 | arm64)",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
},
"zstd"
],
"features": {
"tools": {
"description": "Build tools"
},
"vulkan": {
"description": "Build Vulkan support"
}
}
}