[tools] format the options

- format command options
    - rename the --add_rtconfig as --global-macros
This commit is contained in:
zhkag 2023-12-06 15:09:42 +08:00 committed by guo
parent 4ffc3a4a45
commit 4bd5c31dac
2 changed files with 66 additions and 65 deletions

View File

@ -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: if rtconfig.PLATFORM in ['gcc'] and str(env['LINKFLAGS']).find('nano.specs') != -1:
env.AppendUnique(CPPDEFINES = ['_REENT_SMALL']) env.AppendUnique(CPPDEFINES = ['_REENT_SMALL'])
add_rtconfig = GetOption('add_rtconfig') attach_global_macros = GetOption('global-macros')
if add_rtconfig: if attach_global_macros:
add_rtconfig = add_rtconfig.split(',') attach_global_macros = attach_global_macros.split(',')
if isinstance(add_rtconfig, list): if isinstance(attach_global_macros, list):
for config in add_rtconfig: for config in attach_global_macros:
if isinstance(config, str): if isinstance(config, str):
AddDepend(add_rtconfig) AddDepend(attach_global_macros)
env.Append(CFLAGS=' -D' + config, CXXFLAGS=' -D' + config, AFLAGS=' -D' + config) env.Append(CFLAGS=' -D' + config, CXXFLAGS=' -D' + config, AFLAGS=' -D' + config)
else: else:
print('add_rtconfig arguements are illegal!') print('--global-macros arguments are illegal!')
else: else:
print('add_rtconfig arguements are illegal!') print('--global-macros arguments are illegal!')
if GetOption('genconfig'): if GetOption('genconfig'):
from genconf import genconfig from genconf import genconfig
@ -316,7 +316,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
menuconfig(Rtt_Root) menuconfig(Rtt_Root)
exit(0) exit(0)
if GetOption('pyconfig_silent'): if GetOption('pyconfig-silent'):
from menuconfig import guiconfig_silent from menuconfig import guiconfig_silent
guiconfig_silent(Rtt_Root) guiconfig_silent(Rtt_Root)
exit(0) exit(0)

View File

@ -27,68 +27,67 @@ import platform
def AddOptions(): def AddOptions():
''' ===== Add generic options to SCons ===== ''' ''' ===== Add generic options to SCons ===== '''
AddOption('--dist', AddOption('--dist',
dest = 'make-dist', dest = 'make-dist',
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'make distribution') help = 'make distribution')
AddOption('--dist-ide', '--dist-rtstudio', AddOption('--dist-ide', '--dist-rtstudio',
dest = 'make-dist-ide', dest = 'make-dist-ide',
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'make distribution for RT-Thread Studio IDE') help = 'make distribution for RT-Thread Studio IDE')
AddOption('--project-path', AddOption('--project-path',
dest = 'project-path', dest = 'project-path',
type = 'string', type = 'string',
default = None, default = None,
help = 'set project output path') help = 'set project output path')
AddOption('--project-name', AddOption('--project-name',
dest = 'project-name', dest = 'project-name',
type = 'string', type = 'string',
default = "project", default = "project",
help = 'set project name') help = 'set project name')
AddOption('--reset-project-config',
dest = 'reset-project-config',
action = 'store_true',
default = False,
help = 'reset the project configurations to default')
AddOption('--cscope', AddOption('--cscope',
dest = 'cscope', dest = 'cscope',
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'Build Cscope cross reference database. Requires cscope installed.') help = 'Build Cscope cross reference database. Requires cscope installed.')
AddOption('--clang-analyzer', AddOption('--clang-analyzer',
dest = 'clang-analyzer', dest = 'clang-analyzer',
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'Perform static analyze with Clang-analyzer. ' + \ help = 'Perform static analyze with Clang-analyzer. ' + \
'Requires Clang installed.\n' + \ 'Requires Clang installed.' + \
'It is recommended to use with scan-build like this:\n' + \ 'It is recommended to use with scan-build like this:' + \
'`scan-build scons --clang-analyzer`\n' + \ '`scan-build scons --clang-analyzer`' + \
'If things goes well, scan-build will instruct you to invoke scan-view.') 'If things goes well, scan-build will instruct you to invoke scan-view.')
AddOption('--buildlib', AddOption('--buildlib',
dest = 'buildlib', dest = 'buildlib',
type = 'string', type = 'string',
help = 'building library of a component') help = 'building library of a component')
AddOption('--cleanlib', AddOption('--cleanlib',
dest = 'cleanlib', dest = 'cleanlib',
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'clean up the library by --buildlib') help = 'clean up the library by --buildlib')
AddOption('--target', AddOption('--target',
dest = 'target', dest = 'target',
type = 'string', type = 'string',
help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake') help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
AddOption('--pack', AddOption('--cmsispack',
dest = 'cmsispack', dest = 'cmsispack',
type = 'string', type = 'string',
help = 'set pack: <cmsispack path>') help = 'set pack: <cmsispack path>')
AddOption('--strict', AddOption('--strict',
dest='strict-compiling', dest='strict-compiling',
help='Compiling project with strict mode and ALL warning will be errors', help='Compiling project with strict mode and ALL warning will be errors',
action='store_true', action='store_true',
default=False) default=False)
AddOption('--verbose',
dest = 'verbose',
action = 'store_true',
default = False,
help = 'print verbose information during build')
AddOption('--cc-prefix', '--exec-prefix', AddOption('--cc-prefix', '--exec-prefix',
dest = 'exec-prefix', dest = 'exec-prefix',
type = 'string', type = 'string',
@ -111,25 +110,27 @@ def AddOptions():
dest = 'useconfig', dest = 'useconfig',
type = 'string', type = 'string',
help = 'make rtconfig.h from config file.') help = 'make rtconfig.h from config file.')
AddOption('--verbose', AddOption('--global-macros',
dest = 'verbose', 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', action = 'store_true',
default = False, default = False,
help = 'print verbose information during build') help = 'reset the project configurations to default')
AddOption('--pyconfig', AddOption('--pyconfig',
dest = 'pyconfig', dest = 'pyconfig',
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'Python GUI menuconfig for RT-Thread BSP') help = 'Python GUI menuconfig for RT-Thread BSP')
AddOption('--pyconfig-silent', AddOption('--pyconfig-silent',
dest = 'pyconfig_silent', dest = 'pyconfig-silent',
action = 'store_true', action = 'store_true',
default = False, default = False,
help = 'Don`t show pyconfig window') 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': if platform.system() != 'Windows':
AddOption('--menuconfig', AddOption('--menuconfig',
dest = 'menuconfig', dest = 'menuconfig',