Clone of mesa.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

SConstruct 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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 = 'graw-null'
  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. 'graw-null',
  66. 'libgl-gdi',
  67. 'libgl-xlib',
  68. 'xorg-i915',
  69. 'xorg-i965',
  70. 'xorg-nouveau',
  71. 'xorg-radeon',
  72. 'xorg-vmwgfx']))
  73. opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
  74. env = Environment(
  75. options = opts,
  76. tools = ['gallium'],
  77. toolpath = ['#scons'],
  78. ENV = os.environ,
  79. )
  80. if os.environ.has_key('CC'):
  81. env['CC'] = os.environ['CC']
  82. if os.environ.has_key('CFLAGS'):
  83. env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
  84. if os.environ.has_key('CXX'):
  85. env['CXX'] = os.environ['CXX']
  86. if os.environ.has_key('CXXFLAGS'):
  87. env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
  88. if os.environ.has_key('LDFLAGS'):
  89. env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
  90. Help(opts.GenerateHelpText(env))
  91. # replicate options values in local variables
  92. debug = env['debug']
  93. dri = env['dri']
  94. machine = env['machine']
  95. platform = env['platform']
  96. # derived options
  97. x86 = machine == 'x86'
  98. ppc = machine == 'ppc'
  99. gcc = platform in ('linux', 'freebsd', 'darwin', 'embedded')
  100. msvc = platform in ('windows', 'winddk')
  101. Export([
  102. 'debug',
  103. 'x86',
  104. 'ppc',
  105. 'dri',
  106. 'platform',
  107. 'gcc',
  108. 'msvc',
  109. ])
  110. #######################################################################
  111. # Environment setup
  112. # Always build trace, rbug, identity, softpipe, and llvmpipe (where possible)
  113. if 'trace' not in env['drivers']:
  114. env['drivers'].append('trace')
  115. if 'rbug' not in env['drivers']:
  116. env['drivers'].append('rbug')
  117. if 'galahad' not in env['drivers']:
  118. env['drivers'].append('galahad')
  119. if 'identity' not in env['drivers']:
  120. env['drivers'].append('identity')
  121. if 'softpipe' not in env['drivers']:
  122. env['drivers'].append('softpipe')
  123. if env['llvm'] and 'llvmpipe' not in env['drivers']:
  124. env['drivers'].append('llvmpipe')
  125. if 'sw' not in env['drivers']:
  126. env['drivers'].append('sw')
  127. # Includes
  128. env.Prepend(CPPPATH = [
  129. '#/include',
  130. ])
  131. env.Append(CPPPATH = [
  132. '#/src/gallium/include',
  133. '#/src/gallium/auxiliary',
  134. '#/src/gallium/drivers',
  135. '#/src/gallium/winsys',
  136. ])
  137. if env['msvc']:
  138. env.Append(CPPPATH = ['#include/c99'])
  139. # Embedded
  140. if platform == 'embedded':
  141. env.Append(CPPDEFINES = [
  142. '_POSIX_SOURCE',
  143. ('_POSIX_C_SOURCE', '199309L'),
  144. '_SVID_SOURCE',
  145. '_BSD_SOURCE',
  146. '_GNU_SOURCE',
  147. 'PTHREADS',
  148. ])
  149. env.Append(LIBS = [
  150. 'm',
  151. 'pthread',
  152. 'dl',
  153. ])
  154. # Posix
  155. if platform in ('posix', 'linux', 'freebsd', 'darwin'):
  156. env.Append(CPPDEFINES = [
  157. '_POSIX_SOURCE',
  158. ('_POSIX_C_SOURCE', '199309L'),
  159. '_SVID_SOURCE',
  160. '_BSD_SOURCE',
  161. '_GNU_SOURCE',
  162. 'PTHREADS',
  163. 'HAVE_POSIX_MEMALIGN',
  164. ])
  165. if gcc:
  166. env.Append(CFLAGS = ['-fvisibility=hidden'])
  167. if platform == 'darwin':
  168. env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
  169. env.Append(LIBS = [
  170. 'm',
  171. 'pthread',
  172. 'dl',
  173. ])
  174. # for debugging
  175. #print env.Dump()
  176. Export('env')
  177. #######################################################################
  178. # Invoke SConscripts
  179. # TODO: Build several variants at the same time?
  180. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  181. if env['platform'] != common.default_platform:
  182. # GLSL code has to be built twice -- one for the host OS, another for the target OS...
  183. host_env = Environment(
  184. # options are ignored
  185. # default tool is used
  186. tools = ['default', 'custom'],
  187. toolpath = ['#scons'],
  188. ENV = os.environ,
  189. )
  190. host_env['platform'] = common.default_platform
  191. host_env['machine'] = common.default_machine
  192. host_env['debug'] = env['debug']
  193. SConscript(
  194. 'src/glsl/SConscript',
  195. variant_dir = os.path.join(env['build'], 'host'),
  196. duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  197. exports={'env':host_env},
  198. )
  199. SConscript(
  200. 'src/SConscript',
  201. variant_dir = env['build'],
  202. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  203. )
  204. env.Default('src')