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.

common.py 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #######################################################################
  2. # Common SCons code
  3. import os
  4. import os.path
  5. import sys
  6. import platform as _platform
  7. #######################################################################
  8. # Defaults
  9. _platform_map = {
  10. 'linux2': 'linux',
  11. 'win32': 'winddk',
  12. }
  13. default_platform = sys.platform
  14. default_platform = _platform_map.get(default_platform, default_platform)
  15. _machine_map = {
  16. 'x86': 'x86',
  17. 'i386': 'x86',
  18. 'i486': 'x86',
  19. 'i586': 'x86',
  20. 'i686': 'x86',
  21. 'x86_64': 'x86_64',
  22. }
  23. if 'PROCESSOR_ARCHITECTURE' in os.environ:
  24. default_machine = os.environ['PROCESSOR_ARCHITECTURE']
  25. else:
  26. default_machine = _platform.machine()
  27. default_machine = _machine_map.get(default_machine, 'generic')
  28. if default_platform in ('linux', 'freebsd', 'darwin'):
  29. default_dri = 'yes'
  30. elif default_platform in ('winddk', 'windows', 'wince'):
  31. default_dri = 'no'
  32. else:
  33. default_dri = 'no'
  34. #######################################################################
  35. # Common options
  36. def AddOptions(opts):
  37. try:
  38. from SCons.Options.BoolOption import BoolOption
  39. except ImportError:
  40. from SCons.Variables.BoolVariable import BoolVariable as BoolOption
  41. try:
  42. from SCons.Options.EnumOption import EnumOption
  43. except ImportError:
  44. from SCons.Variables.EnumVariable import EnumVariable as EnumOption
  45. opts.Add(BoolOption('debug', 'debug build', 'no'))
  46. opts.Add(BoolOption('profile', 'profile build', 'no'))
  47. #opts.Add(BoolOption('quiet', 'quiet command lines', 'no'))
  48. opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
  49. allowed_values=('generic', 'x86', 'x86_64')))
  50. opts.Add(EnumOption('platform', 'target platform', default_platform,
  51. allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince')))
  52. opts.Add(EnumOption('toolchain', 'compiler toolchain', 'default',
  53. allowed_values=('default', 'crossmingw', 'winddk')))
  54. opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
  55. opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))