|
@@ -278,14 +278,19 @@ 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)
|
|
|
- target_dir.mkdir(parents=True)
|
|
|
+ target_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
real_t = "double" if precision == "double" else "float"
|
|
|
print("Built-in type config: " + real_t + "_" + bits)
|