Search code examples
godotgdextension

How do I specify shared library dependencies in the .gdextension file [dependencies] section?


The godot documentation for GDExtension in C++ specifies:

Finally, the dependencies section allows you to name additional dynamic libraries that should be included as well.

https://docs.godotengine.org/en/stable/tutorials/scripting/gdextension/gdextension_cpp_example.html#using-the-gdextension-module

Yet it has no example of it's usage and I cannot extrapolate from the [libraries] section example. For instance how do I include multiple different shared libraries as dependencies?

I cannot find any further documentation for the .gdextension file.

Is there any documentation for this? Is there an example usage? :)


Solution

  • After some digging around in the godot-cpp repository, I found this example file: https://github.com/godotengine/godot-cpp/blob/master/test/project/example.gdextension

    [configuration]
    
    entry_symbol = "example_library_init"
    compatibility_minimum = "4.1"
    
    [libraries]
    . . .
    

    with the dependency section:

    [dependencies]
    ios.debug = {
      "res://bin/libgodot-cpp.ios.template_debug.xcframework": ""
    }
    ios.release = {
      "res://bin/libgodot-cpp.ios.template_release.xcframework": ""
    }
    

    It seems from this example, shared library dependencies are listed as dictionary key entries.

    I'm not sure if the values (: "") here have meaning. Lacking any documentation, I'll have to check the godot code for reading .gdextension files.