| 1 |
####################################################################### |
| 2 |
# Common SCons code |
| 3 |
|
| 4 |
import os |
| 5 |
import os.path |
| 6 |
import sys |
| 7 |
import platform as _platform |
| 8 |
|
| 9 |
|
| 10 |
####################################################################### |
| 11 |
# Defaults |
| 12 |
|
| 13 |
_platform_map = { |
| 14 |
'linux2': 'linux', |
| 15 |
'win32': 'winddk', |
| 16 |
} |
| 17 |
|
| 18 |
default_platform = sys.platform |
| 19 |
default_platform = _platform_map.get(default_platform, default_platform) |
| 20 |
|
| 21 |
_machine_map = { |
| 22 |
'x86': 'x86', |
| 23 |
'i386': 'x86', |
| 24 |
'i486': 'x86', |
| 25 |
'i586': 'x86', |
| 26 |
'i686': 'x86', |
| 27 |
'ppc' : 'ppc', |
| 28 |
'x86_64': 'x86_64', |
| 29 |
} |
| 30 |
if 'PROCESSOR_ARCHITECTURE' in os.environ: |
| 31 |
default_machine = os.environ['PROCESSOR_ARCHITECTURE'] |
| 32 |
else: |
| 33 |
default_machine = _platform.machine() |
| 34 |
default_machine = _machine_map.get(default_machine, 'generic') |
| 35 |
|
| 36 |
if default_platform in ('linux', 'freebsd'): |
| 37 |
default_dri = 'yes' |
| 38 |
elif default_platform in ('winddk', 'windows', 'wince', 'darwin'): |
| 39 |
default_dri = 'no' |
| 40 |
else: |
| 41 |
default_dri = 'no' |
| 42 |
|
| 43 |
|
| 44 |
####################################################################### |
| 45 |
# Common options |
| 46 |
|
| 47 |
def AddOptions(opts): |
| 48 |
try: |
| 49 |
from SCons.Variables.BoolVariable import BoolVariable as BoolOption |
| 50 |
except ImportError: |
| 51 |
from SCons.Options.BoolOption import BoolOption |
| 52 |
try: |
| 53 |
from SCons.Variables.EnumVariable import EnumVariable as EnumOption |
| 54 |
except ImportError: |
| 55 |
from SCons.Options.EnumOption import EnumOption |
| 56 |
opts.Add(BoolOption('debug', 'debug build', 'no')) |
| 57 |
opts.Add(BoolOption('profile', 'profile build', 'no')) |
| 58 |
opts.Add(BoolOption('quiet', 'quiet command lines', 'yes')) |
| 59 |
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine, |
| 60 |
allowed_values=('generic', 'ppc', 'x86', 'x86_64'))) |
| 61 |
opts.Add(EnumOption('platform', 'target platform', default_platform, |
| 62 |
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin'))) |
| 63 |
opts.Add(EnumOption('toolchain', 'compiler toolchain', 'default', |
| 64 |
allowed_values=('default', 'crossmingw', 'winsdk', 'winddk'))) |
| 65 |
opts.Add(BoolOption('llvm', 'use LLVM', 'no')) |
| 66 |
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri)) |