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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. # XXX: This creates a many problems as it saves...
  38. #opts.Save('config.py', env)
  39. # Backwards compatability with old target configuration variable
  40. try:
  41. targets = ARGUMENTS['targets']
  42. except KeyError:
  43. pass
  44. else:
  45. targets = targets.split(',')
  46. print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
  47. print
  48. print ' scons %s' % ' '.join(targets)
  49. print
  50. COMMAND_LINE_TARGETS.append(targets)
  51. Help(opts.GenerateHelpText(env))
  52. # fail early for a common error on windows
  53. if env['gles']:
  54. try:
  55. import libxml2
  56. except ImportError:
  57. raise SCons.Errors.UserError, "GLES requires libxml2-python to build"
  58. #######################################################################
  59. # Environment setup
  60. with open("VERSION") as f:
  61. mesa_version = f.read().strip()
  62. env.Append(CPPDEFINES = [
  63. ('PACKAGE_VERSION', '\\"%s\\"' % mesa_version),
  64. ('PACKAGE_BUGREPORT', '\\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\\"'),
  65. ])
  66. # Includes
  67. env.Prepend(CPPPATH = [
  68. '#/include',
  69. ])
  70. env.Append(CPPPATH = [
  71. '#/src/gallium/include',
  72. '#/src/gallium/auxiliary',
  73. '#/src/gallium/drivers',
  74. '#/src/gallium/winsys',
  75. ])
  76. if env['msvc']:
  77. env.Append(CPPPATH = ['#include/c99'])
  78. # for debugging
  79. #print env.Dump()
  80. #######################################################################
  81. # Invoke host SConscripts
  82. #
  83. # For things that are meant to be run on the native host build machine, instead
  84. # of the target machine.
  85. #
  86. # Create host environent
  87. if env['crosscompile'] and not env['embedded']:
  88. host_env = Environment(
  89. options = opts,
  90. # no tool used
  91. tools = [],
  92. toolpath = ['#scons'],
  93. ENV = os.environ,
  94. )
  95. # Override options
  96. host_env['platform'] = common.host_platform
  97. host_env['machine'] = common.host_machine
  98. host_env['toolchain'] = 'default'
  99. host_env['llvm'] = False
  100. host_env.Tool('gallium')
  101. host_env['hostonly'] = True
  102. assert host_env['crosscompile'] == False
  103. if host_env['msvc']:
  104. host_env.Append(CPPPATH = ['#include/c99'])
  105. target_env = env
  106. env = host_env
  107. Export('env')
  108. SConscript(
  109. 'src/SConscript',
  110. variant_dir = host_env['build_dir'],
  111. duplicate = 0, # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  112. )
  113. env = target_env
  114. Export('env')
  115. #######################################################################
  116. # Invoke SConscripts
  117. # TODO: Build several variants at the same time?
  118. # http://www.scons.org/wiki/SimultaneousVariantBuilds
  119. SConscript(
  120. 'src/SConscript',
  121. variant_dir = env['build_dir'],
  122. duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
  123. )
  124. ########################################################################
  125. # List all aliases
  126. try:
  127. from SCons.Node.Alias import default_ans
  128. except ImportError:
  129. pass
  130. else:
  131. aliases = default_ans.keys()
  132. aliases.sort()
  133. env.Help('\n')
  134. env.Help('Recognized targets:\n')
  135. for alias in aliases:
  136. env.Help(' %s\n' % alias)