-
-
Notifications
You must be signed in to change notification settings - Fork 575
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
Allow detecting when building as a GDExtension #1339
Conversation
Should it not just be |
@AThousandShips I can change it if desired, but I think that we should have the In Godot 3.x with GDNative we had most things prefixed with Also, on the flip side, we may want to add a Also, I say hypothetical, but this is pain I've already went through in the past trying to make a C# project compatible with both Unity and Godot. Also, the Godot C# bindings use flags like Also, Zylann is using |
Indeed but godot-cpp does not, I think it should be uniform, as both can be used in extensions I'd say that the use in |
I think adding a standard define for this in godot-cpp is a great idea! I'm not crazy about the name The In one of my extensions, I'm using |
9732b8c
to
e17c7bf
Compare
Updated to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good to me!
Probably best to wait on merging this for a bit to see if anyone else has feedback, though.
Would it make sense to have this define in a "top-most" header (such as Edit: nevermind, forgot that anything to include doesnt even match^^" I worked too long with my unified header system |
@Zylann No, because you need to check for the define to decide which headers you are including. #ifdef GDEXTENSION
#include "defs.hpp" // Too late!
#endif // GDEXTENSION If you want to also make your own unconditionally-included top-level header with |
I think probably enough time has passed! Let's merge this :-) Thanks for the contribution! |
Cherry-picking to 4.2 in #1372 |
Cherry-picking to 4.1 in #1373 |
Intended use case: I am working on a project that can be built as either an engine module or a GDExtension. I need to be able to detect whether I am building for GDExtension or not in my code, like this:
See also godotengine/godot#86269 - having at least one of these PRs is highly useful, but having both is even better, because it lets you explicitly error on invalid configurations.
Without this PR, I have to put this in my own SConstruct file. This works fine... but this would be generally useful for lots of projects, and is super tiny, so I think we should make it a part of godot-cpp.