@@ -278,14 +278,19 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision=
278
278
api = {}
279
279
with open (api_filepath , encoding = "utf-8" ) as api_file :
280
280
api = json .load (api_file )
281
- _generate_bindings (api , use_template_get_node , bits , precision , output_dir )
281
+ _generate_bindings (api , api_filepath , use_template_get_node , bits , precision , output_dir )
282
282
283
283
284
- def _generate_bindings (api , use_template_get_node , bits = "64" , precision = "single" , output_dir = "." ):
284
+ def _generate_bindings (api , api_filepath , use_template_get_node , bits = "64" , precision = "single" , output_dir = "." ):
285
+ if "precision" in api ["header" ] and precision != api ["header" ]["precision" ]:
286
+ raise Exception (
287
+ f"Cannot do a precision={ precision } build using '{ api_filepath } ' which was generated by Godot built with precision={ api ['header' ]['precision' ]} "
288
+ )
289
+
285
290
target_dir = Path (output_dir ) / "gen"
286
291
287
292
shutil .rmtree (target_dir , ignore_errors = True )
288
- target_dir .mkdir (parents = True )
293
+ target_dir .mkdir (parents = True , exist_ok = True )
289
294
290
295
real_t = "double" if precision == "double" else "float"
291
296
print ("Built-in type config: " + real_t + "_" + bits )
0 commit comments