diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-03-14 01:16:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-14 01:16:11 +0100 |
commit | dc038bd7c30e50a94f844a485e7f89f0bab0d4cf (patch) | |
tree | 3e216bb2f6a3a1d3c85aeb7e05af4c4ac5e9b808 | |
parent | 8051307efe21ef39795f9fd5432d862fe03f172c (diff) | |
parent | f712d68ceb38c3a1b2c20da395c9882a2c871fb7 (diff) |
Merge pull request #46799 from goostengine/module-includes
Provide missing include path for custom modules
-rw-r--r-- | SConstruct | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/SConstruct b/SConstruct index 65a8d9e302..615ca447f9 100644 --- a/SConstruct +++ b/SConstruct @@ -246,13 +246,16 @@ for path in module_search_paths: # 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. + else: # Custom. modules = methods.detect_modules(path, env_base["custom_modules_recursive"]) + # Provide default include path for both the custom module search `path` + # and the base directory containing custom modules, as it may be different + # from the built-in "modules" name (e.g. "custom_modules/summator/summator.h"), + # so it can be referenced simply as `#include "summator/summator.h"` + # independently of where a module is located on user's filesystem. + env_base.Prepend(CPPPATH=[path, os.path.dirname(path)]) # Note: custom modules can override built-in ones. modules_detected.update(modules) - include_path = os.path.dirname(path) - if include_path: - env_base.Prepend(CPPPATH=[include_path]) # Add module options. for name, path in modules_detected.items(): |