From 3badbb06227a0f42bb2b23b2f287bd8d403ad2d7 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Sun, 18 Jan 2015 18:12:18 +1100 Subject: Add support to cross-compile. Use --hosti=. On FreeBSD use --host=mingw32 for Windows. If you use another OS you might need to add the specific windows host to the top level wscript file. --- wscript | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'wscript') diff --git a/wscript b/wscript index edfa91f..e289858 100644 --- a/wscript +++ b/wscript @@ -46,8 +46,24 @@ def options(ctx): default = '-O2', dest='c_opts', help = 'Set build options, default: -O2.') + ctx.add_option('--host', + default = 'native', + dest='host', + help = 'Set host to build for, default: none.') recurse(ctx) +def init(ctx): + try: + import waflib.Options + import waflib.ConfigSet + env = waflib.ConfigSet.ConfigSet() + env.load(waflib.Options.lockfile) + check_options(ctx, env.options['host']) + for sd in subdirs: + ctx.recurse(sd) + except: + pass + def configure(ctx): try: ctx.load("doxygen", tooldir = 'waf-tools') @@ -55,6 +71,7 @@ def configure(ctx): pass ctx.env.C_OPTS = ctx.options.c_opts.split(',') ctx.env.RTEMS_VERSION = ctx.options.rtems_version + check_options(ctx, ctx.options.host) recurse(ctx) def build(ctx): @@ -70,6 +87,16 @@ def rebuild(ctx): import waflib.Options waflib.Options.commands.extend(['clean', 'build']) +def check_options(ctx, host): + if host in ['mingw32']: + ctx.env.HOST = host + ctx.env.CC = '%s-gcc' % (host) + ctx.env.CXX = '%s-g++' % (host) + ctx.env.AR = '%s-ar' % (host) + ctx.env.PYTHON = 'python' + elif host is not 'native': + ctx.fatal('unknown host: %s' % (host)); + # # The doxy command. # -- cgit v1.2.3