1 #######################################################################
9 import platform as _platform
11 import SCons.Script.SConscript
14 #######################################################################
22 host_platform = sys.platform
23 host_platform = _platform_map.get(host_platform, host_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 target_platform = SCons.Script.ARGUMENTS['platform']
30 target_platform = host_platform
32 cross_compiling = target_platform != host_platform
45 # find host_machine value
46 if 'PROCESSOR_ARCHITECTURE' in os.environ:
47 host_machine = os.environ['PROCESSOR_ARCHITECTURE']
49 host_machine = _platform.machine()
50 host_machine = _machine_map.get(host_machine, 'generic')
52 default_machine = host_machine
53 default_toolchain = 'default'
55 if target_platform == 'windows' and cross_compiling:
56 default_machine = 'x86'
57 default_toolchain = 'crossmingw'
60 # find default_llvm value
61 if 'LLVM' in os.environ:
66 if target_platform != 'windows' and \
67 subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
73 #######################################################################
78 from SCons.Variables.BoolVariable import BoolVariable as BoolOption
80 from SCons.Options.BoolOption import BoolOption
82 from SCons.Variables.EnumVariable import EnumVariable as EnumOption
84 from SCons.Options.EnumOption import EnumOption
85 opts.Add(EnumOption('build', 'build type', 'debug',
86 allowed_values=('debug', 'checked', 'profile', 'release')))
87 opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
88 opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
89 allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
90 opts.Add(EnumOption('platform', 'target platform', host_platform,
91 allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos5', 'freebsd8')))
92 opts.Add('toolchain', 'compiler toolchain', default_toolchain)
93 opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
94 opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
95 opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
96 opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))