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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #######################################################################
  2. # Top-level SConstruct
  3. #
  4. # For example, invoke scons as
  5. #
  6. # scons build=debug llvm=yes 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. # build='debug'
  13. # llvm=True
  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. opts = Variables('config.py')
  30. common.AddOptions(opts)
  31. env = Environment(
  32. options = opts,
  33. tools = ['gallium'],
  34. toolpath = ['#scons'],
  35. ENV = os.environ,
  36. )
  37. # Backwards compatability with old target configuration variable
  38. try:
  39. targets = ARGUMENTS['targets']
  40. except KeyError:
  41. pass
  42. else:
  43. targets = targets.split(',')
  44. print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
  45. print
  46. print ' scons %s' % ' '.join(targets)
  47. print
  48. COMMAND_LINE_TARGETS.append(targets)
  49. Help(opts.GenerateHelpText(env))
  50. #######################################################################
  51. # Environment setup
  52. # Includes
  53. env.Prepend(CPPPATH = [
  54. '#/include',
  55. ])
  56. env.Append(CPPPATH = [
  57. '#/src/gallium/include',
  58. '#/src/gallium/auxiliary',
  59. '#/src/gallium/drivers',
  60. '#/src/gallium/winsys',
  61. ])
  62. if env['msvc']:
  63. env.Append(CPPPATH = ['#include/c99'])
  64. # Embedded
  65. if env['platform'] == 'embedded':
  66. env.Append(CPPDEFINES = [
  67. '_POSIX_SOURCE',
  68. ('_POSIX_C_SOURCE', '199309L'),
  69. '_SVID_SOURCE',
  70. '_BSD_SOURCE',
  71. '_GNU_SOURCE',
  72. 'PTHREADS',
  73. ])
  74. env.Append(LIBS = [
  75. 'm',
  76. 'pthread',
  77. 'dl',
  78. ])
  79. # Posix
  80. if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
  81. env.Append(CPPDEFINES = [
  82. '_POSIX_SOURCE',
  83. ('_POSIX_C_SOURCE', '199309L'),
  84. '_SVID_SOURCE',
  85. '_BSD_SOURCE',
  86. '_GNU_SOURCE',
  87. 'PTHREADS',
  88. 'HAVE_POSIX_MEMALIGN',
  89. ])
  90. if env['gcc']:
  91. env.Append(CFLAGS = ['-fvisibility=hidden'])
  92. if env['platform'] == 'darwin':
  93. env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
  94. env.Append(LIBS = [
  95. 'm',
  96. 'pthread',
  97. 'dl',
  98. ])
  99. # for debugging
  100. #print env.Dump()
  101. Export('env')
  102. #######################################################################
  103. # Invoke SConscripts
  104. # TODO: Build several variants at the same time?
  105. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  106. SConscript(
  107. 'src/SConscript',
  108. variant_dir = env['build_dir'],
  109. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  110. )