diff options
author | Emilien Bauer <emilien.bauer@etu.unistra.fr> | 2022-09-13 10:37:58 +0200 |
---|---|---|
committer | Emilien Bauer <emilien.bauer@etu.unistra.fr> | 2022-09-19 13:32:23 +0200 |
commit | 8e717acf48573ee6bdbb2f321e41e48124731cf8 (patch) | |
tree | 5bdbf22e58be0f37802b977fdea1fc5c513a6768 | |
parent | 204e504d68cd8b5d267d3146390ec2f25c5f2e27 (diff) | |
download | redot-cpp-8e717acf48573ee6bdbb2f321e41e48124731cf8.tar.gz |
Add options to use scons caching for faster iteration.
Sort the sets in source generation so they are generated consistently between runs; otherwise caching is useless.
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | SConstruct | 9 | ||||
-rw-r--r-- | binding_generator.py | 10 |
3 files changed, 21 insertions, 1 deletions
@@ -12,6 +12,9 @@ src/gen logs/* *.log +# The default cache directory +cache/ + # Binaries *.o *.os @@ -168,12 +168,19 @@ else: json_api_file = os.path.join(os.getcwd(), env["headers_dir"], "extension_api.json") bindings = env.GenerateBindings( - env.Dir("."), [json_api_file, os.path.join(env["headers_dir"], "godot", "gdnative_interface.h")] + env.Dir("."), + [json_api_file, os.path.join(env["headers_dir"], "godot", "gdnative_interface.h"), "binding_generator.py"], ) +scons_cache_path = os.environ.get("SCONS_CACHE") +if scons_cache_path is not None: + CacheDir(scons_cache_path) + Decider("MD5") + # Forces bindings regeneration. if env["generate_bindings"]: AlwaysBuild(bindings) + NoCache(bindings) # Includes env.Append(CPPPATH=[[env.Dir(d) for d in [env["headers_dir"], "include", os.path.join("gen", "include")]]]) diff --git a/binding_generator.py b/binding_generator.py index 3cf4ae5..cd61a57 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -204,6 +204,11 @@ def generate_builtin_bindings(api, output_dir, build_config): if type_name in used_classes: used_classes.remove(type_name) + used_classes = list(used_classes) + used_classes.sort() + fully_used_classes = list(fully_used_classes) + fully_used_classes.sort() + with header_filename.open("w+") as header_file: header_file.write(generate_builtin_class_header(builtin_api, size, used_classes, fully_used_classes)) @@ -888,6 +893,11 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node): if type_name in used_classes: used_classes.remove(type_name) + used_classes = list(used_classes) + used_classes.sort() + fully_used_classes = list(fully_used_classes) + fully_used_classes.sort() + with header_filename.open("w+") as header_file: header_file.write( generate_engine_class_header(class_api, used_classes, fully_used_classes, use_template_get_node) |