diff options
author | Riteo <riteo@posteo.net> | 2024-03-13 17:54:14 +0100 |
---|---|---|
committer | Riteo <riteo@posteo.net> | 2024-03-15 15:43:53 +0100 |
commit | a5cf92664db9633b9fb1307a801d99de70d09aba (patch) | |
tree | 2b5a8cb9151897d807c0b6eef23e23005ba934e3 /platform | |
parent | 89f70e98d209563abb4dbc1f8cd5d76c81eb7940 (diff) | |
download | redot-engine-a5cf92664db9633b9fb1307a801d99de70d09aba.tar.gz |
SCons: unify code generations routine and minimize timestamp changes
Previously, all of the code generation routines would just needlessly
write the same files over and over, even when not needed.
This became a problem with the advent of the experimental ninja backend
for SCons, which can be trivially enabled with a few lines of code and
relies on timestamp changes, making it thus impractical.
Diffstat (limited to 'platform')
-rw-r--r-- | platform/SCsub | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/platform/SCsub b/platform/SCsub index e432cebd48..ca282e3e68 100644 --- a/platform/SCsub +++ b/platform/SCsub @@ -1,5 +1,7 @@ #!/usr/bin/env python +import methods + Import("env") env.platform_sources = [] @@ -18,12 +20,7 @@ reg_apis_inc += "\n" reg_apis += "}\n\n" unreg_apis += "}\n" -# NOTE: It is safe to generate this file here, since this is still execute serially -with open("register_platform_apis.gen.cpp", "w", encoding="utf-8", newline="\n") as f: - f.write(reg_apis_inc) - f.write(reg_apis) - f.write(unreg_apis) - +methods.write_file_if_needed("register_platform_apis.gen.cpp", reg_apis_inc + reg_apis + unreg_apis) env.add_source_files(env.platform_sources, "register_platform_apis.gen.cpp") lib = env.add_library("platform", env.platform_sources) |