Skip to content

Commit

Permalink
Merge pull request #46799 from goostengine/module-includes
Browse files Browse the repository at this point in the history
Provide missing include path for custom modules
  • Loading branch information
akien-mga authored Mar 14, 2021
2 parents 8051307 + f712d68 commit dc038bd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit dc038bd

Please sign in to comment.