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.

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