Clone of mesa.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

SConstruct 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. #######################################################################
  2. # Top-level SConstruct
  3. #
  4. # For example, invoke scons as
  5. #
  6. # scons debug=1 dri=0 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. # debug=1
  13. # dri=0
  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. import os
  23. import os.path
  24. import sys
  25. import SCons.Util
  26. import common
  27. #######################################################################
  28. # Configuration options
  29. default_statetrackers = 'mesa'
  30. default_targets = 'none'
  31. if common.default_platform in ('linux', 'freebsd', 'darwin'):
  32. default_drivers = 'softpipe,failover,svga,i915,i965,trace,identity,llvmpipe'
  33. default_winsys = 'xlib'
  34. elif common.default_platform in ('winddk',):
  35. default_drivers = 'softpipe,svga,i915,i965,trace,identity'
  36. default_winsys = 'all'
  37. elif common.default_platform in ('embedded',):
  38. default_drivers = 'softpipe,llvmpipe'
  39. default_winsys = 'xlib'
  40. else:
  41. default_drivers = 'all'
  42. default_winsys = 'all'
  43. opts = Variables('config.py')
  44. common.AddOptions(opts)
  45. opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
  46. ['mesa', 'python', 'xorg']))
  47. opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
  48. ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
  49. opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
  50. ['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'graw-xlib']))
  51. opts.Add(ListVariable('targets', 'driver targets to build', default_targets,
  52. ['dri-i915',
  53. 'dri-i965',
  54. 'dri-nouveau',
  55. 'dri-radeong',
  56. 'dri-swrast',
  57. 'dri-vmwgfx',
  58. 'egl-i915',
  59. 'egl-i965',
  60. 'egl-nouveau',
  61. 'egl-radeon',
  62. 'egl-swrast',
  63. 'egl-vmwgfx',
  64. 'graw-xlib',
  65. 'libgl-gdi',
  66. 'libgl-xlib',
  67. 'xorg-i915',
  68. 'xorg-i965',
  69. 'xorg-nouveau',
  70. 'xorg-radeon',
  71. 'xorg-vmwgfx']))
  72. opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
  73. env = Environment(
  74. options = opts,
  75. tools = ['gallium'],
  76. toolpath = ['#scons'],
  77. ENV = os.environ,
  78. )
  79. if os.environ.has_key('CC'):
  80. env['CC'] = os.environ['CC']
  81. if os.environ.has_key('CFLAGS'):
  82. env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
  83. if os.environ.has_key('CXX'):
  84. env['CXX'] = os.environ['CXX']
  85. if os.environ.has_key('CXXFLAGS'):
  86. env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
  87. if os.environ.has_key('LDFLAGS'):
  88. env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
  89. Help(opts.GenerateHelpText(env))
  90. # replicate options values in local variables
  91. debug = env['debug']
  92. dri = env['dri']
  93. machine = env['machine']
  94. platform = env['platform']
  95. # derived options
  96. x86 = machine == 'x86'
  97. ppc = machine == 'ppc'
  98. gcc = platform in ('linux', 'freebsd', 'darwin', 'embedded')
  99. msvc = platform in ('windows', 'winddk')
  100. Export([
  101. 'debug',
  102. 'x86',
  103. 'ppc',
  104. 'dri',
  105. 'platform',
  106. 'gcc',
  107. 'msvc',
  108. ])
  109. #######################################################################
  110. # Environment setup
  111. # Always build trace, rbug, identity, softpipe, and llvmpipe (where possible)
  112. if 'trace' not in env['drivers']:
  113. env['drivers'].append('trace')
  114. if 'rbug' not in env['drivers']:
  115. env['drivers'].append('rbug')
  116. if 'identity' not in env['drivers']:
  117. env['drivers'].append('identity')
  118. if 'softpipe' not in env['drivers']:
  119. env['drivers'].append('softpipe')
  120. if env['llvm'] and 'llvmpipe' not in env['drivers']:
  121. env['drivers'].append('llvmpipe')
  122. # Includes
  123. env.Prepend(CPPPATH = [
  124. '#/include',
  125. ])
  126. env.Append(CPPPATH = [
  127. '#/src/gallium/include',
  128. '#/src/gallium/auxiliary',
  129. '#/src/gallium/drivers',
  130. '#/src/gallium/winsys',
  131. ])
  132. if env['msvc']:
  133. env.Append(CPPPATH = ['#include/c99'])
  134. # Embedded
  135. if platform == 'embedded':
  136. env.Append(CPPDEFINES = [
  137. '_POSIX_SOURCE',
  138. ('_POSIX_C_SOURCE', '199309L'),
  139. '_SVID_SOURCE',
  140. '_BSD_SOURCE',
  141. '_GNU_SOURCE',
  142. 'PTHREADS',
  143. ])
  144. env.Append(LIBS = [
  145. 'm',
  146. 'pthread',
  147. 'dl',
  148. ])
  149. # Posix
  150. if platform in ('posix', 'linux', 'freebsd', 'darwin'):
  151. env.Append(CPPDEFINES = [
  152. '_POSIX_SOURCE',
  153. ('_POSIX_C_SOURCE', '199309L'),
  154. '_SVID_SOURCE',
  155. '_BSD_SOURCE',
  156. '_GNU_SOURCE',
  157. 'PTHREADS',
  158. 'HAVE_POSIX_MEMALIGN',
  159. ])
  160. if gcc:
  161. env.Append(CFLAGS = ['-fvisibility=hidden'])
  162. if platform == 'darwin':
  163. env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
  164. env.Append(LIBS = [
  165. 'm',
  166. 'pthread',
  167. 'dl',
  168. ])
  169. # for debugging
  170. #print env.Dump()
  171. Export('env')
  172. #######################################################################
  173. # Invoke SConscripts
  174. # TODO: Build several variants at the same time?
  175. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  176. if env['platform'] != common.default_platform:
  177. # GLSL code has to be built twice -- one for the host OS, another for the target OS...
  178. host_env = Environment(
  179. # options are ignored
  180. # default tool is used
  181. tools = ['default', 'custom'],
  182. toolpath = ['#scons'],
  183. ENV = os.environ,
  184. )
  185. host_env['platform'] = common.default_platform
  186. host_env['machine'] = common.default_machine
  187. host_env['debug'] = env['debug']
  188. SConscript(
  189. 'src/glsl/SConscript',
  190. variant_dir = os.path.join(env['build'], 'host'),
  191. duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  192. exports={'env':host_env},
  193. )
  194. SConscript(
  195. 'src/SConscript',
  196. variant_dir = env['build'],
  197. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  198. )
  199. env.Default('src')