Clone of mesa.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

SConstruct 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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':
  60. force = ARGUMENTS['force_scons']
  61. if force.lower() not in {'false', 'off', 'none', '0', 'n'}:
  62. print("WARNING: Scons is deprecated for non-windows platforms (including cygwin) "
  63. "please use meson instead.", file=sys.stderr)
  64. else:
  65. print("ERROR: Scons is deprecated for non-windows platforms (including cygwin) "
  66. "please use meson instead. If you really need to use scons you "
  67. "can add `force_scons=1` to the scons command line.", file=sys.stderr)
  68. sys.exit(1)
  69. else:
  70. print("WARNING: Scons support is in the process of being deprecated on "
  71. "on windows platforms (including mingw). If you haven't already "
  72. "please try using meson for windows builds. Be sure to report any "
  73. "issues you run into", file=sys.stderr)
  74. #######################################################################
  75. # Environment setup
  76. with open("VERSION") as f:
  77. mesa_version = f.read().strip()
  78. env.Append(CPPDEFINES = [
  79. ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version),
  80. ('PACKAGE_BUGREPORT', '\\"https://gitlab.freedesktop.org/mesa/mesa/issues\\"'),
  81. ])
  82. # Includes
  83. env.Prepend(CPPPATH = [
  84. '#/include',
  85. ])
  86. env.Append(CPPPATH = [
  87. '#/src/gallium/include',
  88. '#/src/gallium/auxiliary',
  89. '#/src/gallium/drivers',
  90. '#/src/gallium/winsys',
  91. ])
  92. # for debugging
  93. #print env.Dump()
  94. # Add a check target for running tests
  95. check = env.Alias('check')
  96. env.AlwaysBuild(check)
  97. #######################################################################
  98. # Invoke host SConscripts
  99. #
  100. # For things that are meant to be run on the native host build machine, instead
  101. # of the target machine.
  102. #
  103. # Create host environent
  104. if env['crosscompile'] and not env['embedded']:
  105. host_env = Environment(
  106. options = opts,
  107. # no tool used
  108. tools = [],
  109. toolpath = ['#scons'],
  110. ENV = os.environ,
  111. )
  112. # Override options
  113. host_env['platform'] = common.host_platform
  114. host_env['machine'] = common.host_machine
  115. host_env['toolchain'] = 'default'
  116. host_env['llvm'] = False
  117. host_env.Tool('gallium')
  118. host_env['hostonly'] = True
  119. assert host_env['crosscompile'] == False
  120. target_env = env
  121. env = host_env
  122. Export('env')
  123. SConscript(
  124. 'src/SConscript',
  125. variant_dir = host_env['build_dir'],
  126. duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  127. )
  128. env = target_env
  129. Export('env')
  130. #######################################################################
  131. # Invoke SConscripts
  132. # TODO: Build several variants at the same time?
  133. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  134. SConscript(
  135. 'src/SConscript',
  136. variant_dir = env['build_dir'],
  137. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  138. )
  139. ########################################################################
  140. # List all aliases
  141. try:
  142. from SCons.Node.Alias import default_ans
  143. except ImportError:
  144. pass
  145. else:
  146. aliases = sorted(default_ans.keys())
  147. env.Help('\n')
  148. env.Help('Recognized targets:\n')
  149. for alias in aliases:
  150. env.Help(' %s\n' % alias)