Boost logo

Boost-Build :

Subject: Re: [Boost-build] Native-built tools in a cross-compile environment
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-10-19 10:34:35


AMDG

On 10/15/2012 05:53 PM, Kylo Ginsberg wrote:
> I have ported a project using boost-build from Windows (using msvc) to
> Linux (using gcc), and am now porting it further to a cross-compiled
> Linux (also using gcc). I want to support all 3 platforms long-term
> (Windows, native Linux, cross-compiled Linux).
>
> I've put in the basic support for cross-compilation, simply by adding
> a new "using gcc ..." line. However, this project uses some
> code-generating build tools which are built afresh with every build --
> with my current basic support for cross-compilation, these build tools
> are cross-built and thus don't run on the build machine. In short,
> these need to be native built at all times and I'm not sure how best
> to specify this. Is there a best practice for this scenario?
>
> I can certainly provide more detail on the organization of the
> Jamfiles, etc, but figured I'd start with a short-ish note ;>
>

# user-config.jam
using msvc ;
using gcc ;
import toolset ;
# globally force the toolset to msvc when building
# for windows
toolset.add-requirements <target-os>windows:<toolset>msvc ;

# Jamfile

# force target-os to be the same as host-os
rule native-tool ( properties * )
{
    local host = [ property.select <host-os> : $(properties) ] ;
    return <target-os>$(host:G=) ;
}

exe tool : tool.cpp : <conditional>@native-tool ;

If <target-os> isn't sufficient to distinguish
the host from the target, you can define a new
feature:

import feature ;
import toolset ;
feature.feature native-build : on : optional propagated ;
toolset.add-requirements <native-build>on:<toolset>gcc-4.7.2 ;

...

exe tool : tool.cpp : <native-build>on ;

In Christ,
Steven Watanabe


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk