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.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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,trace'
  31. default_winsys = 'xlib'
  32. elif common.default_platform in ('winddk',):
  33. default_drivers = 'softpipe,i915simple,trace'
  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. opts.Add(EnumOption('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. gcc = platform in ('linux', 'freebsd', 'darwin')
  63. msvc = platform in ('windows', 'winddk')
  64. Export([
  65. 'debug',
  66. 'x86',
  67. 'dri',
  68. 'llvm',
  69. 'platform',
  70. 'gcc',
  71. 'msvc',
  72. ])
  73. #######################################################################
  74. # Environment setup
  75. # Includes
  76. env.Append(CPPPATH = [
  77. '#/include',
  78. '#/src/gallium/include',
  79. '#/src/gallium/auxiliary',
  80. '#/src/gallium/drivers',
  81. ])
  82. # Posix
  83. if platform in ('posix', 'linux', 'freebsd', 'darwin'):
  84. env.Append(CPPDEFINES = [
  85. '_POSIX_SOURCE',
  86. ('_POSIX_C_SOURCE', '199309L'),
  87. '_SVID_SOURCE',
  88. '_BSD_SOURCE',
  89. '_GNU_SOURCE',
  90. 'PTHREADS',
  91. 'HAVE_POSIX_MEMALIGN',
  92. ])
  93. env.Append(CPPPATH = ['/usr/X11R6/include'])
  94. env.Append(LIBPATH = ['/usr/X11R6/lib'])
  95. env.Append(LIBS = [
  96. 'm',
  97. 'pthread',
  98. 'expat',
  99. 'dl',
  100. ])
  101. # DRI
  102. if dri:
  103. env.ParseConfig('pkg-config --cflags --libs libdrm')
  104. env.Append(CPPDEFINES = [
  105. ('USE_EXTERNAL_DXTN_LIB', '1'),
  106. 'IN_DRI_DRIVER',
  107. 'GLX_DIRECT_RENDERING',
  108. 'GLX_INDIRECT_RENDERING',
  109. ])
  110. # LLVM
  111. if llvm:
  112. # See also http://www.scons.org/wiki/UsingPkgConfig
  113. env.ParseConfig('llvm-config --cflags --ldflags --libs')
  114. env.Append(CPPDEFINES = ['MESA_LLVM'])
  115. # Force C++ linkage
  116. env['LINK'] = env['CXX']
  117. # libGL
  118. if platform in ('linux', 'freebsd', 'darwin'):
  119. env.Append(LIBS = [
  120. 'X11',
  121. 'Xext',
  122. 'Xxf86vm',
  123. 'Xdamage',
  124. 'Xfixes',
  125. ])
  126. # for debugging
  127. #print env.Dump()
  128. Export('env')
  129. #######################################################################
  130. # Invoke SConscripts
  131. # TODO: Build several variants at the same time?
  132. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  133. SConscript(
  134. 'src/SConscript',
  135. build_dir = env['build'],
  136. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  137. )