Skip to content

Commit

Permalink
[ktx] Update to v4.3.0-beta1 and fix unix2dos command does not exist (m…
Browse files Browse the repository at this point in the history
…icrosoft#36007)

* update to v4.3.0-beta1

* update version

* delete msys

* update version

* modify patch

* update version

* add pathc

* update version

* delete patch

* update version

* fix download method

* update version

* portfile

* update version

* portfile

* update version
  • Loading branch information
jimwang118 authored Jan 11, 2024
1 parent 3938ee3 commit c9140a3
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 38 deletions.
51 changes: 25 additions & 26 deletions ports/ktx/0001-Use-vcpkg-zstd.patch
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0653da5..1265f3d 100644
index 9a56491..d7ca937 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -265,7 +265,6 @@ set(KTX_MAIN_SRC
@@ -345,7 +345,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
@@ -448,7 +447,6 @@ macro(common_libktx_settings target enable_write library_type)
@@ -532,7 +531,6 @@ macro(common_libktx_settings target enable_write library_type)
$<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>
@@ -538,6 +536,11 @@ macro(common_libktx_settings target enable_write library_type)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/utils>
$<INSTALL_INTERFACE:utils>
@@ -627,6 +625,11 @@ macro(common_libktx_settings target enable_write library_type)
target_compile_definitions(${target} PUBLIC KTX_FEATURE_KTX2)
endif()

Expand Down Expand Up @@ -46,19 +46,20 @@ index 6386ba2..537bf4f 100644

include("${CMAKE_CURRENT_LIST_DIR}/KtxTargets.cmake")
diff --git a/lib/basisu/CMakeLists.txt b/lib/basisu/CMakeLists.txt
index 492233a..2663169 100644
index 492233a..152ceb5 100644
--- a/lib/basisu/CMakeLists.txt
+++ b/lib/basisu/CMakeLists.txt
@@ -146,7 +146,7 @@ set(BASISU_SRC_LIST ${COMMON_SRC_LIST}
@@ -145,9 +145,6 @@ set(BASISU_SRC_LIST ${COMMON_SRC_LIST}
transcoder/basisu_transcoder.cpp
)

if (ZSTD)
-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()
-endif()

if (APPLE)
@@ -165,6 +165,10 @@ else()
set(BIN_DIRECTORY "bin_osx")
@@ -165,6 +162,10 @@ else()
target_compile_definitions(basisu PRIVATE BASISD_SUPPORT_KTX2_ZSTD=0)
endif()

Expand All @@ -70,54 +71,52 @@ index 492233a..2663169 100644
# 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..edd7457 100644
index 588d91b..a337b13 100644
--- a/lib/basisu/webgl/encoder/CMakeLists.txt
+++ b/lib/basisu/webgl/encoder/CMakeLists.txt
@@ -34,9 +34,7 @@ if (EMSCRIPTEN)
@@ -34,9 +34,6 @@ 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)
@@ -55,6 +52,10 @@ if (EMSCRIPTEN)
target_compile_options(basis_encoder.js PRIVATE -fno-strict-aliasing -O3)

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..3c9ed0c 100644
index 372653d..5ebc3cf 100644
--- a/lib/basisu/webgl/transcoder/CMakeLists.txt
+++ b/lib/basisu/webgl/transcoder/CMakeLists.txt
@@ -28,9 +28,7 @@ if (EMSCRIPTEN)
@@ -28,9 +28,6 @@ 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)
@@ -44,6 +41,10 @@ if (EMSCRIPTEN)
target_compile_definitions(basis_transcoder.js PRIVATE NDEBUG BASISD_SUPPORT_UASTC=1 BASISD_SUPPORT_BC7=1 BASISD_SUPPORT_ATC=0 BASISD_SUPPORT_ASTC_HIGHER_OPAQUE_QUALITY=0 BASISD_SUPPORT_PVRTC2=0 BASISD_SUPPORT_FXT1=0 BASISD_SUPPORT_ETC2_EAC_RG11=0 BASISU_SUPPORT_ENCODING=0 ${KTX2_DEFINITION} ${ZSTD_DEFINITION} )
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"
18 changes: 9 additions & 9 deletions ports/ktx/0004-quirks.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9775c89..a4dfc2a 100644
index 1500844..810914e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -235,7 +235,7 @@ include(cmake/mkvk.cmake)
# Global compile & link options including optimization flags
if(MSVC)
add_compile_options( /W4;/WX )
@@ -263,7 +263,7 @@ if(MSVC)
# ";" argument separator is problematic. Can't use a GenEx `$<IF:`
# because `/W4;/WX` is returned as a single string.
add_compile_options( /W4;$<$<BOOL:${KTX_WERROR}>:/WX> )
- add_compile_options( $<IF:$<CONFIG:Debug>,/Gz,/O2> )
+ add_compile_options( $<IF:$<CONFIG:Debug>,,/O2> )
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU"
OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_compile_options(-Wall -Wextra -Werror)
@@ -851,6 +851,7 @@ if(EMSCRIPTEN)
# Enable UTF-8 support
add_compile_options( $<$<C_COMPILER_ID:MSVC>:/utf-8> )
add_compile_options( $<$<CXX_COMPILER_ID:MSVC>:/utf-8> )
@@ -946,6 +946,7 @@ if(EMSCRIPTEN)
endif()

add_library( objUtil STATIC
Expand Down
5 changes: 4 additions & 1 deletion ports/ktx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO KhronosGroup/KTX-Software
REF "v${VERSION}"
SHA512 9ef0100a402321b00faa822eb2a50fd0d1e17fa703edacdbacf9231484d911cc254aed1fa517988537dc5b7059921a793edaeb92e8b2965d25672cd9a2589a0f
SHA512 5a89f8986464705ec36ac1becaddd0ff335e4c3c235468aaef0e963fcfeda4c0d669a086b91e61c16a3ae9e1fa5bf456dccf12cc65720e1a22e7cc0f30552541
HEAD_REF master
PATCHES
0001-Use-vcpkg-zstd.patch
Expand All @@ -21,6 +21,9 @@ if(VCPKG_TARGET_IS_WINDOWS)
# Required for "getopt"
"https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst"
da26540881cd5734072717133307e5d1a27a60468d3656885507833b80f24088c5382eaa0234b30bdd9e8484a6638b4514623f5327f10b19eed36f12158e8edb
# Required for "dos2unix"
"https://mirror.msys2.org/msys/x86_64/dos2unix-7.5.1-1-x86_64.pkg.tar.zst"
83d85e6ccea746ef9e8153a0d605e774dbe7efc0ee952804acfee4ffd7e3b0386a353b45ff989dd99bc3ce75968209fea3d246ad2af88bbb5c4eca12fc5a8f92
)
vcpkg_add_to_path("${MSYS_ROOT}/usr/bin")
vcpkg_list(APPEND OPTIONS "-DBASH_EXECUTABLE=${MSYS_ROOT}/usr/bin/bash.exe")
Expand Down
2 changes: 1 addition & 1 deletion ports/ktx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ktx",
"version-semver": "4.3.0-alpha3",
"version-semver": "4.3.0-beta1",
"description": [
"The Khronos KTX library and tools.",
"Functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures from them."
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3957,7 +3957,7 @@
"port-version": 0
},
"ktx": {
"baseline": "4.3.0-alpha3",
"baseline": "4.3.0-beta1",
"port-version": 0
},
"kubazip": {
Expand Down
5 changes: 5 additions & 0 deletions versions/k-/ktx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e5d9ea81aabca83f512d64a46fd545d353552034",
"version-semver": "4.3.0-beta1",
"port-version": 0
},
{
"git-tree": "47559725520a0015829f65dfda7f3b28a7a7d78f",
"version-semver": "4.3.0-alpha3",
Expand Down

0 comments on commit c9140a3

Please sign in to comment.