testing/draco: new aport

Library for compressing and decompressing 3D geometric meshes and point clouds
https://google.github.io/draco/
This commit is contained in:
Holger Jaekel 2024-06-09 13:53:04 +02:00 committed by Kevin Daudt
parent e159937103
commit 31cab7e4d7
8 changed files with 254 additions and 0 deletions

View File

@ -0,0 +1,27 @@
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Sat, 11 Dec 2021 12:41:59 +0100
Subject: Fix removal of build dir prefix from include path
---
cmake/draco_install.cmake | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/cmake/draco_install.cmake b/cmake/draco_install.cmake
index b9dda26..20e50ec 100644
--- a/cmake/draco_install.cmake
+++ b/cmake/draco_install.cmake
@@ -37,11 +37,10 @@ macro(draco_setup_install_target)
list(REMOVE_DUPLICATES draco_api_includes)
- # Strip $draco_src_root from the file paths: we need to install relative to
- # $include_directory.
- list(TRANSFORM draco_api_includes REPLACE "${draco_src_root}/" "")
-
foreach(draco_api_include ${draco_api_includes})
+ # Strip $draco_src_root from the file paths: we need to install relative to
+ # $include_directory.
+ string(REPLACE "${draco_src_root}/" "" draco_api_include "${draco_api_include}")
get_filename_component(file_directory ${draco_api_include} DIRECTORY)
set(target_directory "${includes_path}/draco/${file_directory}")
install(FILES ${draco_src_root}/${draco_api_include}

View File

@ -0,0 +1,34 @@
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Sat, 9 Jul 2022 22:00:18 +0200
Subject: Install proper CMake targets
---
cmake/draco_install.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmake/draco_install.cmake b/cmake/draco_install.cmake
index 20e50ec..e42940b 100644
--- a/cmake/draco_install.cmake
+++ b/cmake/draco_install.cmake
@@ -97,7 +97,7 @@ macro(draco_setup_install_target)
configure_package_config_file(
"${draco_root}/cmake/draco-config.cmake.template"
"${draco_build}/draco-config.cmake"
- INSTALL_DESTINATION "${data_path}/cmake/draco")
+ INSTALL_DESTINATION "${libs_path}/cmake/draco")
write_basic_package_version_file(
"${draco_build}/draco-config-version.cmake"
@@ -113,10 +113,10 @@ macro(draco_setup_install_target)
EXPORT dracoExport
NAMESPACE draco::
FILE draco-targets.cmake
- DESTINATION "${data_path}/cmake/draco")
+ DESTINATION "${libs_path}/cmake/draco")
install(FILES "${draco_build}/draco-config.cmake"
"${draco_build}/draco-config-version.cmake"
- DESTINATION "${data_path}/cmake/draco")
+ DESTINATION "${libs_path}/cmake/draco")
endif(DRACO_INSTALL)
endmacro()

View File

