summaryrefslogtreecommitdiffstats
path: root/scu_builders.py
diff options
context:
space:
mode:
authorlawnjelly <lawnjelly@gmail.com>2023-07-02 19:23:28 +0100
committerlawnjelly <lawnjelly@gmail.com>2023-07-02 19:30:52 +0100
commit7b830ebdc1ddb7b8ee8345f2aaf755d551f734f6 (patch)
treea5c8a4805908fe3bccb3695789b8f3d53ba3fb74 /scu_builders.py
parent46424488edc341b65467ee7fd3ac423e4d49ad34 (diff)
downloadredot-engine-7b830ebdc1ddb7b8ee8345f2aaf755d551f734f6.tar.gz
SCons : Add "scu_limit" argument
"scu_limit" allows specifying the maximum number of includes in a single SCU file (translation unit). A lower limit (e.g. 8) uses less RAM during compilation, but may be slower to compile.
Diffstat (limited to 'scu_builders.py')
-rw-r--r--scu_builders.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/scu_builders.py b/scu_builders.py
index 5f7821655b..e76a58bd88 100644
--- a/scu_builders.py
+++ b/scu_builders.py
@@ -8,8 +8,8 @@ from os.path import normpath, basename
base_folder_path = str(Path(__file__).parent) + "/"
base_folder_only = os.path.basename(os.path.normpath(base_folder_path))
_verbose = False
-_is_release_build = False
_scu_folders = set()
+_max_includes_per_scu = 1024
def clear_out_existing_files(output_folder, extension):
@@ -197,13 +197,14 @@ def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension=
# adjust number of output files according to whether DEV or release
num_output_files = 1
- if _is_release_build:
- # always have a maximum in release
- includes_per_scu = 8
- num_output_files = max(math.ceil(total_lines / float(includes_per_scu)), 1)
+
+ if includes_per_scu == 0:
+ includes_per_scu = _max_includes_per_scu
else:
- if includes_per_scu > 0:
- num_output_files = max(math.ceil(total_lines / float(includes_per_scu)), 1)
+ if includes_per_scu > _max_includes_per_scu:
+ includes_per_scu = _max_includes_per_scu
+
+ num_output_files = max(math.ceil(total_lines / float(includes_per_scu)), 1)
lines_per_file = math.ceil(total_lines / float(num_output_files))
lines_per_file = max(lines_per_file, 1)
@@ -241,15 +242,15 @@ def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension=
)
-def generate_scu_files(verbose, is_release_build):
+def generate_scu_files(verbose, max_includes_per_scu):
print("=============================")
print("Single Compilation Unit Build")
print("=============================")
- print("Generating SCU build files")
global _verbose
_verbose = verbose
- global _is_release_build
- _is_release_build = is_release_build
+ global _max_includes_per_scu
+ _max_includes_per_scu = max_includes_per_scu
+ print("Generating SCU build files... (max includes per scu " + str(_max_includes_per_scu) + ")")
curr_folder = os.path.abspath("./")