This is the build2 package for godot-cpp.
godot-cpp is the library C++ users must use to make GDExtensions for the Godot Engine, allowing using C++ for part or all the behavior of a game made with Godot.
This package requires the presence of python >= 3.4 in the environment (#1), used to run a code generator script before building the library.
-
godot-cpp%liba{godot-cpp}:The
godot-cpplibrary (exclusively static). Make your GDExtension shared library depend on this target for it's code to have acces to the C and C++ APIs (as specified by GDExtension documentation). Communication with Godot goes through the C API internally so there is no ABI, you can build however you want. Beware that on Windows C runtime implementation being different in "debug" and "release" configurations.
- Make sure to be familiar with how GDExtension works, see the official documentation.
- Your GDEXtension library must be a shared library (
libs) as it will be loaded at runtime by Godot.
The version of godot-cpp to chose depends directly on which version of the Godot Engine executable (both editor and game) you use:
-
Godot <=
v4.5.0-stable: Chose the version which matches your intended Godot Engine version. Otherwise, both API and ABI will not match as they are broken at each release. -
Godot >=
v4.6.0-stable: Starting with version 10.x, godot-cpp is versioned independently from Godot. The godot-cpp version you choose has no bearing on which Godot versions it is compatible with.
If you want to use a custom build of the Godot Engine: TODO: we currently don't support directly this scenario but it is planned.
-
config.godot_cpp.target_godot_version(no default value): Version of Godot that will be targeted as lowest version supported by the GDextension this library will be used to build. The version must be expressed asX.Yas only the minor version is important, for example:bdep init [...] config.godot_cpp.target_godot_version=4.3The minimum supported version is
4.3. Seegodot-cpp's documentation for details. -
config.godot_cpp.enable_hot_reload(default:true) : Enables hot-reloading when using the Godot Engine Editor starting with versions 4.2. Iftrue, you must also setreloadable = truein the.gdextensionfile going with your GDExtension to enable the feature. When the GDExtension binary file is changed, the editor will attempt to hot-reload it the next time it's windows acquires focus. This behavior will fail if your GDExtension was not built with this option and there will be no attempt ifreloadable = truewas not set in the.gdextensionfile.
TODO: The other options are not supported yet, see #7