options.py 5.7 KB

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