spnda / fastgltf

A modern C++17 glTF 2.0 library focused on speed, correctness, and usability
https://fastgltf.readthedocs.io/v0.8.x/
MIT License
303 stars 44 forks source link

C++ 20 support #9

Closed preetishkakkar closed 1 year ago

preetishkakkar commented 1 year ago

Currently, cmake seems to make sure that we can't use it with a C++ 20 project? Is there a reason to have this restricted to C++ 17, can this limit be removed?

spnda commented 1 year ago

fastgltf definitely supports C++20 and even includes a few additional things in the headers, if you should use the utilities it adds. Additionally, CMake should not have any issue with the C++ version of your project and fastgltf. Would you mind pasting the error message you encountered?

preetishkakkar commented 1 year ago

ahh never mind, looks like since there was no easy way to compile only parts of fastgltf, I added below to my cmake, add_library(fastgltf STATIC ${fastgltf_SOURCE_DIR}/src/base64_decode.cpp ${fastgltf_SOURCE_DIR}/src/fastgltf.cpp ${fastgltf_SOURCE_DIR}/simdjson/simdjson.cpp)

which somehow didn't pick the correct cxx flags set at project level, adding this target_compile_features(fastgltf PRIVATE cxx_std_20) works! thanks..

It will be good to have possibility to configuring it such that examples & test can be turned off when using FetchContent_Declare

preetishkakkar commented 1 year ago

Feel free to close this issue

spnda commented 1 year ago

I will keep it open to remind me about adding a FASTGLTF_TESTS and FASTGLTF_EXAMPLES that fully stops anything regarding tests and examples of running. But thank you.

spnda commented 1 year ago

I've now added this with e9e4c349311167f440237a10b5809f223e5ae4cc.