@ -0,0 +1,32 @@
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Sat, 11 Dec 2021 14:21:01 +0100
Subject: Use C++17 filesystem library
---
src/draco/io/file_writer_utils.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/draco/io/file_writer_utils.cc b/src/draco/io/file_writer_utils.cc
index 08ca4c2..b32777b 100644
--- a/src/draco/io/file_writer_utils.cc
+++ b/src/draco/io/file_writer_utils.cc
@@ -8,7 +8,7 @@
#include "draco/draco_features.h"
#ifdef DRACO_TRANSCODER_SUPPORTED
-#include "ghc/filesystem.hpp"
+#include <filesystem>
#endif // DRACO_TRANSCODER_SUPPORTED
namespace draco {
@@ -64,8 +64,8 @@ bool CheckAndCreatePathForFile(const std::string &filename) {
SplitPathPrivate(filename, &path, &basename);
#ifdef DRACO_TRANSCODER_SUPPORTED
- const ghc::filesystem::path ghc_path(path);
- ghc::filesystem::create_directories(ghc_path);
+ const std::filesystem::path fs_path(path);
+ std::filesystem::create_directories(fs_path);
#endif // DRACO_TRANSCODER_SUPPORTED
return DirectoryExists(path);
}

View File

@ -0,0 +1,18 @@
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Fri, 19 Aug 2022 20:28:12 +0200
Subject: Set DRACO_LIBRARIES for backwards compatibility
---
cmake/draco-config.cmake.template | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cmake/draco-config.cmake.template b/cmake/draco-config.cmake.template
index ed86823..12d54b7 100644
--- a/cmake/draco-config.cmake.template
+++ b/cmake/draco-config.cmake.template
@@ -1,3 +1,5 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/draco-targets.cmake")
+
+set(DRACO_LIBRARIES "draco::draco")

View File

@ -0,0 +1,20 @@
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Sun, 18 Jun 2023 19:21:20 +0200
Subject: Fix FTBFS with GCC-13
---
src/draco/io/gltf_utils.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/draco/io/gltf_utils.h b/src/draco/io/gltf_utils.h
index befbacb..490da43 100644
--- a/src/draco/io/gltf_utils.h
+++ b/src/draco/io/gltf_utils.h
@@ -18,6 +18,7 @@
#include "draco/draco_features.h"
#ifdef DRACO_TRANSCODER_SUPPORTED
+#include <cstdint>
#include <iomanip>
#include <sstream>
#include <string>

View File

@ -0,0 +1,33 @@
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Fri, 14 Jul 2023 20:16:33 +0200
Subject: Fix tinygltf::FsCallbacks
---
src/draco/io/gltf_decoder.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/draco/io/gltf_decoder.cc b/src/draco/io/gltf_decoder.cc
index ebfd3ec..0f4852f 100644
--- a/src/draco/io/gltf_decoder.cc
+++ b/src/draco/io/gltf_decoder.cc
@@ -438,6 +438,12 @@ bool WriteWholeFile(std::string * /*err*/, const std::string &filepath,
return WriteBufferToFile(contents.data(), contents.size(), filepath);
}
+bool GetFileSizeInBytes(size_t *out, std::string * /*err*/,
+ const std::string &filepath, void * /*user_data*/) {
+ *out = GetFileSize(filepath);
+ return true;
+}
+
} // namespace
GltfDecoder::GltfDecoder()
@@ -497,6 +503,7 @@ Status GltfDecoder::LoadFile(const std::string &file_name,
// TinyGLTF's ExpandFilePath does not do filesystem i/o, so it's safe to
// use in all environments.
&tinygltf::ExpandFilePath, &ReadWholeFile, &WriteWholeFile,
+ &GetFileSizeInBytes,
reinterpret_cast<void *>(input_files)};
loader.SetFsCallbacks(fs_callbacks);

View File

@ -0,0 +1,21 @@
Author: Holger Jaekel <holger.jaekel@gmx.de>
Summary: use gtest package
----
--- a/cmake/draco_dependencies.cmake
+++ b/cmake/draco_dependencies.cmake
@@ -107,11 +107,10 @@
endif()
list(APPEND draco_test_include_paths ${draco_include_paths}
- "${gtest_path}/include" "${gtest_path}/googlemock"
- "${gtest_path}/googletest/include" "${gtest_path}/googletest")
+ "${gtest_path}/include/gmock/" "${gtest_path}/include/gtest/" "${gtest_path}/src/gtest/")
- list(APPEND draco_gtest_all "${gtest_path}/googletest/src/gtest-all.cc")
- list(APPEND draco_gtest_main "${gtest_path}/googletest/src/gtest_main.cc")
+ list(APPEND draco_gtest_all "${gtest_path}/src/gtest/src/gtest-all.cc")
+ list(APPEND draco_gtest_main "${gtest_path}/src/gtest/src/gtest_main.cc")
endmacro()

69
testing/draco/APKBUILD Normal file
View File

