|
Boost : |
Subject: Re: [boost] [build] Conditional sources and compiler options
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-05-04 05:21:50
Le 04/05/13 10:39, Andrey Semashev a écrit :
> Hi,
>
> I'm trying to add some SIMD support to my library and I'm having problems with
> setting up my Jamfile properly.
>
> Basically, I have a number of source files that only need to be compiled when
> the compiler is of a specific version or later (say, gcc >= 4.7 or msvc >= 12
> or intel >= X.Y on x86 but not for other compilers/architectures and not for
> older versions of the mentioned compilers). Next, I need to add special
> compiler options (specific for each compiler) just for these files. Natuarlly,
> I also have other source files that need not these tricks and should be
> compiled normally, without any special options. All source files have to be
> compiled into a single library (static or dynamic).
>
> Is there any way to do it in Boost.Build? I've read about alternatives in the
> docs, but they require duplicating the library target, which I'd like to
> avoid. I also read about conditional requirements, but as I understand they
> don't allow to specify version conditions (like <toolset>gcc >= 4.7). Also I
> didn't find any way to specify special build options for particular files.
>
>
Hi,
Boost.Thread uses the following
rule usage-requirements ( properties * )
{
local result ;
if <threadapi>pthread in $(properties)
{
result += <define>BOOST_THREAD_POSIX ;
if <target-os>windows in $(properties)
{
result += [ win32_pthread_paths $(properties) ] ;
# TODO: What is for static linking? Is the <library> also
needed
# in that case?
}
}
if ! <toolset>vacpp in $(properties) || <toolset-vacpp:version>11.1
in $(properties) || <toolset-vacpp:version>12.1.0.1 in $(properties) ||
<toolset-vacpp:version>12.1 in $(properties)
{
result += <library>/boost/chrono//boost_chrono ;
}
return $(result) ;
}
The problem is that (if I'm not wrong)
* the version is dependent on the user_config file :(
* I don't know how to compare them
HTH,
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk