Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that precision of extension_api.json matches build options #1714

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions binding_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,15 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision=
api = {}
with open(api_filepath, encoding="utf-8") as api_file:
api = json.load(api_file)
_generate_bindings(api, use_template_get_node, bits, precision, output_dir)
_generate_bindings(api, api_filepath, use_template_get_node, bits, precision, output_dir)


def _generate_bindings(api, use_template_get_node, bits="64", precision="single", output_dir="."):
def _generate_bindings(api, api_filepath, use_template_get_node, bits="64", precision="single", output_dir="."):
if "precision" in api["header"] and precision != api["header"]["precision"]:
raise Exception(
f"Cannot do a precision={precision} build using '{api_filepath}' which was generated by Godot built with precision={api['header']['precision']}"
)

target_dir = Path(output_dir) / "gen"

shutil.rmtree(target_dir, ignore_errors=True)
Expand Down
1 change: 1 addition & 0 deletions misc/scripts/check_get_file_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test(profile_filepath=""):
api = generate_trimmed_api(api_filepath, profile_filepath)
_generate_bindings(
api,
api_filepath,
use_template_get_node=False,
bits=bits,
precision=precision,
Expand Down
1 change: 1 addition & 0 deletions tools/godotcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def scons_generate_bindings(target, source, env):

_generate_bindings(
api,
str(source[0]),
env["generate_template_get_node"],
"32" if "32" in env["arch"] else "64",
env["precision"],
Expand Down