[GDExtension/CMake] Add shared Godot/Godot-cpp CMakeFile for use via FetchContent #11400
Replies: 2 comments 1 reply
-
cc @enetheru |
Beta Was this translation helpful? Give feedback.
-
The install base of CMake is larger, so even if it isnt a chosen preference, I can also see it being widely used for third party library integration.
AFAIK This is only the case if you are using the master branch, or if you are using a custom godot. The godot-cpp releases are made to match the godot releases such that you should be able to use one of the release branches, use the api.json provided, and have it work. Also the api.json doesnt depend on precision. To test the extension you need godot regardless of configuration. I can see a point to using a chosen godot executable as a means to configure matching build arguments for godot-cpp, and I've looked into this myself a while ago, but at the time didnt find a way to fetch a list of feature flags.
This has been done before in vorlac's rogue-lite project. And IMHO does indeed fit best as a separate project. There was discussion somewhere about a demo or example git repo to put projects that can be used as starting points for different concepts, and this would suit that agenda. There is one more thing I want to make sure is understood; There is a requirement of feature parity between SCons and CMake in the godot-cpp project, so anything that is built for one needs to be built for the other and maintained, so please keep that in mind. Cheers, |
Beta Was this translation helpful? Give feedback.
-
I know CMake support is new and isn't as mature as SCons, but as it get better I think more people are going to prefer it over SCons. Right now from my experience if I want to make a GDExtension with CMake I need to manually get, build and run a matching version of Godot to dump the extension_api.json to then pass it into the godot-cpp CMakeLists for making the GDExtension.
My proposal is a sort of CMake based "glue file". The idea would be that you can use via methods like FetchContent and gets and builds both the Godot engine and the godo-cpp library. It would sync the settings between the projects, precision, engine version, etc. and provide a target for the godot engine being built for a convenient way to test the GDExtension being developed.
In theory if done well, the user could include the CMakeLists.txt then using a custom command add targets for each combination of engine settings. e.g. one target for single precision and one target for double precision, as well as generating a gdextension file based on the outputs of the project. Also a user updating a GDExtension would be as simple as updating the branch that is used to build Godot and godot-cpp.
Pseudo-code example usage:
Beta Was this translation helpful? Give feedback.
All reactions