fastgltf: add versions 0.7.2, 0.8.0 (#22960)

* [fastgltf] Update to 0.7.1

* [fastgltf] Add versions 0.7.2 and 0.8.0

* fastgltf: drop support for older versions

* fastgltf: minimal test package

---------

Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>
This commit is contained in:
sean
2025-01-13 18:41:21 +01:00
committed by GitHub
parent 554d71ed9b
commit 5760e09ef6
9 changed files with 18 additions and 147 deletions

View File

@ -1,24 +1,7 @@
sources:
"0.7.0":
url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.7.0.tar.gz"
sha256: "1d0af69db938fd81dd34ea51f99e37f0023852c93befe63e23f9e55abd4a18ec"
"0.6.1":
url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.6.1.tar.gz"
sha256: "5f10b153ec941f5e6465425f542d3864f586aca040b0b659cb9ae70d42369390"
"0.5.0":
url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.5.0.tar.gz"
sha256: "f67558da009bfd1174b3f32606c41c20fe6fbcb70fc516e9f7bf0f63c06e87ff"
"0.4.0":
url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.4.0.tar.gz"
sha256: "77debe12acb6b498ea77306ce64277cedb14ad803b461ea677a61bc604bb59b5"
patches:
"0.6.1":
- patch_file: "patches/0.6.1-0001-find_package-simdjson.patch"
patch_description: "find_package simdjson"
patch_type: "conan"
patch_source: "https://github.com/spnda/fastgltf/issues/22"
"0.5.0":
- patch_file: "patches/0.5.0-0001-find_package-simdjson.patch"
patch_description: "find_package simdjson"
patch_type: "conan"
patch_source: "https://github.com/spnda/fastgltf/issues/22"
"0.8.0":
url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.8.0.tar.gz"
sha256: "0bc88a0858c88d94306443946a5a1606118b7d5e4960f1e6186a3632e9df38fb"
"0.7.2":
url: "https://github.com/spnda/fastgltf/archive/refs/tags/v0.7.2.tar.gz"
sha256: "292fc9d0d5a6726c90db88c1aadf09e6d152ffc0ebffe6fb968736c47288511c"

View File

@ -1,13 +1,11 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir
from conan.tools.files import get, copy, rmdir
from conan.tools.build import check_min_cppstd
from conan.tools.scm import Version
import os
required_conan_version = ">=1.59.0"
required_conan_version = ">2.0"
class fastgltf(ConanFile):
@ -34,31 +32,10 @@ class fastgltf(ConanFile):
"use_64bit_float": False,
}
@property
def _min_cppstd(self):
return 17
@property
def _compilers_minimum_version(self):
return {
"gcc": "8",
"clang": "7",
"apple-clang": "12",
"Visual Studio": "16",
"msvc": "192",
}
def export_sources(self):
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if Version(self.version) <= "0.6.0":
del self.options.disable_custom_memory_pool
del self.options.use_64bit_float
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
@ -67,38 +44,29 @@ class fastgltf(ConanFile):
cmake_layout(self, src_folder='src')
def requirements(self):
self.requires("simdjson/3.2.0")
self.requires("simdjson/3.11.5")
def validate(self):
if self.settings.get_safe("compiler.cppstd"):
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
check_min_cppstd(self, 17)
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
if Version(self.version) <= "0.7.0":
tc.variables["FASTGLTF_DOWNLOAD_SIMDJSON"] = False
if self.options.enable_small_vector:
tc.variables["FASTGLTF_USE_CUSTOM_SMALLVECTOR"] = True
if self.options.get_safe("disable_custom_memory_pool"):
tc.variables["FASTGLTF_DISABLE_CUSTOM_MEMORY_POOL"] = True
if self.options.get_safe("use_64bit_float"):
tc.variables["FASTGLTF_USE_64BIT_FLOAT"] = True
if Version(self.version) >= "0.7.0":
tc.variables["FASTGLTF_COMPILE_AS_CPP20"] = "20" in str(self.settings.get_safe("compiler.cppstd"))
tc.variables["FASTGLTF_COMPILE_AS_CPP20"] = "20" in str(self.settings.get_safe("compiler.cppstd"))
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()

View File

@ -1,13 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f76a8d8..27c1d1a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,8 @@ if (FASTGLTF_DOWNLOAD_SIMDJSON)
NAMESPACE fastgltf::
DESTINATION lib/cmake/fastgltf
)
+else()
+ find_package(simdjson CONFIG REQUIRED)
endif()
# Create the library target

View File

@ -1,13 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 250ee84..1877f54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,6 +79,8 @@ if (FASTGLTF_DOWNLOAD_SIMDJSON)
NAMESPACE fastgltf::
DESTINATION lib/cmake/fastgltf
)
+else()
+ find_package(simdjson CONFIG REQUIRED)
endif()
# Create the library target

View File

@ -5,9 +5,3 @@ find_package(fastgltf REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE fastgltf::fastgltf)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
if(fastgltf_VERSION VERSION_GREATER_EQUAL "0.7.0")
target_compile_definitions(${PROJECT_NAME} PRIVATE FASTGLTF_0_7_0_LATER)
elseif(fastgltf_VERSION VERSION_GREATER_EQUAL "0.5.0")
target_compile_definitions(${PROJECT_NAME} PRIVATE FASTGLTF_0_5_0_LATER)
endif()

View File

@ -1,26 +1,8 @@
#include <cstdio>
#if defined(FASTGLTF_0_7_0_LATER)
# include <fastgltf/core.hpp>
#elif defined(FASTGLTF_0_5_0_LATER)
# include <fastgltf/parser.hpp>
#else
# include <fastgltf_parser.hpp>
#endif
#include <thread>
#include <chrono>
#include <fastgltf/core.hpp>
int main() {
#ifdef FASTGLTF_0_5_0_LATER
// gcc < 11 uses pthread_once for std::call_once.
// there is an known bug about pthread_once with older glibc.
// This is workaround for that.
// see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60662
std::this_thread::sleep_for(std::chrono::milliseconds(1));
#endif
fastgltf::Exporter exporter;
exporter.setUserPointer(nullptr);
fastgltf::Parser parser;
printf("Version: " FASTGLTF_QUOTE(FASTGLTF_VERSION) "\n");
printf("C++17: " FASTGLTF_QUOTE(FASTGLTF_CPP_17) "\n");
printf("C++20: " FASTGLTF_QUOTE(FASTGLTF_CPP_20) "\n");
return 0;
}

View File

@ -1,8 +0,0 @@
cmake_minimum_required(VERSION 3.8)
project(test_package)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)

View File

@ -1,18 +0,0 @@
from conans import ConanFile, CMake
from conan.tools.build import cross_building
import os
class TestPackageV1Conan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)

View File

@ -1,9 +1,5 @@
versions:
"0.7.0":
"0.8.0":
folder: all
"0.6.1":
folder: all
"0.5.0":
folder: all
"0.4.0":
"0.7.2":
folder: all