1 #######################################################################
9 import platform as _platform
11 import SCons.Script.SConscript
14 #######################################################################
22 default_platform = sys.platform
23 default_platform = _platform_map.get(default_platform, default_platform)
25 # Search sys.argv[] for a "platform=foo" argument since we don't have
26 # an 'env' variable at this point.
27 if 'platform' in SCons.Script.ARGUMENTS:
28 selected_platform = SCons.Script.ARGUMENTS['platform']
30 selected_platform = default_platform
32 cross_compiling = selected_platform != default_platform
45 # find default_machine value
46 if 'PROCESSOR_ARCHITECTURE' in os.environ:
47 default_machine = os.environ['PROCESSOR_ARCHITECTURE']
49 default_machine = _platform.machine()
50 default_machine = _machine_map.get(default_machine, 'generic')
51 default_toolchain = 'default'
53 if selected_platform == 'windows' and cross_compiling:
54 default_machine = 'x86'
55 default_toolchain = 'crossmingw'
58 # find default_llvm value
59 if 'LLVM' in os.environ:
64 if selected_platform != 'windows' and \
65 subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
71 #######################################################################
76 from SCons.Variables.BoolVariable import BoolVariable as BoolOption
78 from SCons.Options.BoolOption import BoolOption
80 from SCons.Variables.EnumVariable import EnumVariable as EnumOption
82 from SCons.Options.EnumOption import EnumOption
83 opts.Add(EnumOption('build', 'build type', 'debug',
84 allowed_values=('debug', 'checked', 'profile', 'release')))
85 opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
86 opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
87 allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
88 opts.Add(EnumOption('platform', 'target platform', default_platform,
89 allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos5', 'freebsd8')))
90 opts.Add('toolchain', 'compiler toolchain', default_toolchain)
91 opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
92 opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
93 opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))