List Info

Thread: Best way to include platform specific sources?




Best way to include platform specific sources?
user name
2006-02-10 14:47:26
Wow.  Thanks for the detailed reply!

"Vladimir Prus" <ghostcs.msu.su> wrote in
message 
news:200602101146.08385.ghostcs.msu.su...

> That's just fine, if the build platform and the target
platforms is the 
> same
> -- which is the case now since we don't, at least
officially, support 
> cross-compiling.

Would the right way to support a cross-compilation-aware BB
be the first 
method of using empty aliases and alternatives?

>> and it almost works, but since we don't have any
NT specific files, the
>> rule bombs out.
>
> Ah, true, but what do you want in that case? Skip
building of 'example2'
> completely? Then, you can either wrap it in "if [
os.name ] = NT", or you 
> can
> use newly introduced <build>no properties:
>

My example was a bit contrived here.  In reality, these
source files get 
compiled into a lib that has other source files that are
always part of it. 
I trimmed a bit too much away to give a clear
representation.

> or you can combine indirect conditional requirements
with <build>on and 
> the
> <source> feature like this:

I tried implementing this method with the following code.  I
used an 
intermediate obj target so I could have the <build>no
stop it but not the 
parent.  It works, but I did notice something a bit strange.
 The Skipping 
message appears *very* early in the build progress..  While
it is very clear 
in its statement, I think it might be just a bit
disconcerting when one of 
my developers sees it at the top of a Windows build.

rule select_platform_specific_sources ( properties * )
{
    if <os>NT in $(properties)
    {
        return <build>no ;
    }
    else if <os>LINUX in $(properties)
    {
        return <source>linux.cpp ;
    }
    else if <os>OSXPPC in $(properties)
    {
        return <source>osxppc.cpp ;
    }
}
obj platform_specific_sources
    : # sources
    : # requirements
        <conditional>select_platform_specific_sources
    ;
lib util
    : # sources
        #... normal sources here
        platform_specific_sources
    : # requirements
    ;
[C:\src\testproj\engine\cpp\util\common]bjam util
Skipping build of 
../../../../engine/cpp/util/common/platform_specific_sources
-- <build>no in 
properties.
...patience...
...found 468 targets...
...updating 91 targets...
MkDir1 ..\..\..\..\product\build


Does it seem right to you that the Skipping message appears
so early?

Daniel 


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )