options.py 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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('--reset-project-config',
  49. dest = 'reset-project-config',
  50. action = 'store_true',
  51. default = False,
  52. help = 'reset the project configurations to default')
  53. AddOption('--cscope',
  54. dest = 'cscope',
  55. action = 'store_true',
  56. default = False,
  57. help = 'Build Cscope cross reference database. Requires cscope installed.')
  58. AddOption('--clang-analyzer',
  59. dest = 'clang-analyzer',
  60. action = 'store_true',
  61. default = False,
  62. help = 'Perform static analyze with Clang-analyzer. ' + \
  63. 'Requires Clang installed.\n' + \
  64. 'It is recommended to use with scan-build like this:\n' + \
  65. '`scan-build scons --clang-analyzer`\n' + \
  66. 'If things goes well, scan-build will instruct you to invoke scan-view.')
  67. AddOption('--buildlib',
  68. dest = 'buildlib',
  69. type = 'string',
  70. help = 'building library of a component')
  71. AddOption('--cleanlib',
  72. dest = 'cleanlib',
  73. action = 'store_true',
  74. default = False,
  75. help = 'clean up the library by --buildlib')
  76. AddOption('--target',
  77. dest = 'target',
  78. type = 'string',
  79. help = 'set target project: mdk/mdk4/mdk5/iar/vs/vsc/ua/cdk/ses/makefile/eclipse/codelite/cmake')
  80. AddOption('--pack',
  81. dest = 'cmsispack',
  82. type = 'string',
  83. help = 'set pack: <cmsispack path>')
  84. AddOption('--strict',
  85. dest='strict-compiling',
  86. help='Compiling project with strict mode and ALL warning will be errors',
  87. action='store_true',
  88. default=False)
  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('--verbose',
  112. dest = 'verbose',
  113. action = 'store_true',
  114. default = False,
  115. help = 'print verbose information during build')
  116. AddOption('--pyconfig',
  117. dest = 'pyconfig',
  118. action = 'store_true',
  119. default = False,
  120. help = 'Python GUI menuconfig for RT-Thread BSP')
  121. AddOption('--pyconfig-silent',
  122. dest = 'pyconfig_silent',
  123. action = 'store_true',
  124. default = False,
  125. help = 'Don`t show pyconfig window')
  126. AddOption('--add-rtconfig',
  127. dest = 'add_rtconfig',
  128. type = 'string',
  129. help = 'Add macro definitions and scons depend at build time. It is similar to adding macro definitions in rtconfig.h')
  130. if platform.system() != 'Windows':
  131. AddOption('--menuconfig',
  132. dest = 'menuconfig',
  133. action = 'store_true',
  134. default = False,
  135. help = 'make menuconfig for RT-Thread BSP')