Clone of mesa.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

SConstruct 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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', 'egl']))
  47. opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
  48. ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'r600', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
  49. opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
  50. ['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'r600', '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 'galahad' not in env['drivers']:
  117. env['drivers'].append('galahad')
  118. if 'identity' not in env['drivers']:
  119. env['drivers'].append('identity')
  120. if 'softpipe' not in env['drivers']:
  121. env['drivers'].append('softpipe')
  122. if env['llvm'] and 'llvmpipe' not in env['drivers']:
  123. env['drivers'].append('llvmpipe')
  124. if 'sw' not in env['drivers']:
  125. env['drivers'].append('sw')
  126. # Includes
  127. env.Prepend(CPPPATH = [
  128. '#/include',
  129. ])
  130. env.Append(CPPPATH = [
  131. '#/src/gallium/include',
  132. '#/src/gallium/auxiliary',
  133. '#/src/gallium/drivers',
  134. '#/src/gallium/winsys',
  135. ])
  136. if env['msvc']:
  137. env.Append(CPPPATH = ['#include/c99'])
  138. # Embedded
  139. if platform == 'embedded':
  140. env.Append(CPPDEFINES = [
  141. '_POSIX_SOURCE',
  142. ('_POSIX_C_SOURCE', '199309L'),
  143. '_SVID_SOURCE',
  144. '_BSD_SOURCE',
  145. '_GNU_SOURCE',
  146. 'PTHREADS',
  147. ])
  148. env.Append(LIBS = [
  149. 'm',
  150. 'pthread',
  151. 'dl',
  152. ])
  153. # Posix
  154. if platform in ('posix', 'linux', 'freebsd', 'darwin'):
  155. env.Append(CPPDEFINES = [
  156. '_POSIX_SOURCE',
  157. ('_POSIX_C_SOURCE', '199309L'),
  158. '_SVID_SOURCE',
  159. '_BSD_SOURCE',
  160. '_GNU_SOURCE',
  161. 'PTHREADS',
  162. 'HAVE_POSIX_MEMALIGN',
  163. ])
  164. if gcc:
  165. env.Append(CFLAGS = ['-fvisibility=hidden'])
  166. if platform == 'darwin':
  167. env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
  168. env.Append(LIBS = [
  169. 'm',
  170. 'pthread',
  171. 'dl',
  172. ])
  173. # for debugging
  174. #print env.Dump()
  175. Export('env')
  176. #######################################################################
  177. # Invoke SConscripts
  178. # TODO: Build several variants at the same time?
  179. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  180. SConscript(
  181. 'src/SConscript',
  182. variant_dir = env['build'],
  183. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  184. )
  185. env.Default('src')