mirror of
https://github.com/godotengine/godot-cpp.git
synced 2026-01-03 18:09:13 +03:00
Check that precision of extension_api.json matches build options
(cherry picked from commit 0a73df5f53)
This commit is contained in:
@@ -278,10 +278,15 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision=
|
|||||||
api = {}
|
api = {}
|
||||||
with open(api_filepath, encoding="utf-8") as api_file:
|
with open(api_filepath, encoding="utf-8") as api_file:
|
||||||
api = json.load(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"
|
target_dir = Path(output_dir) / "gen"
|
||||||
|
|
||||||
shutil.rmtree(target_dir, ignore_errors=True)
|
shutil.rmtree(target_dir, ignore_errors=True)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ def test(profile_filepath=""):
|
|||||||
api = generate_trimmed_api(api_filepath, profile_filepath)
|
api = generate_trimmed_api(api_filepath, profile_filepath)
|
||||||
_generate_bindings(
|
_generate_bindings(
|
||||||
api,
|
api,
|
||||||
|
api_filepath,
|
||||||
use_template_get_node=False,
|
use_template_get_node=False,
|
||||||
bits=bits,
|
bits=bits,
|
||||||
precision=precision,
|
precision=precision,
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ def scons_generate_bindings(target, source, env):
|
|||||||
|
|
||||||
_generate_bindings(
|
_generate_bindings(
|
||||||
api,
|
api,
|
||||||
|
str(source[0]),
|
||||||
env["generate_template_get_node"],
|
env["generate_template_get_node"],
|
||||||
"32" if "32" in env["arch"] else "64",
|
"32" if "32" in env["arch"] else "64",
|
||||||
env["precision"],
|
env["precision"],
|
||||||
|
|||||||
Reference in New Issue
Block a user