-
-
Notifications
You must be signed in to change notification settings - Fork 574
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
Generate compatibility layer #1415
base: 4.3
Are you sure you want to change the base?
Conversation
Actually no need to change the ci since we dont export the headers just the lib atm. |
c531aa8
to
841edd2
Compare
7097bd2
to
6dc467a
Compare
Should the Edit: Made it work without needing the file commited, just needs to have the scons godot_repo="../godot" |
1d515ab
to
6480e9b
Compare
Given that this is mapping godot-cpp-style includes to Godot includes, could this be implemented by changing our normal So, for example, could it have
Then a GDExtension doesn't actually need to change its includes to build as a module. |
Very good idea, must say, has some downsides, but overall a lot of upsides. Another thing I forgot, godot uses no namespacing, while godot-cpp uses |
We could have the hand-written files include a generated file that would have the Godot includes (or nothing, if the user didn't pass
Well, if this code is only added if the developer specified |
Sounds good to me, so then I start to implement that change where everything just works magically inside the godot_cpp includes?
Also, this will only happen if godot_repo is sent, so no extra file anywhere. Also, I update both SConstruct and CMake with this extra godot_repo param. EDIT: And about the #ifdef GODOT_MODULE_COMPAT
#include <core/math/a_star_grid_2d.h>
#else
#include <godot_cpp/classes/a_star_grid2d.hpp>
using namespace godot;
#endif |
Just to be clear, I don't think the manual files need to get "overridden", they just need to have code like this added:
So, they'd still be hand-written, but they'd include a generated file. We definitely shouldn't have the generation touch the content of the hand-written files. |
Making it draft while I implement new changes. |
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.
Thanks!
I think the overall idea of the new direction this PR is taking seems good. However, there's some things in the implementation that I think could be improved (more details below), and there still appears to be a bunch of stuff left over from the previous direction.
binding_generator.py
Outdated
if godot_repo != "": | ||
generate_compat_includes(godot_repo, output_dir, target_dir) |
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.
So, this is modifying the generated files afterwards? Why not just make this part of generating the files in the first place?
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.
There are a lot of functions that create the file. Also this is how it was previously as I created the file in another folder. I can update if you want, but that will polute the smaller functions (that generate file in the first place)
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.
Personally, I think we should update the functions that generate the files in the first place
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.
Ok, well, got it working now all around. If you want this change, I can do that instead, but first let me bring some counter arguments I guess. If in future we don't need this tight integration anymore, it's easier to remove. All the code for compat is in one function. If there are bugs/issues with it, its one function to debug, and not multiple functions.
Downsides to having it separate is that people might not test it as often and it might break, though since in other functions it will be under if's anyway, won't be much tighter integrated anyway.
So yeah, if you think it's better to integrate them in functions, will update again the code. Just double checking.
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.
I really do think we should integrate this into the functions generating the files in the first place. But I guess that's just my opinion? If you can get other GDExtension team members on-board, I'd be fine to go with the consensus, but I personally think it's silly to modify files after the fact, when it's the same script that's generating them in the first place.
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.
Who are other gdextension members? Should i request a review on this pr at this stage?
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.
01db9c6
to
f660942
Compare
generate compat generate compat Update ci.yml Update binding_generator.py generate compat generate compat lint python files Update compat_generator.py update docs Update binding_generator.py Update module_converter.py also collect defines Add module converter file that converts module based projects to godot_compat Update ci.yml update docs Update compat_generator.py lint python files generate compat generate compat generate compat generate compat Update ci.yml fix path issue when caling from outside Update binding_generator.py update to also take missing classes/structs Update binding_generator.py Generate godot compat for dual build generate compat generate compat Update ci.yml Update binding_generator.py generate compat generate compat lint python files Update compat_generator.py update docs Update binding_generator.py Update module_converter.py also collect defines Add module converter file that converts module based projects to godot_compat Update ci.yml update docs Update compat_generator.py lint python files generate compat generate compat generate compat generate compat Update ci.yml fix path issue when caling from outside Add support for build profiles. Allow enabling or disabling specific classes (which will not be built). Allow forwarding from `ClassDB` to `ClassDBSingleton` to support enumerations update to also take missing classes/structs Update binding_generator.py update update naming of files add godot mappings. update and run output_header_mapping.json Update README.md make godot_compat work without a file generated fix the test Update binding_generator.py Update binding_generator.py Update binding_generator.py use files from include too Update README.md lint lint lint Update CMakeLists.txt update to use all. fix linting a bit update wip fix posix path Update CMakeLists.txt Update binding_generator.py add using namespace godot; everywhere to includes fix includes Try fixes. generate new include files 123 Update binding_generator.py Update binding_generator.py Update binding_generator.py Update binding_generator.py update fix GODOT_MODULE_COMPAT fix manual includes to match. Update godot.hpp Update color_names.inc.hpp
Generate compatibility layer between godot and godot_cpp at GDExtension level.