Skip to content

Commit

Permalink
fastgltf: add versions 0.7.2, 0.8.0 (#22960)
Browse files Browse the repository at this point in the history
* [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 <[email protected]>
  • Loading branch information
spnda and jcar87 authored Jan 13, 2025
1 parent 554d71e commit 5760e09
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 147 deletions.
29 changes: 6 additions & 23 deletions recipes/fastgltf/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
44 changes: 6 additions & 38 deletions recipes/fastgltf/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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")
Expand All @@ -67,38 +44,29 @@ def layout(self):
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()
Expand Down

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions recipes/fastgltf/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
26 changes: 4 additions & 22 deletions recipes/fastgltf/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
8 changes: 0 additions & 8 deletions recipes/fastgltf/all/test_v1_package/CMakeLists.txt

This file was deleted.

18 changes: 0 additions & 18 deletions recipes/fastgltf/all/test_v1_package/conanfile.py

This file was deleted.

8 changes: 2 additions & 6 deletions recipes/fastgltf/config.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5760e09

Please sign in to comment.