summaryrefslogtreecommitdiff
path: root/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'common.py')
-rw-r--r--common.py40
1 files changed, 19 insertions, 21 deletions
diff --git a/common.py b/common.py
index 13e8dc83e9..b7749c925d 100644
--- a/common.py
+++ b/common.py
@@ -8,6 +8,8 @@ import subprocess
import sys
import platform as _platform
+import SCons.Script.SConscript
+
#######################################################################
# Defaults
@@ -20,6 +22,15 @@ _platform_map = {
default_platform = sys.platform
default_platform = _platform_map.get(default_platform, default_platform)
+# Search sys.argv[] for a "platform=foo" argument since we don't have
+# an 'env' variable at this point.
+if 'platform' in SCons.Script.ARGUMENTS:
+ selected_platform = SCons.Script.ARGUMENTS['platform']
+else:
+ selected_platform = default_platform
+
+cross_compiling = selected_platform != default_platform
+
_machine_map = {
'x86': 'x86',
'i386': 'x86',
@@ -37,38 +48,26 @@ if 'PROCESSOR_ARCHITECTURE' in os.environ:
else:
default_machine = _platform.machine()
default_machine = _machine_map.get(default_machine, 'generic')
+default_toolchain = 'default'
+
+if selected_platform == 'windows' and cross_compiling:
+ default_machine = 'x86'
+ default_toolchain = 'crossmingw'
# find default_llvm value
if 'LLVM' in os.environ:
default_llvm = 'yes'
else:
- # Search sys.argv[] for a "platform=foo" argument since we don't have
- # an 'env' variable at this point.
- platform = default_platform
- pattern = re.compile("(platform=)(.*)")
- for arg in sys.argv:
- m = pattern.match(arg)
- if m:
- platform = m.group(2)
-
default_llvm = 'no'
try:
- if platform != 'windows' and subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
+ if selected_platform != 'windows' and \
+ subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
default_llvm = 'yes'
except:
pass
-# find default_dri value
-if default_platform in ('linux', 'freebsd'):
- default_dri = 'yes'
-elif default_platform in ('winddk', 'windows', 'wince', 'darwin'):
- default_dri = 'no'
-else:
- default_dri = 'no'
-
-
#######################################################################
# Common options
@@ -88,8 +87,7 @@ def AddOptions(opts):
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
opts.Add(EnumOption('platform', 'target platform', default_platform,
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded', 'cygwin', 'sunos5', 'freebsd8')))
- opts.Add('toolchain', 'compiler toolchain', 'default')
+ opts.Add('toolchain', 'compiler toolchain', default_toolchain)
opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
- opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
opts.Add(BoolOption('debug', 'DEPRECATED: debug build', 'yes'))
opts.Add(BoolOption('profile', 'DEPRECATED: profile build', 'no'))