diff options
| author | 朱天龙 (Armink) <[email protected]> | 2023-04-05 22:34:26 +0800 |
|---|---|---|
| committer | guo <[email protected]> | 2023-04-06 23:29:45 +0800 |
| commit | f458d63d5f2c9e287dd5b24a668a635b23e678ce (patch) | |
| tree | 078c7097450d6f4bc4416e83faee398f6da33cd9 /tools | |
| parent | 6c093ad654a38bf2cb93a5d14e6fd7480a52ad68 (diff) | |
[tools] Add `--add-rtconfig` args for scons when you want to add macro definitions build time.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/building.py | 14 | ||||
| -rw-r--r-- | tools/options.py | 4 |
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/building.py b/tools/building.py index fc86f31e7e..a4fc2c1aab 100644 --- a/tools/building.py +++ b/tools/building.py @@ -319,6 +319,19 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [ if rtconfig.PLATFORM in ['gcc'] and str(env['LINKFLAGS']).find('nano.specs') != -1: env.AppendUnique(CPPDEFINES = ['_REENT_SMALL']) + add_rtconfig = GetOption('add_rtconfig') + if add_rtconfig: + add_rtconfig = add_rtconfig.split(',') + if isinstance(add_rtconfig, list): + for config in add_rtconfig: + if isinstance(config, str): + AddDepend(add_rtconfig) + env.Append(CFLAGS=' -D' + config, CXXFLAGS=' -D' + config, AFLAGS=' -D' + config) + else: + print('add_rtconfig arguements are illegal!') + else: + print('add_rtconfig arguements are illegal!') + if GetOption('genconfig'): from genconf import genconfig genconfig() @@ -1051,3 +1064,4 @@ def PackageSConscript(package): from package import BuildPackage return BuildPackage(package) + diff --git a/tools/options.py b/tools/options.py index b02b81b5a3..439f13c6b5 100644 --- a/tools/options.py +++ b/tools/options.py @@ -127,6 +127,10 @@ def AddOptions(): action = 'store_true', default = False, help = 'Don`t show pyconfig window') + AddOption('--add-rtconfig', + dest = 'add_rtconfig', + type = 'string', + help = 'Add macro definitions and scons depend at build time. It is similar to adding macro definitions in rtconfig.h') if platform.system() != 'Windows': AddOption('--menuconfig', dest = 'menuconfig', |
