Dav1dde / glad

Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs.
https://glad.dav1d.de/
Other
3.73k stars 440 forks source link

CMake glad_add_library(): REPRODUCIBLE keyword #445

Closed M2-TE closed 8 months ago

M2-TE commented 9 months ago

I could not find any information regarding the REPRODUCIBLE keyword, which is used in some of the CMake examples for glad_add_library(). The option also doesn't seem to be listed in the main CMakeLists.txt under cmake/, so what exactly does this option do?

Dav1dde commented 9 months ago

Ah I never added it to the docs...

Everytime you run glad it pulls the latest specifications from github and uses those to generate the loader, this means you need an active network connection and that between runs the output may change. It can also (very rarely) happen that upstream introduces a breaking change and your glad version doesn't support these specs anymore -> your build breaks.

The reproducible option uses packaged specifications instead, they are potentially a bit outdated but this means there are no more network requests and your build will never fail due to updated/changed upstream specifications.

So generally I recommend you to use the reproducible option if you use cmake, this does not matter much if you generate manually and check in the generated code (which is what you should do imo).

M2-TE commented 9 months ago

Thanks for the clarification, this seems to actually be what I wanted a while ago. Pulling the latest specifications would sometimes cause the script to hang while fetching them, seemingly at random despite stable connection. Normally it is a quick <1min process, but sometimes it can take up to an hour, but there was no trace or error information of any sort, so I doubt it was a fault with the GLAD library..

I do however suggest adding the REPRODUCIBLE into the documentation (particularly into the CMakeLists.txt) as it seems to be an option that most people would want to opt into. Perhaps even making it the default and requiring a different explicit keyword to obtain the latest spec instead?