1 #######################################################################
9 import platform as _platform
11 import SCons.Script.SConscript
14 #######################################################################
17 host_platform = _platform.system().lower()
18 if host_platform.startswith('cygwin'):
19 host_platform = 'cygwin'
21 # Search sys.argv[] for a "platform=foo" argument since we don't have
22 # an 'env' variable at this point.
23 if 'platform' in SCons.Script.ARGUMENTS:
24 target_platform = SCons.Script.ARGUMENTS['platform']
26 target_platform = host_platform
46 # find host_machine value
47 if 'PROCESSOR_ARCHITECTURE' in os.environ:
48 host_machine = os.environ['PROCESSOR_ARCHITECTURE']
50 host_machine = _platform.machine()
51 host_machine = _machine_map.get(host_machine, 'generic')
53 default_machine = host_machine
54 default_toolchain = 'default'
56 if target_platform == 'windows' and host_platform != 'windows':
57 default_machine = 'x86'
58 default_toolchain = 'crossmingw'
61 # find default_llvm value
62 if 'LLVM' in os.environ:
67 if target_platform != 'windows' and \
68 subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
74 #######################################################################
79 from SCons.Variables.BoolVariable import BoolVariable as BoolOption
81 from SCons.Options.BoolOption import BoolOption
83 from SCons.Variables.EnumVariable import EnumVariable as EnumOption
85 from SCons.Options.EnumOption import EnumOption
86 opts.Add(EnumOption('build', 'build type', 'debug',
87 allowed_values=('debug', 'checked', 'profile', 'release')))
88 opts.Add(BoolOption('verbose', 'verbose output', 'no'))
89 opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
90 allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
91 opts.Add(EnumOption('platform', 'target platform', host_platform,
92 allowed_values=('cygwin', 'darwin', 'freebsd', 'haiku', 'linux', 'sunos', 'windows')))
93 opts.Add(BoolOption('embedded', 'embedded build', 'no'))
94 opts.Add('toolchain', 'compiler toolchain', default_toolchain)
95 opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support', 'no'))
96 opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
97 opts.Add(BoolOption('openmp', 'EXPERIMENTAL: compile with openmp (swrast)', 'no'))
98 opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
99 opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))
100 opts.Add(BoolOption('quiet', 'DEPRECATED: profile build', 'yes'))
101 opts.Add(BoolOption('texture_float', 'enable floating-point textures and renderbuffers', 'no'))
102 if host_platform == 'windows':
103 opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))