Skip to content

Commit

Permalink
Allowed to Import("projenv") in a library extra script
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jun 16, 2022
1 parent a3c98fe commit b3bb4bf
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions manifests/library-json/fields/build/extrascript.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,26 @@ Project structure
Import('env')
from os.path import join, realpath
# private flags (only for the current "SomeLib" source files)
# Private flags (only for the current "SomeLib" source files)
for item in env.get("CPPDEFINES", []):
if isinstance(item, tuple) and item[0] == "HAL":
env.Append(CPPPATH=[realpath(join("hal", item[1]))])
env.Replace(SRC_FILTER=["+<*>", "-<hal*>", "+<hal/%s>" % item[1]])
break
# pass flags to the global env (project files, frameworks)
# Pass flags to the Global environemnt (project `src` files, frameworks)
global_env = DefaultEnvironment()
global_env.Append(CPPDEFINES=[("TEST_GLOBAL", 1)])
# pass flags to the project dependencies (libraries)
# Pass flags to the other Library Dependencies
for lb in env.GetLibBuilders():
lb.env.Append(CPPDEFINES=[("TEST_LIBDEPS", 1)])
lb.env.Append(CPPDEFINES=[("TEST_LIBDEPS", 1)])
if lb.name == "OneWire":
lb.env.Append(CPPDEFINES=[("OW_PIN", 13)])
# Operate with the project environment (files located in the `src` folder)
Import("projenv")
# add (prepend) to the beginning of list
projenv.Prepend(CPPPATH=["some/path"])
# remove specified flags
projenv.ProcessUnFlags("-fno-rtti")

0 comments on commit b3bb4bf

Please sign in to comment.