@ -0,0 +1,69 @@
# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=draco
pkgver=1.5.7
pkgrel=0
pkgdesc="Library for compressing and decompressing 3D geometric meshes and point clouds"
url="https://google.github.io/draco/"
arch="all !s390x" # s390x: segfault in tests
license="Apache-2.0"
makedepends="cmake samurai eigen-dev tinygltf-dev ghc-filesystem python3"
checkdepends="gtest-dev gtest-src"
subpackages="$pkgname-static $pkgname-tools $pkgname-dev"
source="draco-$pkgver.tar.gz::https://github.com/google/draco/archive/refs/tags/$pkgver.tar.gz
0001-Fix-removal-of-build-dir-prefix-from-include-path.patch
0002-Install-proper-CMake-targets.patch
0003-Use-C-17-filesystem-library.patch
0004-Set-DRACO_LIBRARIES-for-backwards-compatibility.patch
0005-Fix-FTBFS-with-GCC-13.patch
0006-Fix-tinygltf-FsCallbacks.patch
0007-gtest.patch
"
prepare() {
default_prepare
rm -rf third_party
}
build() {
if [ "$CBUILD" != "$CHOST" ]; then
local crossopts="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
fi
cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=None \
-DDRACO_TESTS="$(want_check && echo TRUE || echo FALSE)" \
-DDRACO_TRANSCODER_SUPPORTED=ON \
-DDRACO_EIGEN_PATH=/usr/include/eigen3 \
-DDRACO_FILESYSTEM_PATH=/usr/include/ \
-DDRACO_TINYGLTF_PATH=/usr/include \
-DDRACO_GOOGLETEST_PATH=/usr \
-DCMAKE_SKIP_RPATH=ON \
$crossopts
cmake --build build
}
check() {
LD_LIBRARY_PATH="$builddir/build" ./build/draco_tests
}
package() {
DESTDIR="$pkgdir" cmake --install build
}
tools() {
amove usr/bin
}
sha512sums="
8b444744cdf12fb9d276916eb2ff0735cd1a6497b65b88813ec457fe2169db987db62e3db253a7d0f3ae7d45ae6502e8a9f8c0b81abde73e07b3bec69f9dc170 draco-1.5.7.tar.gz
fb38bbba62622ee803252f5b230a284f9717e2d1cc606849968425cf85678e72a6039e2fdaa2b52a6961364e9564165f253c6a20dacac107cca3561194384373 0001-Fix-removal-of-build-dir-prefix-from-include-path.patch
dfd1faa6e7a8e1775c0affcee513ecbf51f577dd5d3457a2a6d38ee9ca0f0ef9ad68844c33f3b9654ac7f980934c2fba8dcd587948fbaa252b36eaf0621e4b6e 0002-Install-proper-CMake-targets.patch
89fd902355e09f1bed3a91ed1a61825c1c32458e100b482a09edb549638922d6ee1d4f09c806d5145bd5f9238b2b611ff3394684ace5aadfaeb9d88b221839ba 0003-Use-C-17-filesystem-library.patch
46cb6d7f017e7842edc536141d926233db68cdfac3022e44bab665884a2ce5d043eb71a07a1a42657185f847fd714b92eb0c563560fd806b533549498c80553c 0004-Set-DRACO_LIBRARIES-for-backwards-compatibility.patch
47eff30c0a7641da525bf6f54dad65888ef69ec096236dd8c8ba9ece87da7a503a38869290656f08a1d1fc16b93c0eb8151260816333d58756a67eccd98e1aae 0005-Fix-FTBFS-with-GCC-13.patch
f7b2e882f1b95f4f1a85027c202a29b0046fbc5ee9de8a0e8a47fa29fad553b0f0d9281ece03b55be15b564d60c00d5ade9f7e1b2b4bd05c4ec7f3594dbb7049 0006-Fix-tinygltf-FsCallbacks.patch
612f1b3b57e6872d77747adc1a1ebec635eb02673a4fbb0218f66222805b98a27b471a9708bf1eeeaa9ba9b884fbbd3f9e411d9133b195f85a7fa91d3219cff7 0007-gtest.patch
"