diff options
Diffstat (limited to 'lib/libUPnP/Neptune/Build/Boot.scons')
-rw-r--r-- | lib/libUPnP/Neptune/Build/Boot.scons | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/lib/libUPnP/Neptune/Build/Boot.scons b/lib/libUPnP/Neptune/Build/Boot.scons new file mode 100644 index 0000000..979573b --- /dev/null +++ b/lib/libUPnP/Neptune/Build/Boot.scons @@ -0,0 +1,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) |