[meshoptimizer] Devendor basisu (#48068)

This commit is contained in:
Kai Pastor 2025-11-03 20:47:59 +01:00 committed by GitHub
parent 3b594f5749
commit 012f571749
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 52 additions and 30 deletions

View File

@ -0,0 +1,29 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ca03ab..af7eb9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -147,6 +147,11 @@ if(MESHOPT_BUILD_GLTFPACK)
target_compile_definitions(gltfpack PRIVATE WITH_BASISU)
target_link_libraries(gltfpack basisu_encoder)
set_source_files_properties(gltf/encodebasis.cpp PROPERTIES INCLUDE_DIRECTORIES ${BASISU_PATH}) # necessary because basisu_encoder doesn't export include directories
+ else()
+ find_package(basisu CONFIG REQUIRED)
+ find_package(Threads REQUIRED) # cf. further down
+ target_compile_definitions(gltfpack PRIVATE WITH_BASISU)
+ target_link_libraries(gltfpack basisu::basisu_encoder Threads::Threads)
endif()
if(NOT MESHOPT_GLTFPACK_LIBWEBP_PATH STREQUAL "")
diff --git a/gltf/encodebasis.cpp b/gltf/encodebasis.cpp
index 73cd962..74abf1b 100644
--- a/gltf/encodebasis.cpp
+++ b/gltf/encodebasis.cpp
@@ -22,7 +22,7 @@
#pragma GCC diagnostic ignored "-Wc++17-extensions"
#endif
-#include "encoder/basisu_comp.h"
+#include "basisu/encoder/basisu_comp.h"
struct BasisSettings
{

View File

@ -4,25 +4,13 @@ vcpkg_from_github(
REF v${VERSION}
SHA512 c00f2357c9c8d17804047c3c678f253bf13aa467b1dadc099a7958787e1725c501bd92a7837494d4831dd7c3428bbeb92353b70fd45ec71e88d753036318ab2f
HEAD_REF master
PATCHES
dependencies.diff
)
# If we want basisu support in gltfpack we need a particular fork of basisu
# We could modify this to support using the vcpkg version of basisu
# but since this is only necessary for the gltfpack tool and not for the
# meshopt lib it shouldn't be too nasty to just grab this repo
if ("gltfpack" IN_LIST FEATURES)
vcpkg_from_github(
OUT_SOURCE_PATH BASISU_PATH
REPO zeux/basis_universal
REF 6588a8a443f8ca1f0abb56ee4f46be10be1b2a2c
SHA512 a59e44d4406dde88b42718335be11a9bb0e07acaec955200b7f439151be01fa9e5321fa2ae1fe27173bbf76a3bd70ceca2f8bd4d0377b602aed6a75704cdcc73
HEAD_REF gltfpack
)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
gltfpack MESHOPT_BUILD_GLTFPACK
FEATURES
gltfpack MESHOPT_BUILD_GLTFPACK
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIBS)
@ -30,22 +18,19 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIBS)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DMESHOPT_BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
"-DMESHOPT_GLTFPACK_BASISU_PATH=${BASISU_PATH}"
${FEATURE_OPTIONS}
-DMESHOPT_BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
OPTIONS_DEBUG
-DMESHOPT_BUILD_GLTFPACK=OFF # tool
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/meshoptimizer)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/meshoptimizer)
if ("gltfpack" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES gltfpack AUTO_CLEAN)
vcpkg_copy_tools(TOOL_NAMES gltfpack AUTO_CLEAN)
endif()
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_copy_pdbs()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")

View File

@ -1,7 +1,7 @@
{
"name": "meshoptimizer",
"version": "0.25",
"port-version": 1,
"port-version": 2,
"description": "Mesh optimization library that makes meshes smaller and faster to render",
"homepage": "https://github.com/zeux/meshoptimizer",
"license": "MIT",
@ -18,7 +18,10 @@
"features": {
"gltfpack": {
"description": "Build gltfpack tool",
"supports": "!uwp & !(windows & arm)"
"supports": "!uwp",
"dependencies": [
"basisu"
]
}
}
}

View File

@ -6306,7 +6306,7 @@
},
"meshoptimizer": {
"baseline": "0.25",
"port-version": 1
"port-version": 2
},
"metis": {
"baseline": "2025-07-04",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "08c97855caa4657942f28dcb14a895271a1a1446",
"version": "0.25",
"port-version": 2
},
{
"git-tree": "c1ecef53362f7644a96e68390aec9e6f27cb7a6d",
"version": "0.25",