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 3.4KB

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