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
315 stars 48 forks source link

Add option to disable modules even if support is detected #62

Closed MCredstoner2004 closed 6 months ago

MCredstoner2004 commented 6 months ago

I am working on a project that uses CMake as it's build system want to use this project as a submodule and just add_subdirectory it, however, fastgltf is (correctly) detecting compiler support for C++ modules, but CMake only supports using modules with a limited number of generators, and I'd like my project to be buildable by Unix Makefiles

spnda commented 6 months ago

Does it just error out since CMake detects that you're using Makefiles? Or does the error happen during build? If it's during configuring I could change the detect method to check what generator is being used, too.

Otherwise, yeah, I'll add an option which is defaulted to not configure modules to avoid any issues.

MCredstoner2004 commented 6 months ago

Does it just error out since CMake detects that you're using Makefiles? Or does the error happen during build? If it's during configuring I could change the detect method to check what generator is being used, too.

I just checked by setting FASTGLTF_SUPPORTS_MODULES to false and it does build properly, so just checking that the generator used is one of the listed in the documentation should work

spnda commented 6 months ago

There is no way to detect the version of the used generator, so I've just settled with using an extra option that enables/disables the module target. Thanks for the report.