Clone of mesa.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

SConstruct 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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', 'i915', 'i965', 'gdi', 'radeon', 'graw-xlib']))
  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. # Always build trace and identity drivers
  97. if 'trace' not in env['drivers']:
  98. env['drivers'].append('trace')
  99. if 'identity' not in env['drivers']:
  100. env['drivers'].append('identity')
  101. # Includes
  102. env.Append(CPPPATH = [
  103. '#/include',
  104. '#/src/gallium/include',
  105. '#/src/gallium/auxiliary',
  106. '#/src/gallium/drivers',
  107. '#/src/gallium/winsys',
  108. ])
  109. if env['msvc']:
  110. env.Append(CPPPATH = ['#include/c99'])
  111. # Embedded
  112. if platform == 'embedded':
  113. env.Append(CPPDEFINES = [
  114. '_POSIX_SOURCE',
  115. ('_POSIX_C_SOURCE', '199309L'),
  116. '_SVID_SOURCE',
  117. '_BSD_SOURCE',
  118. '_GNU_SOURCE',
  119. 'PTHREADS',
  120. ])
  121. env.Append(LIBS = [
  122. 'm',
  123. 'pthread',
  124. 'dl',
  125. ])
  126. # Posix
  127. if platform in ('posix', 'linux', 'freebsd', 'darwin'):
  128. env.Append(CPPDEFINES = [
  129. '_POSIX_SOURCE',
  130. ('_POSIX_C_SOURCE', '199309L'),
  131. '_SVID_SOURCE',
  132. '_BSD_SOURCE',
  133. '_GNU_SOURCE',
  134. 'PTHREADS',
  135. 'HAVE_POSIX_MEMALIGN',
  136. ])
  137. if platform == 'darwin':
  138. env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
  139. env.Append(LIBS = [
  140. 'm',
  141. 'pthread',
  142. 'dl',
  143. ])
  144. # DRI
  145. if dri:
  146. env.ParseConfig('pkg-config --cflags --libs libdrm')
  147. env.Append(CPPDEFINES = [
  148. ('USE_EXTERNAL_DXTN_LIB', '1'),
  149. 'IN_DRI_DRIVER',
  150. 'GLX_DIRECT_RENDERING',
  151. 'GLX_INDIRECT_RENDERING',
  152. ])
  153. # LLVM support in the Draw module
  154. if drawllvm:
  155. env.Append(CPPDEFINES = ['DRAW_LLVM'])
  156. # for debugging
  157. #print env.Dump()
  158. Export('env')
  159. #######################################################################
  160. # Invoke SConscripts
  161. # TODO: Build several variants at the same time?
  162. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  163. if env['platform'] != common.default_platform:
  164. # GLSL code has to be built twice -- one for the host OS, another for the target OS...
  165. host_env = Environment(
  166. # options are ignored
  167. # default tool is used
  168. tools = ['default', 'custom'],
  169. toolpath = ['#scons'],
  170. ENV = os.environ,
  171. )
  172. host_env['platform'] = common.default_platform
  173. host_env['machine'] = common.default_machine
  174. host_env['debug'] = env['debug']
  175. SConscript(
  176. 'src/glsl/SConscript',
  177. variant_dir = os.path.join(env['build'], 'host'),
  178. duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  179. exports={'env':host_env},
  180. )
  181. SConscript(
  182. 'src/SConscript',
  183. variant_dir = env['build'],
  184. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  185. )
  186. env.Default('src')
  187. SConscript(
  188. 'progs/SConscript',
  189. variant_dir = os.path.join('progs', env['build']),
  190. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  191. )