From d399db85b6aac757b038ecbc7fe99a9c51fcc5e7 Mon Sep 17 00:00:00 2001 From: Tom Conder Date: Mon, 6 Apr 2026 15:33:58 -0500 Subject: [PATCH] [assimp] add draco feature (#50974) Co-authored-by: Kai Pastor --- ports/assimp/build_fixes.patch | 19 ++++++++++++++++++- ports/assimp/portfile.cmake | 11 ++++++++++- ports/assimp/vcpkg.json | 12 ++++++++++-- versions/a-/assimp.json | 5 +++++ versions/baseline.json | 2 +- 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ports/assimp/build_fixes.patch b/ports/assimp/build_fixes.patch index c02ea61edb..c081ce7c2f 100644 --- a/ports/assimp/build_fixes.patch +++ b/ports/assimp/build_fixes.patch @@ -81,16 +81,33 @@ index 1242bba..eba5242 100644 USE_PKGCONFIG(UNZIP minizip) ENDIF() ENDIF () +@@ -717,9 +715,8 @@ ELSE() + SET(DRACO_TESTS OFF CACHE BOOL "" FORCE) + +- IF(ASSIMP_HUNTER_ENABLED) +- hunter_add_package(draco) +- find_package(draco CONFIG REQUIRED) +- SET(draco_LIBRARIES draco::draco) +- ELSE() ++ IF(1) ++ find_package(draco CONFIG REQUIRED) ++ SET(draco_LIBRARIES draco::draco) ++ ELSE() + # Draco 1.4.1 has many warnings and will not build with /WX or -Werror + # See https://github.com/google/draco/issues/672 diff --git a/cmake-modules/assimp-plain-config.cmake.in b/cmake-modules/assimp-plain-config.cmake.in index 6551dcb..dd65b0b 100644 --- a/cmake-modules/assimp-plain-config.cmake.in +++ b/cmake-modules/assimp-plain-config.cmake.in -@@ -1,5 +1,17 @@ +@@ -1,5 +1,20 @@ @PACKAGE_INIT@ +include(CMakeFindDependencyMacro) +if(NOT "@BUILD_SHARED_LIBS@") + find_dependency(zip CONFIG) ++ if(@ASSIMP_BUILD_DRACO@) ++ find_dependency(draco CONFIG) ++ endif() + find_dependency(unofficial-minizip CONFIG) + find_dependency(pugixml CONFIG) + find_dependency(poly2tri CONFIG) diff --git a/ports/assimp/portfile.cmake b/ports/assimp/portfile.cmake index e6b3a0d9f0..1186272dc5 100644 --- a/ports/assimp/portfile.cmake +++ b/ports/assimp/portfile.cmake @@ -27,6 +27,11 @@ file(REMOVE_RECURSE "${SOURCE_PATH}/contrib/zlib") set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS") set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS") +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + draco ASSIMP_BUILD_DRACO +) + vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS @@ -37,6 +42,7 @@ vcpkg_cmake_configure( -DASSIMP_WARNINGS_AS_ERRORS=OFF -DASSIMP_IGNORE_GIT_HASH=ON -DASSIMP_INSTALL_PDB=OFF + ${FEATURE_OPTIONS} ) vcpkg_cmake_install() @@ -71,7 +77,10 @@ if(ASSIMP_DBG) endif() if("${VCPKG_LIBRARY_LINKAGE}" STREQUAL "static") - set(assimp_PC_REQUIRES "draco polyclipping pugixml minizip") + set(assimp_PC_REQUIRES "polyclipping pugixml minizip") + if("draco" IN_LIST FEATURES) + string(APPEND assimp_PC_REQUIRES " draco") + endif() set(assimp_LIBS_REQUIRES "-lpoly2tri") vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/assimp.pc" "Libs:" "Requires.private: ${assimp_PC_REQUIRES}\nLibs:") diff --git a/ports/assimp/vcpkg.json b/ports/assimp/vcpkg.json index 66fce3e988..e3d97c4b6c 100644 --- a/ports/assimp/vcpkg.json +++ b/ports/assimp/vcpkg.json @@ -1,11 +1,11 @@ { "name": "assimp", "version": "6.0.4", + "port-version": 1, "description": "The Open Asset import library", "homepage": "https://github.com/assimp/assimp", "license": "BSD-3-Clause", "dependencies": [ - "draco", "jhasse-poly2tri", "kubazip", "minizip", @@ -23,5 +23,13 @@ "host": true }, "zlib" - ] + ], + "features": { + "draco": { + "description": "Enable Draco compressed mesh support", + "dependencies": [ + "draco" + ] + } + } } diff --git a/versions/a-/assimp.json b/versions/a-/assimp.json index 0c1f5d83fe..7f7aabcdf7 100644 --- a/versions/a-/assimp.json +++ b/versions/a-/assimp.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "534707328f097e773a0de049e8de9bd0f8a620ee", + "version": "6.0.4", + "port-version": 1 + }, { "git-tree": "844278e86f9a397d023eec5b4395f81f5739c3ad", "version": "6.0.4", diff --git a/versions/baseline.json b/versions/baseline.json index 54b23d0313..e538690840 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -334,7 +334,7 @@ }, "assimp": { "baseline": "6.0.4", - "port-version": 0 + "port-version": 1 }, "astr": { "baseline": "0.3.1",