From 3936614e119358114e5109872df10255fefa3a20 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 23 Jan 2025 21:43:06 +1100 Subject: [PATCH 1/7] Update cesium-native. --- native~/Shared/src/CesiumImpl.h | 3 ++- native~/extern/cesium-native | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/native~/Shared/src/CesiumImpl.h b/native~/Shared/src/CesiumImpl.h index 59717ceb..faf9aa14 100644 --- a/native~/Shared/src/CesiumImpl.h +++ b/native~/Shared/src/CesiumImpl.h @@ -5,7 +5,8 @@ namespace CesiumForUnityNative { template -class CesiumImpl : public CesiumUtility::ReferenceCountedThreadSafe { +class CesiumImpl + : public CesiumUtility::ReferenceCountedThreadSafe> { public: CesiumImpl() = default; diff --git a/native~/extern/cesium-native b/native~/extern/cesium-native index 4d9a6382..1c99abb2 160000 --- a/native~/extern/cesium-native +++ b/native~/extern/cesium-native @@ -1 +1 @@ -Subproject commit 4d9a63829f67370908a7fb4627fc3c3791b50c02 +Subproject commit 1c99abb249d1ae3c1d42f5e4fa4e963f1a1a5177 From 917f4681583057375f727938689d981442a19d7e Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 23 Jan 2025 22:50:57 +1100 Subject: [PATCH 2/7] Better CesiumImpl implementation. The previous one wouldn't have called derived-class destructors properly. --- native~/Shared/src/CesiumImpl.h | 46 +++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/native~/Shared/src/CesiumImpl.h b/native~/Shared/src/CesiumImpl.h index faf9aa14..2cf03b1a 100644 --- a/native~/Shared/src/CesiumImpl.h +++ b/native~/Shared/src/CesiumImpl.h @@ -1,20 +1,56 @@ #pragma once -#include +#include + +#include +#include +#include namespace CesiumForUnityNative { -template -class CesiumImpl - : public CesiumUtility::ReferenceCountedThreadSafe> { +template class CesiumImpl { public: - CesiumImpl() = default; + /** + * @brief Adds a counted reference to this object. Use + * {@link CesiumUtility::IntrusivePointer} instead of calling this method + * directly. + */ + void addReference() const /*noexcept*/ { ++this->_referenceCount; } + + /** + * @brief Removes a counted reference from this object. When the last + * reference is removed, this method will delete this instance. Use + * {@link CesiumUtility::IntrusivePointer} instead of calling this method + * directly. + */ + void releaseReference() const /*noexcept*/ { + CESIUM_ASSERT(this->_referenceCount > 0); + const int32_t references = --this->_referenceCount; + if (references == 0) { + delete static_cast(this); + } + } + + /** + * @brief Returns the current reference count of this instance. + */ + std::int32_t getReferenceCount() const noexcept { + return this->_referenceCount; + } // Prevent copying of impl classes CesiumImpl(CesiumImpl&&) = delete; CesiumImpl(const CesiumImpl&) = delete; CesiumImpl& operator=(CesiumImpl&&) = delete; CesiumImpl& operator=(const CesiumImpl&) = delete; + +private: + CesiumImpl() noexcept = default; + ~CesiumImpl() noexcept { CESIUM_ASSERT(this->_referenceCount == 0); } + + friend TDerived; + + mutable std::atomic _referenceCount{0}; }; } // namespace CesiumForUnityNative From 48f933982cf6f33f06242cda1fbadac91ab0007b Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 24 Jan 2025 13:18:26 +1100 Subject: [PATCH 3/7] Try targetting .NET 9 because 7 is no longer installed on GH Actions --- Build~/Build~.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build~/Build~.csproj b/Build~/Build~.csproj index c2914223..16114628 100644 --- a/Build~/Build~.csproj +++ b/Build~/Build~.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net9.0 Build enable From 5b00338fd71e9db2e4db8c6e9b4a98bbb6f0958f Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 31 Jan 2025 18:53:51 +1100 Subject: [PATCH 4/7] Update cesium-native. --- native~/extern/cesium-native | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native~/extern/cesium-native b/native~/extern/cesium-native index 1c99abb2..cda58cd2 160000 --- a/native~/extern/cesium-native +++ b/native~/extern/cesium-native @@ -1 +1 @@ -Subproject commit 1c99abb249d1ae3c1d42f5e4fa4e963f1a1a5177 +Subproject commit cda58cd24f1404ccca4458a816a1d9ff4d3e2277 From 079a8bbce90e1f0d253335f5f692e7c43095569d Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 31 Jan 2025 21:03:48 +1100 Subject: [PATCH 5/7] Update cesium-native again. --- native~/extern/cesium-native | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native~/extern/cesium-native b/native~/extern/cesium-native index cda58cd2..88f7795d 160000 --- a/native~/extern/cesium-native +++ b/native~/extern/cesium-native @@ -1 +1 @@ -Subproject commit cda58cd24f1404ccca4458a816a1d9ff4d3e2277 +Subproject commit 88f7795d24f4e2c8302377d56a363cfedcd836bb From 5a58a4a6de0968c75dea1f97977e90bddb5845ba Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 31 Jan 2025 21:53:44 +1100 Subject: [PATCH 6/7] Update cesium-native. --- native~/extern/cesium-native | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native~/extern/cesium-native b/native~/extern/cesium-native index 88f7795d..79537a59 160000 --- a/native~/extern/cesium-native +++ b/native~/extern/cesium-native @@ -1 +1 @@ -Subproject commit 88f7795d24f4e2c8302377d56a363cfedcd836bb +Subproject commit 79537a59379102f222a9c9fd1a7ee18133757bd7 From 9e240455e334364f5ee4484e5072f789275aea5e Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 31 Jan 2025 22:42:46 +1100 Subject: [PATCH 7/7] Update ktx overlay port to match cesium-native's. --- .../ports/ktx/0005-no-vendored-libs.patch | 6 ++-- .../ports/ktx/0006-fix-ios-install.patch | 22 ++++++++++++++ .../ktx/CESIUM-0002-not-a-framework.patch | 17 ----------- .../CESIUM-0003-ios-normal-header-path.patch | 30 ------------------- native~/vcpkg/ports/ktx/portfile.cmake | 15 ++++------ native~/vcpkg/ports/ktx/vcpkg.json | 5 ++-- 6 files changed, 33 insertions(+), 62 deletions(-) create mode 100644 native~/vcpkg/ports/ktx/0006-fix-ios-install.patch delete mode 100644 native~/vcpkg/ports/ktx/CESIUM-0002-not-a-framework.patch delete mode 100644 native~/vcpkg/ports/ktx/CESIUM-0003-ios-normal-header-path.patch diff --git a/native~/vcpkg/ports/ktx/0005-no-vendored-libs.patch b/native~/vcpkg/ports/ktx/0005-no-vendored-libs.patch index 77cdd851..4c900225 100644 --- a/native~/vcpkg/ports/ktx/0005-no-vendored-libs.patch +++ b/native~/vcpkg/ports/ktx/0005-no-vendored-libs.patch @@ -1,10 +1,10 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index d7ca937..ffcbe95 100644 +index e99fb143..0f69adf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1059,10 +1059,10 @@ endif() - # except for building the ktx library. +@@ -1071,10 +1071,10 @@ endif() if((KTX_FEATURE_TOOLS OR KTX_FEATURE_TESTS) AND NOT TARGET fmt::fmt) + set(FMT_INSTALL OFF) set(FMT_SYSTEM_HEADERS ON) - add_subdirectory(other_projects/fmt) + find_package(fmt CONFIG REQUIRED) diff --git a/native~/vcpkg/ports/ktx/0006-fix-ios-install.patch b/native~/vcpkg/ports/ktx/0006-fix-ios-install.patch new file mode 100644 index 00000000..0af3fea6 --- /dev/null +++ b/native~/vcpkg/ports/ktx/0006-fix-ios-install.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e99fb143..072ea889 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -489,7 +489,7 @@ macro(common_libktx_settings target enable_write library_type) + CXX_STANDARD_REQUIRED YES + + ) +- if(IOS) ++ if(0) + set_target_properties(${target} PROPERTIES + FRAMEWORK TRUE + ) +@@ -1145,7 +1145,7 @@ endif() + # Use of this to install KHR/khr_df.h is due to CMake's failure to + # preserve the include source folder hierarchy. + # See https://gitlab.kitware.com/cmake/cmake/-/issues/16739. +-if (IOS) ++if (0) + set_source_files_properties( + include/KHR/khr_df.h + PROPERTIES MACOSX_PACKAGE_LOCATION Headers/KHR diff --git a/native~/vcpkg/ports/ktx/CESIUM-0002-not-a-framework.patch b/native~/vcpkg/ports/ktx/CESIUM-0002-not-a-framework.patch deleted file mode 100644 index 4458110f..00000000 --- a/native~/vcpkg/ports/ktx/CESIUM-0002-not-a-framework.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7b13753..b62b849 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -474,9 +474,9 @@ macro(common_libktx_settings target enable_write library_type) - - ) - if(IOS) -- set_target_properties(${target} PROPERTIES -- FRAMEWORK TRUE -- ) -+# set_target_properties(${target} PROPERTIES -+# FRAMEWORK TRUE -+# ) - endif() - - if( NOT ${library_type} STREQUAL STATIC ) diff --git a/native~/vcpkg/ports/ktx/CESIUM-0003-ios-normal-header-path.patch b/native~/vcpkg/ports/ktx/CESIUM-0003-ios-normal-header-path.patch deleted file mode 100644 index 6ad9c977..00000000 --- a/native~/vcpkg/ports/ktx/CESIUM-0003-ios-normal-header-path.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b62b849..d8c4745 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1133,18 +1133,18 @@ endif() - # Use of this to install KHR/khr_df.h is due to CMake's failure to - # preserve the include source folder hierarchy. - # See https://gitlab.kitware.com/cmake/cmake/-/issues/16739. --if (IOS) -- set_source_files_properties( -- include/KHR/khr_df.h -- PROPERTIES MACOSX_PACKAGE_LOCATION Headers/KHR -- ) --else() -+# if (IOS) -+# set_source_files_properties( -+# include/KHR/khr_df.h -+# PROPERTIES MACOSX_PACKAGE_LOCATION Headers/KHR -+# ) -+# else() - include(GNUInstallDirs) - install(FILES include/KHR/khr_df.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/KHR - COMPONENT dev - ) --endif() -+# endif() - - install(EXPORT KTXTargets - FILE KtxTargets.cmake diff --git a/native~/vcpkg/ports/ktx/portfile.cmake b/native~/vcpkg/ports/ktx/portfile.cmake index 40c64bbf..887362c8 100644 --- a/native~/vcpkg/ports/ktx/portfile.cmake +++ b/native~/vcpkg/ports/ktx/portfile.cmake @@ -1,18 +1,17 @@ -vcpkg_from_github( +vcpkg_from_git( OUT_SOURCE_PATH SOURCE_PATH - REPO KhronosGroup/KTX-Software - REF "v${VERSION}" - SHA512 5a89f8986464705ec36ac1becaddd0ff335e4c3c235468aaef0e963fcfeda4c0d669a086b91e61c16a3ae9e1fa5bf456dccf12cc65720e1a22e7cc0f30552541 - HEAD_REF master + URL "https://github.com/KhronosGroup/KTX-Software.git" + REF 91ace88675ac59a97e55d0378a6602a9ae6b98bd + FETCH_REF "v${VERSION}" + HEAD_REF main PATCHES 0001-Use-vcpkg-zstd.patch 0002-Fix-versioning.patch 0003-mkversion.patch 0004-quirks.patch 0005-no-vendored-libs.patch + 0006-fix-ios-install.patch CESIUM-0001-do-not-define-_DEBUG.patch - CESIUM-0002-not-a-framework.patch - CESIUM-0003-ios-normal-header-path.patch ) file(REMOVE "${SOURCE_PATH}/other_include/zstd_errors.h") @@ -50,8 +49,6 @@ vcpkg_cmake_configure( -DKTX_FEATURE_STATIC_LIBRARY=${ENABLE_STATIC} ${FEATURE_OPTIONS} ${OPTIONS} - # Do not regenerate headers (needs more dependencies) - -DCMAKE_DISABLE_FIND_PACKAGE_Vulkan=1 DISABLE_PARALLEL_CONFIGURE ) diff --git a/native~/vcpkg/ports/ktx/vcpkg.json b/native~/vcpkg/ports/ktx/vcpkg.json index 102e2813..94eea841 100644 --- a/native~/vcpkg/ports/ktx/vcpkg.json +++ b/native~/vcpkg/ports/ktx/vcpkg.json @@ -1,7 +1,6 @@ { "name": "ktx", - "version-semver": "4.3.0-beta1", - "port-version": 1, + "version-semver": "4.3.2", "description": [ "The Khronos KTX library and tools.", "Functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures from them." @@ -23,7 +22,7 @@ "features": { "tools": { "description": "Build tools", - "supports": "!android", + "supports": "!android & !uwp", "dependencies": [ "cxxopts", "fmt"