options.py 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #
  2. # File : options.py
  3. # This file is part of RT-Thread RTOS
  4. # COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License along
  17. # with this program; if not, write to the Free Software Foundation, Inc.,
  18. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. #
  20. # Change Logs:
  21. # Date Author Notes
  22. # 2022-04-20 WuGensheng Add Options to SCons
  23. #
  24. from SCons.Script import AddOption, Dir
  25. import platform
  26. import os
  27. def AddOptions():
  28. ''' ===== Add generic options to SCons ===== '''
  29. AddOption('--dist',
  30. dest = 'make-dist',
  31. action = 'store_true',
  32. default = False,
  33. help = 'make distribution')
  34. AddOption('--dist-ide', '--dist-rtstudio',
  35. dest = 'make-dist-ide',
  36. action = 'store_true',
  37. default = False,
  38. help = 'make distribution for RT-Thread Studio IDE')
  39. AddOption('--project-path',
  40. dest = 'project-path',
  41. type = 'string',
  42. default = None,
  43. help = 'set project output path')
  44. AddOption('--project-name',
  45. dest = 'project-name',
  46. type = 'string',
  47. default = os.path.basename(Dir('#').abspath),
  48. help = 'set project name')
  49. AddOption('--cscope',
  50. dest = 'cscope',
  51. action = 'store_true',
  52. default = False,
  53. help = 'Build Cscope cross reference database. Requires cscope installed.')
  54. AddOption('--clang-analyzer',
  55. dest = 'clang-analyzer',
  56. action = 'store_true',
  57. default = False,
  58. help = 'Perform static analyze with Clang-analyzer. ' + \
  59. 'Requires Clang installed.' + \
  60. 'It is recommended to use with scan-build like this:' + \
  61. '`scan-build scons --clang-analyzer`' + \
  62. 'If things goes well, scan-build will instruct you to invoke scan-view.')
  63. AddOption('--buildlib',
  64. dest = 'buildlib',
  65. type = 'string',
  66. help = 'building library of a component')
  67. AddOption('--cleanlib',
  68. dest = 'cleanlib',
  69. action = 'store_true',
  70. default = False,
  71. help = 'clean up the library by --buildlib')
  72. AddOption('--target',
  73. dest = 'target',
  74. type = 'string',
  75. help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
  76. AddOption('--cmsispack',
  77. dest = 'cmsispack',
  78. type = 'string',
  79. help = 'set pack: <cmsispack path>')
  80. AddOption('--strict',
  81. dest='strict-compiling',
  82. help='Compiling project with strict mode and ALL warning will be errors',
  83. action='store_true',
  84. default=False)
  85. AddOption('--verbose',
  86. dest = 'verbose',
  87. action = 'store_true',
  88. default = False,
  89. help = 'print verbose information during build')
  90. AddOption('--cc-prefix', '--exec-prefix',
  91. dest = 'exec-prefix',
  92. type = 'string',
  93. help = 'set RTT_CC_PREFIX temperately')
  94. AddOption('--cc-path', '--exec-path',
  95. dest = 'exec-path',
  96. type = 'string',
  97. help = 'set RTT_EXEC_PATH temperately')
  98. AddOption('--stackanalysis',
  99. dest = 'stackanalysis',
  100. action = 'store_true',
  101. default = False,
  102. help = 'thread stack static analysis')
  103. AddOption('--genconfig',
  104. dest = 'genconfig',
  105. action = 'store_true',
  106. default = False,
  107. help = 'Generate .config from rtconfig.h')
  108. AddOption('--useconfig',
  109. dest = 'useconfig',
  110. type = 'string',
  111. help = 'make rtconfig.h from config file.')
  112. AddOption('--global-macros',
  113. dest = 'global-macros',
  114. type = 'string',
  115. help = 'attach global macros in the project. '+\
  116. 'e.g. scons --global-config=RT_USING_XX,RT_USING_YY'+\
  117. ' or scons --global-config="RT_USING_XX, RT_USING_YY"')
  118. AddOption('--reset-project-config',
  119. dest = 'reset-project-config',
  120. action = 'store_true',
  121. default = False,
  122. help = 'reset the project configurations to default')
  123. AddOption('--guiconfig', '--pyconfig',
  124. dest = 'guiconfig',
  125. action = 'store_true',
  126. default = False,
  127. help = 'Python GUI menuconfig for RT-Thread BSP')
  128. AddOption('--defconfig', '--pyconfig-silent',
  129. dest = 'defconfig',
  130. action = 'store_true',
  131. default = False,
  132. help = 'Don`t show Python GUI menuconfig window')
  133. AddOption('--menuconfig',
  134. dest = 'menuconfig',
  135. action = 'store_true',
  136. default = False,
  137. help = 'make menuconfig for RT-Thread BSP')
  138. AddOption('--cdb',
  139. dest = 'cdb',
  140. action = 'store_true',
  141. default = False,
  142. help = 'make compile_commands.json')