options.py 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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
  25. import platform
  26. def AddOptions():
  27. ''' ===== Add generic options to SCons ===== '''
  28. AddOption('--dist',
  29. dest = 'make-dist',
  30. action = 'store_true',
  31. default = False,
  32. help = 'make distribution')
  33. AddOption('--project-path',
  34. dest = 'project-path',
  35. type = 'string',
  36. default = None,
  37. help = 'set project output path')
  38. AddOption('--project-name',
  39. dest = 'project-name',
  40. type = 'string',
  41. default = "project",
  42. help = 'set project name')
  43. AddOption('--cscope',
  44. dest = 'cscope',
  45. action = 'store_true',
  46. default = False,
  47. help = 'Build Cscope cross reference database. Requires cscope installed.')
  48. AddOption('--clang-analyzer',
  49. dest = 'clang-analyzer',
  50. action = 'store_true',
  51. default = False,
  52. help = 'Perform static analyze with Clang-analyzer. ' + \
  53. 'Requires Clang installed.' + \
  54. 'It is recommended to use with scan-build like this:' + \
  55. '`scan-build scons --clang-analyzer`' + \
  56. 'If things goes well, scan-build will instruct you to invoke scan-view.')
  57. AddOption('--buildlib',
  58. dest = 'buildlib',
  59. type = 'string',
  60. help = 'building library of a component')
  61. AddOption('--cleanlib',
  62. dest = 'cleanlib',
  63. action = 'store_true',
  64. default = False,
  65. help = 'clean up the library by --buildlib')
  66. AddOption('--target',
  67. dest = 'target',
  68. type = 'string',
  69. help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
  70. AddOption('--cmsispack',
  71. dest = 'cmsispack',
  72. type = 'string',
  73. help = 'set pack: <cmsispack path>')
  74. AddOption('--strict',
  75. dest='strict-compiling',
  76. help='Compiling project with strict mode and ALL warning will be errors',
  77. action='store_true',
  78. default=False)
  79. AddOption('--verbose',
  80. dest = 'verbose',
  81. action = 'store_true',
  82. default = False,
  83. help = 'print verbose information during build')
  84. AddOption('--cc-prefix', '--exec-prefix',
  85. dest = 'exec-prefix',
  86. type = 'string',
  87. help = 'set RTT_CC_PREFIX temperately')
  88. AddOption('--cc-path', '--exec-path',
  89. dest = 'exec-path',
  90. type = 'string',
  91. help = 'set RTT_EXEC_PATH temperately')
  92. AddOption('--stackanalysis',
  93. dest = 'stackanalysis',
  94. action = 'store_true',
  95. default = False,
  96. help = 'thread stack static analysis')
  97. AddOption('--genconfig',
  98. dest = 'genconfig',
  99. action = 'store_true',
  100. default = False,
  101. help = 'Generate .config from rtconfig.h')
  102. AddOption('--useconfig',
  103. dest = 'useconfig',
  104. type = 'string',
  105. help = 'make rtconfig.h from config file.')
  106. AddOption('--global-macros',
  107. dest = 'global-macros',
  108. type = 'string',
  109. help = 'attach global macros in the project. '+\
  110. 'e.g. scons --global-config=RT_USING_XX,RT_USING_YY'+\
  111. ' or scons --global-config="RT_USING_XX, RT_USING_YY"')
  112. AddOption('--reset-project-config',
  113. dest = 'reset-project-config',
  114. action = 'store_true',
  115. default = False,
  116. help = 'reset the project configurations to default')
  117. AddOption('--pyconfig',
  118. dest = 'pyconfig',
  119. action = 'store_true',
  120. default = False,
  121. help = 'Python GUI menuconfig for RT-Thread BSP')
  122. AddOption('--pyconfig-silent',
  123. dest = 'pyconfig-silent',
  124. action = 'store_true',
  125. default = False,
  126. help = 'Don`t show pyconfig window')
  127. AddOption('--menuconfig',
  128. dest = 'menuconfig',
  129. action = 'store_true',
  130. default = False,
  131. help = 'make menuconfig for RT-Thread BSP')
  132. AddOption('--gen-sdk-config',
  133. dest = 'gen-sdk-config',
  134. type = 'string',
  135. help = 'Generate a SDK configuration file')
  136. AddOption('--gen-sdk',
  137. dest = 'gen-sdk',
  138. type = 'string',
  139. help = 'Generate a SDK')
  140. AddOption('--build-type',
  141. dest = 'build-type',
  142. type = 'string',
  143. default = None,
  144. help = 'set BUILD_TYPE temperately, default is debug. ' +\
  145. 'e.g. scons --build-type=release ' +\
  146. 'or scons --build-type=debug')
  147. AddOption('--app_pkg',
  148. dest = 'app_pkg',
  149. type = 'string',
  150. help = 'application package')
  151. AddOption('--debug_mode',
  152. dest = 'debug_mode',
  153. type = 'int',
  154. help = 'application debug mode package')