2022-04-22 08:23:35 +08:00
|
|
|
#
|
|
|
|
# File : options.py
|
|
|
|
# This file is part of RT-Thread RTOS
|
|
|
|
# COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# Change Logs:
|
|
|
|
# Date Author Notes
|
|
|
|
# 2022-04-20 WuGensheng Add Options to SCons
|
|
|
|
#
|
|
|
|
|
2024-11-06 20:37:02 +08:00
|
|
|
from SCons.Script import AddOption, Dir
|
2022-04-22 08:23:35 +08:00
|
|
|
import platform
|
2024-11-06 20:37:02 +08:00
|
|
|
import os
|
2022-04-22 08:23:35 +08:00
|
|
|
|
|
|
|
def AddOptions():
|
2022-06-15 16:58:16 +08:00
|
|
|
''' ===== Add generic options to SCons ===== '''
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--dist',
|
2023-12-06 15:09:42 +08:00
|
|
|
dest = 'make-dist',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'make distribution')
|
2022-09-30 00:42:29 +08:00
|
|
|
AddOption('--dist-ide', '--dist-rtstudio',
|
2023-12-06 15:09:42 +08:00
|
|
|
dest = 'make-dist-ide',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'make distribution for RT-Thread Studio IDE')
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--project-path',
|
2023-12-06 15:09:42 +08:00
|
|
|
dest = 'project-path',
|
|
|
|
type = 'string',
|
|
|
|
default = None,
|
|
|
|
help = 'set project output path')
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--project-name',
|
2023-12-06 15:09:42 +08:00
|
|
|
dest = 'project-name',
|
|
|
|
type = 'string',
|
2024-11-06 20:37:02 +08:00
|
|
|
default = os.path.basename(Dir('#').abspath),
|
2023-12-06 15:09:42 +08:00
|
|
|
help = 'set project name')
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--cscope',
|
2023-12-06 15:09:42 +08:00
|
|
|
dest = 'cscope',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'Build Cscope cross reference database. Requires cscope installed.')
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--clang-analyzer',
|
2023-12-06 15:09:42 +08:00
|
|
|
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.')
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--buildlib',
|
2023-12-06 15:09:42 +08:00
|
|
|
dest = 'buildlib',
|
|
|
|
type = 'string',
|
|
|
|
help = 'building library of a component')
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--cleanlib',
|
2023-12-06 15:09:42 +08:00
|
|
|
dest = 'cleanlib',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'clean up the library by --buildlib')
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--target',
|
2023-12-06 15:09:42 +08:00
|
|
|
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>')
|
2023-01-12 13:45:02 +08:00
|
|
|
AddOption('--strict',
|
|
|
|
dest='strict-compiling',
|
|
|
|
help='Compiling project with strict mode and ALL warning will be errors',
|
|
|
|
action='store_true',
|
|
|
|
default=False)
|
2023-12-06 15:09:42 +08:00
|
|
|
AddOption('--verbose',
|
|
|
|
dest = 'verbose',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'print verbose information during build')
|
2023-01-02 12:46:45 +08:00
|
|
|
AddOption('--cc-prefix', '--exec-prefix',
|
2022-12-07 11:30:28 +08:00
|
|
|
dest = 'exec-prefix',
|
|
|
|
type = 'string',
|
2023-01-02 12:46:45 +08:00
|
|
|
help = 'set RTT_CC_PREFIX temperately')
|
|
|
|
AddOption('--cc-path', '--exec-path',
|
2022-09-18 05:01:14 +08:00
|
|
|
dest = 'exec-path',
|
|
|
|
type = 'string',
|
|
|
|
help = 'set RTT_EXEC_PATH temperately')
|
2022-04-22 08:23:35 +08:00
|
|
|
AddOption('--stackanalysis',
|
|
|
|
dest = 'stackanalysis',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'thread stack static analysis')
|
|
|
|
AddOption('--genconfig',
|
|
|
|
dest = 'genconfig',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'Generate .config from rtconfig.h')
|
|
|
|
AddOption('--useconfig',
|
|
|
|
dest = 'useconfig',
|
|
|
|
type = 'string',
|
|
|
|
help = 'make rtconfig.h from config file.')
|
2023-12-06 15:09:42 +08:00
|
|
|
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',
|
2022-04-22 08:23:35 +08:00
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
2023-12-06 15:09:42 +08:00
|
|
|
help = 'reset the project configurations to default')
|
2024-07-31 00:52:25 +08:00
|
|
|
AddOption('--guiconfig', '--pyconfig',
|
|
|
|
dest = 'guiconfig',
|
2022-04-22 08:23:35 +08:00
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'Python GUI menuconfig for RT-Thread BSP')
|
2024-07-31 00:52:25 +08:00
|
|
|
AddOption('--defconfig', '--pyconfig-silent',
|
|
|
|
dest = 'defconfig',
|
2022-04-22 08:23:35 +08:00
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
2024-07-31 00:52:25 +08:00
|
|
|
help = 'Don`t show Python GUI menuconfig window')
|
2024-04-19 08:48:32 +08:00
|
|
|
AddOption('--menuconfig',
|
|
|
|
dest = 'menuconfig',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'make menuconfig for RT-Thread BSP')
|
2024-05-03 16:04:55 +08:00
|
|
|
AddOption('--cdb',
|
|
|
|
dest = 'cdb',
|
|
|
|
action = 'store_true',
|
|
|
|
default = False,
|
|
|
|
help = 'make compile_commands.json')
|