Clone of mesa.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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