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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. opts.Save('config.py', env)
  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. # fail early for a common error on windows
  52. if env['gles']:
  53. try:
  54. import libxml2
  55. except ImportError:
  56. raise SCons.Errors.UserError, "GLES requires libxml2-python to build"
  57. #######################################################################
  58. # Environment setup
  59. # Includes
  60. env.Prepend(CPPPATH = [
  61. '#/include',
  62. ])
  63. env.Append(CPPPATH = [
  64. '#/src/gallium/include',
  65. '#/src/gallium/auxiliary',
  66. '#/src/gallium/drivers',
  67. '#/src/gallium/winsys',
  68. ])
  69. if env['msvc']:
  70. env.Append(CPPPATH = ['#include/c99'])
  71. # for debugging
  72. #print env.Dump()
  73. #######################################################################
  74. # Invoke host SConscripts
  75. #
  76. # For things that are meant to be run on the native host build machine, instead
  77. # of the target machine.
  78. #
  79. # Create host environent
  80. if env['crosscompile'] and not env['embedded']:
  81. host_env = Environment(
  82. options = opts,
  83. # no tool used
  84. tools = [],
  85. toolpath = ['#scons'],
  86. ENV = os.environ,
  87. )
  88. # Override options
  89. host_env['platform'] = common.host_platform
  90. host_env['machine'] = common.host_machine
  91. host_env['toolchain'] = 'default'
  92. host_env['llvm'] = False
  93. host_env.Tool('gallium')
  94. host_env['hostonly'] = True
  95. assert host_env['crosscompile'] == False
  96. if host_env['msvc']:
  97. host_env.Append(CPPPATH = ['#include/c99'])
  98. target_env = env
  99. env = host_env
  100. Export('env')
  101. SConscript(
  102. 'src/SConscript',
  103. variant_dir = host_env['build_dir'],
  104. duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  105. )
  106. env = target_env
  107. Export('env')
  108. #######################################################################
  109. # Invoke SConscripts
  110. # TODO: Build several variants at the same time?
  111. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  112. SConscript(
  113. 'src/SConscript',
  114. variant_dir = env['build_dir'],
  115. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  116. )
  117. ########################################################################
  118. # List all aliases
  119. try:
  120. from SCons.Node.Alias import default_ans
  121. except ImportError:
  122. pass
  123. else:
  124. aliases = default_ans.keys()
  125. aliases.sort()
  126. env.Help('\n')
  127. env.Help('Recognized targets:\n')
  128. for alias in aliases:
  129. env.Help(' %s\n' % alias)