#C++ GdExtension Project as Library?

7 messages · Page 1 of 1 (latest)

solid bolt
#

This may seem like a silly question but is it possible to make a gdextension basically a library?

Context: I am converting one of my chess-like board games into a godot project and separating the client and server code and have a git submodule for both projects that has the shared classes for the data of the game (currently written in gdscript). For performance reasons I am planning on migrating this to c++ and the documentation for GdExtension is clear on making a project but not a subproject and now I am wading through errors in the godot-cpp project that don't appear in my client or server projects.

So is there a way to make the basic library project I am hoping to use as a shared resource or is a different strategy needed?

kindred terrace
#

gdextensions are already libraries

#

they're not tied to your godot project, you can toss them into a separate git repo just like that

#

and after you compile them, you just need to make sure the compiled files are in the godot project or moved into it, and that the godot project contains a text file with a name ending in .gdextension that tells godot what compiled library files to load

#

one thing you could do for example is structuring the extension like an addon, so you can clone it as a submodule inside res://addons in all projects you want to use that extension

#

and include the text file in there, pointing to the bin folder where the dll/so/dylib files are generated