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.
This commit is contained in:
Riteo
2024-03-13 17:54:14 +01:00
parent 89f70e98d2
commit a5cf92664d
6 changed files with 96 additions and 68 deletions

View File

@@ -5,6 +5,7 @@ import platform
import uuid
import functools
import subprocess
import methods
# NOTE: The multiprocessing module is not compatible with SCons due to conflict on cPickle
@@ -67,8 +68,8 @@ def generate_export_icons(platform_path, platform_name):
# NOTE: It is safe to generate this file here, since this is still executed serially.
wf = export_path + "/" + name + "_svg.gen.h"
with open(wf, "w", encoding="utf-8", newline="\n") as svgw:
svgw.write(svg_str)
methods.write_file_if_needed(wf, svg_str)
def get_build_version(short):