Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SConstruct 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #######################################################################
  2. # Top-level SConstruct
  3. #
  4. # For example, invoke scons as
  5. #
  6. # scons build=debug llvm=yes machine=x86
  7. #
  8. # to set configuration variables. Or you can write those options to a file
  9. # named config.py:
  10. #
  11. # # config.py
  12. # build='debug'
  13. # llvm=True
  14. # machine='x86'
  15. #
  16. # Invoke
  17. #
  18. # scons -h
  19. #
  20. # to get the full list of options. See scons manpage for more info.
  21. #
  22. from __future__ import print_function
  23. import os
  24. import os.path
  25. import sys
  26. import SCons.Util
  27. import common
  28. #######################################################################
  29. # Minimal scons version
  30. EnsureSConsVersion(2, 4)
  31. EnsurePythonVersion(2, 7)
  32. #######################################################################
  33. # Configuration options
  34. opts = Variables('config.py')
  35. common.AddOptions(opts)
  36. env = Environment(
  37. options = opts,
  38. tools = ['gallium'],
  39. toolpath = ['#scons'],
  40. ENV = os.environ,
  41. )
  42. # XXX: This creates a many problems as it saves...
  43. #opts.Save('config.py', env)
  44. # Backwards compatability with old target configuration variable
  45. try:
  46. targets = ARGUMENTS['targets']
  47. except KeyError:
  48. pass
  49. else:
  50. targets = targets.split(',')
  51. print('scons: warning: targets option is deprecated; pass the targets on their own such as')
  52. print()
  53. print(' scons %s' % ' '.join(targets))
  54. print()
  55. COMMAND_LINE_TARGETS.append(targets)
  56. Help(opts.GenerateHelpText(env))
  57. #######################################################################
  58. # Print a deprecation warning for using scons on non-windows
  59. if common.host_platform != 'windows' and env['platform'] != 'windows':
  60. if env['force_scons']:
  61. print("WARNING: Scons is deprecated for non-windows platforms (including cygwin) "
  62. "please use meson instead.", file=sys.stderr)
  63. else:
  64. print("ERROR: Scons is deprecated for non-windows platforms (including cygwin) "
  65. "please use meson instead. If you really need to use scons you "
  66. "can add `force_scons=1` to the scons command line.", file=sys.stderr)
  67. sys.exit(1)
  68. else:
  69. print("WARNING: Scons support is in the process of being deprecated on "
  70. "on windows platforms (including mingw). If you haven't already "
  71. "please try using meson for windows builds. Be sure to report any "
  72. "issues you run into", file=sys.stderr)
  73. #######################################################################
  74. # Environment setup
  75. with open("VERSION") as f:
  76. mesa_version = f.read().strip()
  77. env.Append(CPPDEFINES = [
  78. ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version),
  79. ('PACKAGE_BUGREPORT', '\\"https://gitlab.freedesktop.org/mesa/mesa/issues\\"'),
  80. ])
  81. # Includes
  82. env.Prepend(CPPPATH = [
  83. '#/include',
  84. ])
  85. env.Append(CPPPATH = [
  86. '#/src/gallium/include',
  87. '#/src/gallium/auxiliary',
  88. '#/src/gallium/drivers',
  89. '#/src/gallium/winsys',
  90. ])
  91. # for debugging
  92. #print env.Dump()
  93. # Add a check target for running tests
  94. check = env.Alias('check')
  95. env.AlwaysBuild(check)
  96. #######################################################################
  97. # Invoke host SConscripts
  98. #
  99. # For things that are meant to be run on the native host build machine, instead
  100. # of the target machine.
  101. #
  102. # Create host environent
  103. if env['crosscompile'] and not env['embedded']:
  104. host_env = Environment(
  105. options = opts,
  106. # no tool used
  107. tools = [],
  108. toolpath = ['#scons'],
  109. ENV = os.environ,
  110. )
  111. # Override options
  112. host_env['platform'] = common.host_platform
  113. host_env['machine'] = common.host_machine
  114. host_env['toolchain'] = 'default'
  115. host_env['llvm'] = False
  116. host_env.Tool('gallium')
  117. host_env['hostonly'] = True
  118. assert host_env['crosscompile'] == False
  119. target_env = env
  120. env = host_env
  121. Export('env')
  122. SConscript(
  123. 'src/SConscript',
  124. variant_dir = host_env['build_dir'],
  125. duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  126. )
  127. env = target_env
  128. Export('env')
  129. #######################################################################
  130. # Invoke SConscripts
  131. # TODO: Build several variants at the same time?
  132. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  133. SConscript(
  134. 'src/SConscript',
  135. variant_dir = env['build_dir'],
  136. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  137. )
  138. ########################################################################
  139. # List all aliases
  140. try:
  141. from SCons.Node.Alias import default_ans
  142. except ImportError:
  143. pass
  144. else:
  145. aliases = sorted(default_ans.keys())
  146. env.Help('\n')
  147. env.Help('Recognized targets:\n')
  148. for alias in aliases:
  149. env.Help(' %s\n' % alias)