summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2020-10-23 22:28:21 +0300
committerAndrii Doroshenko (Xrayez) <xrayez@gmail.com>2020-10-24 22:22:58 +0300
commita3c2c1e18a3b1ebcd06aabd71e98c53fd0e5e998 (patch)
tree18b3556141dd06e4ca2f010fc1c613606161d379 /SConstruct
parentb67ccf1a6f326c5d4d5fa1cc7cd15eff3573f8f7 (diff)
SCons: Add an option to detect C++ modules recursively
This adds `custom_modules_recursive` which allows to detect and collect all nested C++ modules which may reside in any directory specified by `custom_modules` option. The detection logic is made to be more strict because `SCSub` may be used for organizing hierarchical builds within a module itself, so the existence of `register_types.h` and `config.py` is checked as well (these are all required for a C++ module to be compiled by Godot). For performance reasons, built-in modules are not checked recursively, and there's no benefit of doing so in the first place. It's now possible to specify a directory path pointing to a *single* module, as it may contain nested modules which are detected recursively.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct9
1 files changed, 8 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index f134dfddac..46e0da89e8 100644
--- a/SConstruct
+++ b/SConstruct
@@ -123,6 +123,7 @@ opts.Add(BoolVariable("deprecated", "Enable deprecated features", True))
opts.Add(BoolVariable("minizip", "Enable ZIP archive support using minizip", True))
opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False))
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
+opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
# Advanced options
opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False))
@@ -199,8 +200,14 @@ if env_base["custom_modules"]:
Exit(255)
for path in module_search_paths:
+ if path == "modules":
+ # Built-in modules don't have nested modules,
+ # so save the time it takes to parse directories.
+ modules = methods.detect_modules(path, recursive=False)
+ else: # External.
+ modules = methods.detect_modules(path, env_base["custom_modules_recursive"])
# Note: custom modules can override built-in ones.
- modules_detected.update(methods.detect_modules(path))
+ modules_detected.update(modules)
include_path = os.path.dirname(path)
if include_path:
env_base.Prepend(CPPPATH=[include_path])