New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for SFML unity builds #1787
Conversation
In my opinion it is always nice for a library to support as many development styles as is technically feasible without having to compromise other factors such as cleanliness or runtime performance. I already contemplated such a change for quite a while since (as you discovered) the required changes are (or in theory should be) purely syntactical. When browsing through the changeset I couldn't help but have the feeling that the name changes felt a bit too "C-like" to me. In C++ we have the wonderful Regarding the issue with glad: This is a tricky one. Basically the integration method that glad chose to use (which I actually like) is that of a "single-file header-only library" although being an OpenGL loader the single-file part is basically impossible to do in a clean way. Within an entire application, there should only be a single compiled instance of glad (or to be more exact a single compiled instance of each of its files). As such, to keep supporting non-unity builds we can't define I support this PR, but the current changes have to be worked on a bit more. |
@binary1248: thanks for the feedback! I will wait for more maintainters' opinions, and if everyone is on-board I will clean it up and will try to figure out how to deal with Would modifying/splitting the |
We already have a reported regression in #1786 because I updated glad and forgot to add in the tweak that I did by hand in the previous version. As such, going forward, I really prefer not having to modify glad in any way from its auto-generated form. |
@binary1248: I am starting this from scratch using namespaces. This is the error I get when trying to build
How am I supposed to make that declaration visible without making everything explode? It's kinda weird. #define SF_GLAD_GL_IMPLEMENTATION
#include <SFML/Graphics/GLExtensions.hpp> And it relies on the transitive include of #ifndef SFML_GLEXTENSIONS_HPP
#define SFML_GLEXTENSIONS_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <glad/gl.h>
// ... What is the correct way of using |
Better version in #1788 |
See #1788