Skip to content

Add an easier way to support GDExtensions for both addons and modules, specifically for includes #9212

Open
godotengine/godot-cpp
#1415
@Ughuuu

Description

@Ughuuu

Describe the project you are working on

A box2d physics server GDExtension.

Describe the problem or limitation you are having in your project

Having to support compilation for both add-on and module(Right now I don't support module builds because of big change, mainly in include headers).

Right now if you are building a module, you have some includes, and if you are building addons, you have other includes.

Eg.

Addon:

#include <godot_cpp/core/class_db.hpp>

Module:

#include "core/core_bind.h"

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add to godot-cpp an extra set of includes, like indirection includes, that would either use the addon path or the module path. Eg.

#include <godot_cpp/core/extra_class_db.hpp>

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

These extra set of includes would do inside:

#IFDEF MODULE
   #include "core/core_bind.h"
#ELSE
   #include <godot_cpp/core/class_db.hpp>
#ENDIF

If this enhancement will not be used often, can it be worked around with a few lines of script?

It can be used by adding these ifdefs to every addon/module project.

Is there a reason why this should be core and not an add-on in the asset library?

It could also be in another project, eg. godot-cpp-extra, and have those includes there that include then either godot-cpp or godot. But I would rather they are somewhere where they are maintained as first class citizen, eg godot-cpp.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions