Boost logo

Boost-Build :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2008-04-26 13:02:07


I refined my proposal.

Following Volodyas comment I changed the meaning of
the version subfeature to always mean the real version
of the compiler, i.e. the result of -dumpversion.

I mapped the value that is passed into toolset.using
to a subfeature called "identity". Given that there
currently is no condition present in boost tree that
has <toolset-gcc:version> this should be rather safe.

With my proposed changes the following will be possible:

In user-config.jam one could setup various compilers as
usual:

using gcc
    ;

using gcc
    : ppc
    :
/opt/crosstool/gcc-4.1.0-glibc-2.3.6/powerpc-750-linux-gnu/bin/powerpc-750-linux-gnu-g++
    ;

>From the commandline these variants can be invoked as usual:

bjam gcc
will use the default compiler, and
bjam gcc-ppc
will use the cross compiler.

It is also possible to invoke by
bjam toolset-gcc:version=4.1.0 toolset-gcc:flavor=powerpc_750_linux_gnu

But e.g. specifying a non existent version
bjam toolset-gcc:version=4.1.1 toolset-gcc:flavor=powerpc_750_linux_gnu
will result in error:
error: "4.1.1" is not a known subfeature value of <toolset>gcc

The more interesting part however is that now one can condition on
flavor:

exe hello
    : hello.cpp
    : <threading>multi
      <variant>release
      <toolset-gcc:flavor>powerpc_750_linux_gnu:<define>BIGENDIAN
    ;

where flavor now only depends on the compiler executable and not on
user settings. (If the user has not overridden flavor)

I tried also to go some steps towards having the compiler selected
by feature values:

If we put into user-config.jam

toolset.add-requirements

<architecture>x86,<target-os>linux,<instruction-set>i486:<toolset-gcc:identity>autoconfig

<architecture>power,<target-os>linux,<instruction-set>750:<toolset-gcc:identity>ppc
    ;

it is possible to request the compiler by

bjam target-os=linux architecture=power instruction-set=750

However this has a shortcoming:

When specifying

bjam architecture=power

the default compiler compiler will be invoked, (with wrong arch)
which is not what the user will expect.

Also I think it is an interesting question if it would be possible
to find an automatic mapping from -dumpmachine to the triplet
architecture,host-os,instruction-set and set it in the init rule.

I attach my diff to gcc.jam to this mail.

In the hope my proposal is not too confusing I remain for opinions
on the matter.

-- 
_________________________________________
  _  _  | Roland Schwarz
 |_)(_  | aka. speedsnail
 | \__) | mailto:roland.schwarz_at_[hidden]
________| http://www.blackspace.at



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