Clone of mesa.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

common.py 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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': 'windows',
  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. 'ppc' : 'ppc',
  22. 'x86_64': 'x86_64',
  23. }
  24. if 'PROCESSOR_ARCHITECTURE' in os.environ:
  25. default_machine = os.environ['PROCESSOR_ARCHITECTURE']
  26. else:
  27. default_machine = _platform.machine()
  28. default_machine = _machine_map.get(default_machine, 'generic')
  29. if default_platform in ('linux', 'freebsd'):
  30. default_dri = 'yes'
  31. elif default_platform in ('winddk', 'windows', 'wince', 'darwin'):
  32. default_dri = 'no'
  33. else:
  34. default_dri = 'no'
  35. #######################################################################
  36. # Common options
  37. def AddOptions(opts):
  38. try:
  39. from SCons.Variables.BoolVariable import BoolVariable as BoolOption
  40. except ImportError:
  41. from SCons.Options.BoolOption import BoolOption
  42. try:
  43. from SCons.Variables.EnumVariable import EnumVariable as EnumOption
  44. except ImportError:
  45. from SCons.Options.EnumOption import EnumOption
  46. opts.Add(BoolOption('debug', 'debug build', 'no'))
  47. opts.Add(BoolOption('profile', 'profile build', 'no'))
  48. opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
  49. opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
  50. allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
  51. opts.Add(EnumOption('platform', 'target platform', default_platform,
  52. allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded')))
  53. opts.Add('toolchain', 'compiler toolchain', 'default')
  54. opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
  55. opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))