You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
generate compat
generate compat
Update ci.yml
Update binding_generator.py
generate compat
generate compat
lint python files
Update compat_generator.py
update docs
Update binding_generator.py
Update module_converter.py
also collect defines
Add module converter file that converts module based projects to godot_compat
Update ci.yml
update docs
Update compat_generator.py
lint python files
generate compat
generate compat
generate compat
generate compat
Update ci.yml
fix path issue when caling from outside
Update binding_generator.py
update to also take missing classes/structs
Update binding_generator.py
Generate godot compat for dual build
generate compat
generate compat
Update ci.yml
Update binding_generator.py
generate compat
generate compat
lint python files
Update compat_generator.py
update docs
Update binding_generator.py
Update module_converter.py
also collect defines
Add module converter file that converts module based projects to godot_compat
Update ci.yml
update docs
Update compat_generator.py
lint python files
generate compat
generate compat
generate compat
generate compat
Update ci.yml
fix path issue when caling from outside
Add support for build profiles.
Allow enabling or disabling specific classes (which will not be built).
Allow forwarding from `ClassDB` to `ClassDBSingleton` to support enumerations
update to also take missing classes/structs
Update binding_generator.py
update
update naming of files
add godot mappings.
update and run output_header_mapping.json
Update README.md
make godot_compat work without a file generated
fix the test
Update binding_generator.py
Update binding_generator.py
Update binding_generator.py
use files from include too
Update README.md
lint
lint
lint
Update CMakeLists.txt
update to use all. fix linting a bit
update wip
fix posix path
Update CMakeLists.txt
Update binding_generator.py
add using namespace godot; everywhere to includes
fix includes
Try fixes.
generate new include files 123
Update binding_generator.py
Update binding_generator.py
Update binding_generator.py
Copy file name to clipboardExpand all lines: README.md
+61
Original file line number
Diff line number
Diff line change
@@ -147,3 +147,64 @@ generic reusable template.
147
147
148
148
Or checkout the code for the [Summator example](https://github.com/paddy-exe/GDExtensionSummator)
149
149
as shown in the [official documentation](https://docs.godotengine.org/en/latest/tutorials/scripting/gdextension/gdextension_cpp_example.html).
150
+
151
+
## Godot and Godot Cpp Compatibility
152
+
153
+
If you intend to target both building as a GDExtension and as a module using godot repo, you can generate compatibility includes that will target either GDExtension or module, based on the GODOT_MODULE_COMPAT define.
154
+
155
+
If you want such headers, when running the build command, `scons`, pass the `godot_repo` param with the path to the godot repository. Eg. if you have the godot repository cloned at path `../godot`, then do:
156
+
157
+
```sh
158
+
scons godot_repo="../godot"
159
+
```
160
+
161
+
This will generate something like this:
162
+
```
163
+
gen/include/godot_cpp/..
164
+
gen/include/godot_compat/..
165
+
```
166
+
167
+
Now, all you need to do is when writing your addon/module, replace includes like these:
168
+
169
+
```cpp
170
+
#include<godot_cpp/classes/a_star_grid2d.hpp>
171
+
```
172
+
173
+
with
174
+
175
+
```cpp
176
+
#include<godot_compat/classes/a_star_grid2d.hpp>
177
+
```
178
+
179
+
Inside, this file will have code for both godot and godot-cpp:
180
+
181
+
```cpp
182
+
#ifdef GODOT_MODULE_COMPAT
183
+
#include <core/math/a_star_grid_2d.h>
184
+
#else
185
+
#include <godot_cpp/classes/a_star_grid2d.hpp>
186
+
#endif
187
+
```
188
+
189
+
### Manually generate mapping files
190
+
191
+
The mappings can be manually generated by running the `compat_generator.py` script.
192
+
193
+
Example of how to run `compat_generator.py`:
194
+
195
+
```sh
196
+
git clone godotengine/godot
197
+
python compat_generator.py godot
198
+
```
199
+
200
+
The first argument of `compat_generator.py` is the folder where the repo is (can be godot or godot-cpp repo). If this folder is not given, the current directory is assumed. The output of this is either `output_header_mapping_godot.json` or `output_header_mapping_godot_cpp.json`
201
+
202
+
### Manually match the mapping files
203
+
204
+
If you want to manually match the godot mapping file with the godot-cpp one, you can do that by running:
205
+
206
+
```sh
207
+
python header_matcher.py
208
+
```
209
+
210
+
This will generate the `header_matches.json` file with matches from godot and godot_cpp repo.
0 commit comments