5 EnsureSConsVersion(0,98,1)
7 #######################################################
8 # reusable functions and data structures
9 #######################################################
11 # Platform to Target Map (specifies which default target to build on a platform)
12 PLATFORM_TO_TARGET_MAP = {
13 'linux-i386' : 'x86-unknown-linux',
14 'linux-x86_64': 'x86_64-unknown-linux',
15 'linux-arm' : 'arm-unknown-linux',
16 'linux2' : 'x86-unknown-linux',
17 'win32' : 'x86-microsoft-win32',
18 'cygwin' : 'x86-unknown-cygwin',
19 'darwin' : 'universal-apple-macosx'
22 # list all target dirs
23 scons_root = Environment().GetBuildPath('#')
24 targets_dir = scons_root+'/Build/Targets'
25 targets_dirs = os.listdir(targets_dir)
26 TARGET_PLATFORMS = [x for x in targets_dirs if os.path.exists(targets_dir +'/'+x+'/Config.scons')]
29 platform_id = sys.platform
30 if platform.system() == 'Linux':
31 if (platform.machine() == 'i386' or
32 platform.machine() == 'i486' or
33 platform.machine() == 'i586'or
34 platform.machine() == 'i686'):
35 platform_id = 'linux-i386'
36 if (platform.machine() == 'x86_64'):
37 platform_id = 'linux-x86_64'
38 if (platform.machine().startswith('arm')):
39 platform_id = 'linux-arm'
41 if PLATFORM_TO_TARGET_MAP.has_key(platform_id):
42 return PLATFORM_TO_TARGET_MAP[platform_id]
46 #######################################################
48 #######################################################
51 EnumVariable('target', 'Build Target', DefaultTarget(), allowed_values=TARGET_PLATFORMS),
52 BoolVariable('stop_on_warning', 'Stop the build on warnings', False),
53 ListVariable('build_config', 'build configurations', 'Debug', names=['Debug', 'Release'])
56 env = Environment(variables=options)
57 Help(options.GenerateHelpText(env))
59 if 'NPT_CONFIG_NO_SSL' in os.environ:
60 env['NPT_CONFIG_NO_SSL'] = os.environ['NPT_CONFIG_NO_SSL']
61 if 'NPT_CONFIG_NO_ZIP' in os.environ:
62 env['NPT_CONFIG_NO_ZIP'] = os.environ['NPT_CONFIG_NO_ZIP']
63 if 'NPT_CONFIG_NO_CRYPTO' in os.environ:
64 env['NPT_CONFIG_NO_CRYPTO'] = os.environ['NPT_CONFIG_NO_CRYPTO']
67 for build_config in env['build_config']:
68 env = base_env.Clone()
69 env['build_config'] = build_config
70 print '********** Configuring Build Target =', env['target'], '/', build_config, '********'
71 SConscript('Build.scons', variant_dir='Targets/'+env['target']+'/'+build_config, exports='env', duplicate=0)