summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhkag <[email protected]>2023-12-06 15:09:42 +0800
committerguo <[email protected]>2023-12-06 15:35:04 +0800
commit4bd5c31dacbfa2fb68b04cbda290c08563fbf870 (patch)
tree6bf64b4f6574c1b87996e4e0eecef93ec67a00c7
parent4ffc3a4a453a23923230be99c97402ab296a4c9a (diff)
[tools] format the options
- format command options - rename the --add_rtconfig as --global-macros
-rw-r--r--tools/building.py18
-rw-r--r--tools/options.py113
2 files changed, 66 insertions, 65 deletions
diff --git a/tools/building.py b/tools/building.py
index c56ac97491..dde795d789 100644
--- a/tools/building.py
+++ b/tools/building.py
@@ -288,18 +288,18 @@ 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:
+ attach_global_macros = GetOption('global-macros')
+ if attach_global_macros:
+ attach_global_macros = attach_global_macros.split(',')
+ if isinstance(attach_global_macros, list):
+ for config in attach_global_macros:
if isinstance(config, str):
- AddDepend(add_rtconfig)
+ AddDepend(attach_global_macros)
env.Append(CFLAGS=' -D' + config, CXXFLAGS=' -D' + config, AFLAGS=' -D' + config)
else:
- print('add_rtconfig arguements are illegal!')
+ print('--global-macros arguments are illegal!')
else:
- print('add_rtconfig arguements are illegal!')
+ print('--global-macros arguments are illegal!')
if GetOption('genconfig'):
from genconf import genconfig
@@ -316,7 +316,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
menuconfig(Rtt_Root)
exit(0)
- if GetOption('pyconfig_silent'):
+ if GetOption('pyconfig-silent'):
from menuconfig import guiconfig_silent
guiconfig_silent(Rtt_Root)
exit(0)
diff --git a/tools/options.py b/tools/options.py
index 5777daf173..c84d824ba9 100644
--- a/tools/options.py
+++ b/tools/options.py
@@ -27,68 +27,67 @@ import platform
def AddOptions():
''' ===== Add generic options to SCons ===== '''
-
AddOption('--dist',
- dest = 'make-dist',
- action = 'store_true',
- default = False,
- help = 'make distribution')
+ dest = 'make-dist',
+ action = 'store_true',
+ default = False,
+ help = 'make distribution')
AddOption('--dist-ide', '--dist-rtstudio',
- dest = 'make-dist-ide',
- action = 'store_true',
- default = False,
- help = 'make distribution for RT-Thread Studio IDE')
+ dest = 'make-dist-ide',
+ action = 'store_true',
+ default = False,
+ help = 'make distribution for RT-Thread Studio IDE')
AddOption('--project-path',
- dest = 'project-path',
- type = 'string',
- default = None,
- help = 'set project output path')
+ dest = 'project-path',
+ type = 'string',
+ default = None,
+ help = 'set project output path')
AddOption('--project-name',
- dest = 'project-name',
- type = 'string',
- default = "project",
- help = 'set project name')
- AddOption('--reset-project-config',
- dest = 'reset-project-config',
- action = 'store_true',
- default = False,
- help = 'reset the project configurations to default')
+ dest = 'project-name',
+ type = 'string',
+ default = "project",
+ help = 'set project name')
AddOption('--cscope',
- dest = 'cscope',
- action = 'store_true',
- default = False,
- help = 'Build Cscope cross reference database. Requires cscope installed.')
+ dest = 'cscope',
+ action = 'store_true',
+ default = False,
+ help = 'Build Cscope cross reference database. Requires cscope installed.')
AddOption('--clang-analyzer',
- dest = 'clang-analyzer',
- action = 'store_true',
- default = False,
- help = 'Perform static analyze with Clang-analyzer. ' + \
- 'Requires Clang installed.\n' + \
- 'It is recommended to use with scan-build like this:\n' + \
- '`scan-build scons --clang-analyzer`\n' + \
- 'If things goes well, scan-build will instruct you to invoke scan-view.')
+ dest = 'clang-analyzer',
+ action = 'store_true',
+ default = False,
+ help = 'Perform static analyze with Clang-analyzer. ' + \
+ 'Requires Clang installed.' + \
+ 'It is recommended to use with scan-build like this:' + \
+ '`scan-build scons --clang-analyzer`' + \
+ 'If things goes well, scan-build will instruct you to invoke scan-view.')
AddOption('--buildlib',
- dest = 'buildlib',
- type = 'string',
- help = 'building library of a component')
+ dest = 'buildlib',
+ type = 'string',
+ help = 'building library of a component')
AddOption('--cleanlib',
- dest = 'cleanlib',
- action = 'store_true',
- default = False,
- help = 'clean up the library by --buildlib')
+ dest = 'cleanlib',
+ action = 'store_true',
+ default = False,
+ help = 'clean up the library by --buildlib')
AddOption('--target',
- dest = 'target',
- type = 'string',
- help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
- AddOption('--pack',
- dest = 'cmsispack',
- type = 'string',
- help = 'set pack: <cmsispack path>')
+ dest = 'target',
+ type = 'string',
+ help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
+ AddOption('--cmsispack',
+ dest = 'cmsispack',
+ type = 'string',
+ help = 'set pack: <cmsispack path>')
AddOption('--strict',
dest='strict-compiling',
help='Compiling project with strict mode and ALL warning will be errors',
action='store_true',
default=False)
+ AddOption('--verbose',
+ dest = 'verbose',
+ action = 'store_true',
+ default = False,
+ help = 'print verbose information during build')
AddOption('--cc-prefix', '--exec-prefix',
dest = 'exec-prefix',
type = 'string',
@@ -111,25 +110,27 @@ def AddOptions():
dest = 'useconfig',
type = 'string',
help = 'make rtconfig.h from config file.')
- AddOption('--verbose',
- dest = 'verbose',
+ AddOption('--global-macros',
+ dest = 'global-macros',
+ type = 'string',
+ help = 'attach global macros in the project. '+\
+ 'e.g. scons --global-config=RT_USING_XX,RT_USING_YY'+\
+ ' or scons --global-config="RT_USING_XX, RT_USING_YY"')
+ AddOption('--reset-project-config',
+ dest = 'reset-project-config',
action = 'store_true',
default = False,
- help = 'print verbose information during build')
+ help = 'reset the project configurations to default')
AddOption('--pyconfig',
dest = 'pyconfig',
action = 'store_true',
default = False,
help = 'Python GUI menuconfig for RT-Thread BSP')
AddOption('--pyconfig-silent',
- dest = 'pyconfig_silent',
+ dest = 'pyconfig-silent',
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',