diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-11-01 13:30:22 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-11-01 13:30:22 +0000 |
commit | 601498ae73e654c2de997ea75075613a694d604d (patch) | |
tree | fb1eb85143f5222b3c4b4d059276095e658506f5 /common.py | |
parent | a84bd587c68a48c675aae538934a0de48421ff08 (diff) |
scons: Revamp how to specify targets to build.
Use scons target and dependency system instead of ad-hoc options.
Now is simply a matter of naming what to build. For example:
scons libgl-xlib
scons libgl-gdi
scons graw-progs
scons llvmpipe
and so on. And there is also the possibility of scepcified subdirs, e.g.
scons src/gallium/drivers
If nothing is specified then everything will be build.
There might be some rough corners over the next days. Please bare with me.
Diffstat (limited to 'common.py')
-rw-r--r-- | common.py | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/common.py b/common.py index 13e8dc83e978..b7749c925dfc 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')) |