Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SConstruct 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. if common.default_platform in ('linux', 'freebsd', 'darwin'):
  29. default_statetrackers = 'all'
  30. default_drivers = 'softpipe,failover,i915simple,i965simple'
  31. default_winsys = 'xlib'
  32. elif common.default_platform in ('winddk',):
  33. default_statetrackers = 'all'
  34. default_drivers = 'softpipe,i915simple'
  35. default_winsys = 'all'
  36. else:
  37. default_statetrackers = 'all'
  38. default_drivers = 'all'
  39. default_winsys = 'all'
  40. opts = Options('config.py')
  41. common.AddOptions(opts)
  42. opts.Add(ListOption('statetrackers', 'state trackers to build', default_statetrackers,
  43. ['mesa']))
  44. opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers,
  45. ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell']))
  46. opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
  47. ['xlib', 'intel', 'gdi']))
  48. env = Environment(
  49. options = opts,
  50. tools = ['gallium'],
  51. toolpath = ['scons'],
  52. ENV = os.environ,
  53. )
  54. Help(opts.GenerateHelpText(env))
  55. # replicate options values in local variables
  56. debug = env['debug']
  57. dri = env['dri']
  58. llvm = env['llvm']
  59. machine = env['machine']
  60. platform = env['platform']
  61. # derived options
  62. x86 = machine == 'x86'
  63. gcc = platform in ('linux', 'freebsd', 'darwin')
  64. msvc = platform in ('windows', 'winddk')
  65. Export([
  66. 'debug',
  67. 'x86',
  68. 'dri',
  69. 'llvm',
  70. 'platform',
  71. 'gcc',
  72. 'msvc',
  73. ])
  74. #######################################################################
  75. # Environment setup
  76. # Includes
  77. env.Append(CPPPATH = [
  78. '#/include',
  79. '#/src/gallium/include',
  80. '#/src/gallium/auxiliary',
  81. '#/src/gallium/drivers',
  82. ])
  83. # Posix
  84. if platform in ('posix', 'linux', 'freebsd', 'darwin'):
  85. env.Append(CPPDEFINES = [
  86. '_POSIX_SOURCE',
  87. ('_POSIX_C_SOURCE', '199309L'),
  88. '_SVID_SOURCE',
  89. '_BSD_SOURCE',
  90. '_GNU_SOURCE',
  91. 'PTHREADS',
  92. 'HAVE_POSIX_MEMALIGN',
  93. ])
  94. env.Append(CPPPATH = ['/usr/X11R6/include'])
  95. env.Append(LIBPATH = ['/usr/X11R6/lib'])
  96. env.Append(LIBS = [
  97. 'm',
  98. 'pthread',
  99. 'expat',
  100. 'dl',
  101. ])
  102. # DRI
  103. if dri:
  104. env.ParseConfig('pkg-config --cflags --libs libdrm')
  105. env.Append(CPPDEFINES = [
  106. ('USE_EXTERNAL_DXTN_LIB', '1'),
  107. 'IN_DRI_DRIVER',
  108. 'GLX_DIRECT_RENDERING',
  109. 'GLX_INDIRECT_RENDERING',
  110. ])
  111. # LLVM
  112. if llvm:
  113. # See also http://www.scons.org/wiki/UsingPkgConfig
  114. env.ParseConfig('llvm-config --cflags --ldflags --libs')
  115. env.Append(CPPDEFINES = ['MESA_LLVM'])
  116. # Force C++ linkage
  117. env['LINK'] = env['CXX']
  118. # libGL
  119. if platform in ('linux', 'freebsd', 'darwin'):
  120. env.Append(LIBS = [
  121. 'X11',
  122. 'Xext',
  123. 'Xxf86vm',
  124. 'Xdamage',
  125. 'Xfixes',
  126. ])
  127. # for debugging
  128. #print env.Dump()
  129. Export('env')
  130. #######################################################################
  131. # Invoke SConscripts
  132. # TODO: Build several variants at the same time?
  133. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  134. SConscript(
  135. 'src/SConscript',
  136. build_dir = env['build'],
  137. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  138. )