options.py 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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-strip',
  34. dest = 'make-dist-strip',
  35. action = 'store_true',
  36. default = False,
  37. help = 'make distribution and strip useless files')
  38. AddOption('--dist-ide', '--dist-rtstudio',
  39. dest = 'make-dist-ide',
  40. action = 'store_true',
  41. default = False,
  42. help = 'make distribution for RT-Thread Studio IDE')
  43. AddOption('--project-path',
  44. dest = 'project-path',
  45. type = 'string',
  46. default = None,
  47. help = 'set project output path')
  48. AddOption('--project-name',
  49. dest = 'project-name',
  50. type = 'string',
  51. default = "project",
  52. help = 'set project name')
  53. AddOption('--reset-project-config',
  54. dest = 'reset-project-config',
  55. action = 'store_true',
  56. default = False,
  57. help = 'reset the project configurations to default')
  58. AddOption('--cscope',
  59. dest = 'cscope',
  60. action = 'store_true',
  61. default = False,
  62. help = 'Build Cscope cross reference database. Requires cscope installed.')
  63. AddOption('--clang-analyzer',
  64. dest = 'clang-analyzer',
  65. action = 'store_true',
  66. default = False,
  67. help = 'Perform static analyze with Clang-analyzer. ' + \
  68. 'Requires Clang installed.\n' + \
  69. 'It is recommended to use with scan-build like this:\n' + \
  70. '`scan-build scons --clang-analyzer`\n' + \
  71. 'If things goes well, scan-build will instruct you to invoke scan-view.')
  72. AddOption('--buildlib',
  73. dest = 'buildlib',
  74. type = 'string',
  75. help = 'building library of a component')
  76. AddOption('--cleanlib',
  77. dest = 'cleanlib',
  78. action = 'store_true',
  79. default = False,
  80. help = 'clean up the library by --buildlib')
  81. AddOption('--target',
  82. dest = 'target',
  83. type = 'string',
  84. help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
  85. AddOption('--strict',
  86. dest='strict-compiling',
  87. help='Compiling project with strict mode and ALL warning will be errors',
  88. action='store_true',
  89. default=False)
  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('--verbose',
  113. dest = 'verbose',
  114. action = 'store_true',
  115. default = False,
  116. help = 'print verbose information during build')
  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. if platform.system() != 'Windows':
  128. AddOption('--menuconfig',
  129. dest = 'menuconfig',
  130. action = 'store_true',
  131. default = False,
  132. help = 'make menuconfig for RT-Thread BSP')