|
Boost-Build : |
Subject: Re: [Boost-build] Target alternatives and multiple compilers - again
From: Jürgen Hunold (juergen.hunold_at_[hidden])
Date: 2011-07-12 14:05:23
Hi Edward,
On Tuesday, 12. July 2011 17:54:58 Edward Diener wrote:
> That does not work either. If I change the above to:
>
> test-suite somelib
>
> [ compile some_source.cpp ]
> ;
>
> test-suite somelib_gcc
>
> [ compile some_source.cpp
>
> : <cxxflags>-std=c++0x
> : some_source_gcc
>
> ]
>
> <toolset-gcc:version>4.3.0
> <toolset-gcc:version>4.4.0
> <toolset-gcc:version>4.5.0
> <toolset-gcc:version>4.5.2
> <toolset-gcc:version>4.6.0
> ;
>
> test-suite somelib_gcc ;
>
> change some_source.cpp, and execute the jamfile for gcc-4.6.0,
> some_source_gcc never gets created even though some_source does.
My fault. The requirement list above means that _all_ requirements must be
met. The requirements are implicit "and" composited. And as far as I know,
there is no "or"-able syntax.
> > A more stable solution would be to query the compile in a conditional
> > rule.
>
> I simply want to have a target alternative for multiple compilers.
It is not easy. You could try:
<toolset-gcc:version>4.3.0:<cxxflags>-std=c++0x
but I doubt you will get far.
> Surely this can not need some rule-based programming.
Yes, especially because the toolset version can be arbitrary complex.
I have "gcc-4.2~arm" for cross-platform arm, maybe gcc-4.6~arm next month.
And I usually shorten compiler version to "4.5." instead of 4.5.2. So it gets
complicated quite fast:
Working example:
import testing ;
test-suite somelib
:
[ compile some_source.cpp ]
;
test-suite somelib_gcc
:
[ compile some_source.cpp
: <cxxflags>-std=c++0x
: some_source_gcc
]
:
<conditional>@gcc-conditional
;
rule gcc-conditional ( properties * )
{
# Extract version number from toolset
local version = [ MATCH "<toolset.*version>([0-9.]+).*"
: $(properties) ] ;
if $(version) < "4.3.0"
{
result += <build>no ;
}
}
This really gets useful if you have version dependent flags which you want to
control.
Off to vacation,
Yours,
Jürgen
-- * Dipl.-Math. Jürgen Hunold ! Ingenieurgesellschaft für * voice: ++49 511 262926 57 ! Verkehrs- und Eisenbahnwesen mbH * fax : ++49 511 262926 99 ! Lister Straße 15 * juergen.hunold_at_[hidden] ! www.ivembh.de * * Geschäftsführer: ! Sitz des Unternehmens: Hannover * Prof. Dr.-Ing. Thomas Siefer ! Amtsgericht Hannover, HRB 56965 * PD Dr.-Ing. Alfons Radtke !
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