Skip to content

Commit

Permalink
update and run output_header_mapping.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Ughuuu committed Oct 20, 2024
1 parent 6dc467a commit 8a3fcb9
Show file tree
Hide file tree
Showing 4 changed files with 25,627 additions and 15 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,6 @@ jobs:
with:
python-version: '3.x'

- name: Clone Godot
uses: actions/checkout@v4
with:
repository: godotengine/godot
path: godot
#ref: TODO take tag

- name: Generate compat mappings for godot
run: |
python compat_generator.py godot
- name: Android dependencies
if: ${{ matrix.platform == 'android' }}
uses: nttld/setup-ndk@v1
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ first-party `godot-cpp` extension.

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.

If you want such a thing built, when running the build command, `scons`, make sure you have a file called `output_header_mapping.json` at root level of this repo. This file needs to have the mappings from `godot` repo. The mappings can be generated by running the compat_generator.py script.
If you want such a thing built, when running the build command, `scons`, make sure you have a file called `output_header_mapping.json` at root level of this repo. This file needs to have the mappings from `godot` repo. The mappings can be generated by running the `compat_generator.py` script.

Example of how to obtain them:
Example of how to run `compat_generator.py`:

```
git clone godotengine/godot
python compat_generator.py godot
```

The first argument of `compat_generator.py` is the folder where the godot repo is. If this folder is not given, the current directory is assumed to be the godot repo.

Then run the SConstruct build command as usual, and in the `gen/` folder you will now have a new folder, `include/godot_compat` which mirrors the `include/godot_cpp` includes, but have ifdef inside them and either include godot header or godot_cpp header.

## Contributing
Expand Down
7 changes: 5 additions & 2 deletions compat_generator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python

import re
import os
import json
Expand Down Expand Up @@ -25,8 +27,9 @@ def parse_header_file(file_path):
define_matches = re.findall(define_pattern, content)
types["defines"] += define_matches

if len(types["classes"]) == 0 and len(types["structs"]) == 0 and len(types["defines"]) == 0:
print(f"{file_path} missing things")
# Debug the case where no classes or structs are found
#if len(types["classes"]) == 0 and len(types["structs"]) == 0 and len(types["defines"]) == 0:
# print(f"{file_path} missing things")
return types


Expand Down
Loading

0 comments on commit 8a3fcb9

Please sign in to comment.