summaryrefslogtreecommitdiffstats
path: root/lib/libUPnP/Neptune/Build/Boot.scons
blob: 979573b90f59abebcc92b7d47caac8fe302ea39d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import sys
import os
import platform

EnsureSConsVersion(0,98,1)

#######################################################
# reusable functions and data structures
#######################################################

# Platform to Target Map (specifies which default target to build on a platform)
PLATFORM_TO_TARGET_MAP = {
    'linux-i386'  : 'x86-unknown-linux',
    'linux-x86_64': 'x86_64-unknown-linux',
    'linux-arm'   : 'arm-unknown-linux',
    'linux2'      : 'x86-unknown-linux',
    'win32'       : 'x86-microsoft-win32',
    'cygwin'      : 'x86-unknown-cygwin',
    'darwin'      : 'universal-apple-macosx'
}

# list all target dirs
scons_root = Environment().GetBuildPath('#')
targets_dir = scons_root+'/Build/Targets'
targets_dirs = os.listdir(targets_dir)
TARGET_PLATFORMS = [x for x in targets_dirs if os.path.exists(targets_dir +'/'+x+'/Config.scons')]

def DefaultTarget():
    platform_id = sys.platform
    if platform.system() == 'Linux':
        if (platform.machine() == 'i386' or
            platform.machine() == 'i486' or
            platform.machine() == 'i586'or
            platform.machine() == 'i686'):
            platform_id = 'linux-i386'
        if (platform.machine() == 'x86_64'):
            platform_id = 'linux-x86_64'
        if (platform.machine().startswith('arm')):
            platform_id = 'linux-arm'

    if PLATFORM_TO_TARGET_MAP.has_key(platform_id):
        return PLATFORM_TO_TARGET_MAP[platform_id]
    else:
    	return None

#######################################################
# Main Build
#######################################################
options = Variables()
options.AddVariables(
    EnumVariable('target', 'Build Target', DefaultTarget(), allowed_values=TARGET_PLATFORMS),
    BoolVariable('stop_on_warning', 'Stop the build on warnings', False),
    BoolVariable('shared', 'Build a shared library', False),
    ListVariable('build_config', 'build configurations', 'Debug', names=['Debug', 'Release'])
)

env = Environment(variables=options)
Help(options.GenerateHelpText(env))

### call the actual build script for each build config
base_env = env
for build_config in env['build_config']:
    env = base_env.Clone()
    env['build_config'] = build_config
    print '********** Configuring Build Target =', env['target'], '/', build_config, '********'
    SConscript('Build.scons', variant_dir='Targets/'+env['target']+'/'+build_config, exports='env', duplicate=0)