diff options
| author | Stephen Just <stephenjust@gmail.com> | 2021-01-10 23:59:25 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-10 23:59:25 -0800 |
| commit | 2aec96fc77e69cdcbb4c39352787e5bf93bf9645 (patch) | |
| tree | 48bdccd7d25a75bd45d2a9a89248b1eb8bf7a39b | |
| parent | 7fee6a4756c8f276d63ebb84385c0be579817db7 (diff) | |
| download | vcpkg-2aec96fc77e69cdcbb4c39352787e5bf93bf9645.tar.gz vcpkg-2aec96fc77e69cdcbb4c39352787e5bf93bf9645.zip | |
[KTX] Add port (#15336)
* [KTX] Add port
* Apply formatting
* Install bash for windows
* Attempt to fix bash root and osx build since I can't repro either
* Fix windows build
* Disable on x86 which is not supported, use vcpkg-supplied zstd headers
* Fixes
* Fix cut/paste error
* Update based on review comments
| -rw-r--r-- | ports/ktx/0001-Use-vcpkg-zstd.patch | 16 | ||||
| -rw-r--r-- | ports/ktx/0002-Fix-versioning.patch | 17 | ||||
| -rw-r--r-- | ports/ktx/portfile.cmake | 75 | ||||
| -rw-r--r-- | ports/ktx/vcpkg.json | 19 |
4 files changed, 127 insertions, 0 deletions
diff --git a/ports/ktx/0001-Use-vcpkg-zstd.patch b/ports/ktx/0001-Use-vcpkg-zstd.patch new file mode 100644 index 000000000..9a39573bf --- /dev/null +++ b/ports/ktx/0001-Use-vcpkg-zstd.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index de38d5fe..1244ce55 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -283,9 +283,10 @@ macro(commom_lib_settings lib write ) + endif() + + if(WIN32) ++ find_package(zstd CONFIG REQUIRED) + target_link_libraries( + ${lib} +- ${CMAKE_CURRENT_SOURCE_DIR}/other_lib/win/Release-x64/zstd_static.lib ++ $<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/ports/ktx/0002-Fix-versioning.patch b/ports/ktx/0002-Fix-versioning.patch new file mode 100644 index 000000000..1e5098806 --- /dev/null +++ b/ports/ktx/0002-Fix-versioning.patch @@ -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) diff --git a/ports/ktx/portfile.cmake b/ports/ktx/portfile.cmake new file mode 100644 index 000000000..a4ef51f4f --- /dev/null +++ b/ports/ktx/portfile.cmake @@ -0,0 +1,75 @@ +vcpkg_fail_port_install(ON_TARGET "UWP" ON_ARCH "x86")
+
+set(PORT_VERSION 4.0.0-beta5)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO KhronosGroup/KTX-Software
+ REF v${PORT_VERSION}
+ SHA512 8c63be2a7c55b8fdb8c8aee1f7cacdc2105e54061691c69cddbd3bed49f8e907262cc3ae83dfd723e76f0911bd6c85f5bbc19347998988a1fc6ecae26bfecf33
+ HEAD_REF master
+ 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
+ tools KTX_FEATURE_TOOLS
+ vulkan KTX_FEATURE_VULKAN
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DKTX_VERSION_FULL=v${PORT_VERSION}
+ -DKTX_FEATURE_TESTS=OFF
+ -DKTX_FEATURE_LOADTEST_APPS=OFF
+ -DKTX_FEATURE_STATIC_LIBRARY=${ENABLE_STATIC}
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_install_cmake()
+
+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_fixup_cmake_targets(CONFIG_PATH lib/cmake/ktx TARGET_PATH share/${PORT})
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
+
+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")
\ No newline at end of file diff --git a/ports/ktx/vcpkg.json b/ports/ktx/vcpkg.json new file mode 100644 index 000000000..0e9be8732 --- /dev/null +++ b/ports/ktx/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "ktx", + "version-string": "4.0.0-beta5", + "port-version": 1, + "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", + "supports": "!(uwp | x86)", + "dependencies": [ + "zstd" + ], + "features": { + "tools": { + "description": "Build tools" + }, + "vulkan": { + "description": "Build Vulkan support" + } + } +} |
