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

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