Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SConstruct 4.5KB

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