List Info

Thread: platform dependant source files




platform dependant source files
user name
2006-03-13 16:25:37
Please forgive me if this is not the correct list to ask
for...

I am with the team that is attempting the thread rewrite,
and
we want to better manage to handle platform dependant source
files. But I am unsure about the best practice.

I.e. we want to do away with the ifdef monsters that have
been creeping into the code, to make it more readable.

For header files we choose to take the usual route to
include platform dependant files.

The issue is different for source files since it turns
out that that the set of needed files is different for
each platform. We could do similar as with the header
files and just include the platform dependant source
files from there. But I think this is not a very elegant
solution isn't it?

So my question is for some recommendations how to possibly
handle this with bjam? Are there any examples available?

Thank you for your patience.
Roland
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
platform dependant source files
user name
2006-03-20 09:00:54
On Monday 13 March 2006 19:25, Roland Schwarz wrote:

> I am with the team that is attempting the thread
rewrite, and
> we want to better manage to handle platform dependant
source
> files. But I am unsure about the best practice.
>
> I.e. we want to do away with the ifdef monsters that
have
> been creeping into the code, to make it more readable.
>
> For header files we choose to take the usual route to
> include platform dependant files.
>
> The issue is different for source files since it turns
> out that that the set of needed files is different for
> each platform. We could do similar as with the header
> files and just include the platform dependant source
> files from there. But I think this is not a very
elegant
> solution isn't it?
>
> So my question is for some recommendations how to
possibly
> handle this with bjam? Are there any examples
available?

Hi Roland,

I suggest you start wtih Boost.Build V2, and then read this
part of docs:

   http://boost.org/boost-build2/doc/htm
l/bbv2/advanced/targets.html#id2572452

the example there talks about platform-dependent files, only
the "platform" 
there is not OS, but compiler. Replacing <toolset>XXX
with <os>XXX should do 
the trick for you.

You can also use the 'alias' rule to your advantage:

   lib thread : universal_source.cpp platform_sources ;
   alias platform_sources : a.cpp : <os>NT ;
   alias platform_sources : b.cpp : <os>LINUX ; 


HTH,
Volodya


-- 
Vladimir Prus
http://vladimir_pru
s.blogspot.com
Boost.Build V2: http://boost.org/boost-
build2
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
platform dependant source files
user name
2006-03-26 12:16:44
Vladimir Prus wrote:
> You can also use the 'alias' rule to your advantage:
> 
>    lib thread : universal_source.cpp platform_sources ;
>    alias platform_sources : a.cpp : <os>NT ;
>    alias platform_sources : b.cpp : <os>LINUX ; 

This one looks promising. Thank you. But I have a couple of
additional 
questions:

1) Where can I find which values for <os> do exist?
Ideally I would 
expect the list to be of the same values that the 
BOOST_PLATFORM from 
the config headers can take. I suspect that this mechanism
would need to 
be embedded into the Boost.Jam core, true?

2) Does this work also for Boost.Build-v1? If not, how would
I work 
around this then?

3) Is it still required that the boost lib must be buildable
with v1? At 
least the standard setting of boost-build.jam in boost-root
makes me 
believe so.

Thank you,
Roland

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
platform dependant source files
user name
2006-03-27 07:09:44
Sorry for answering to my own post, but I looked into this
more deeply 
and still more questions:

The os feature is based on the jam $(OS) variable is it?

If so, the variable reflects the platform jam was compiled
on, not 
necessarily the platform the build is targeted for. E.g jam
built with 
vc7, target platform is cygwin. So os will be of little
help.

Is there a concept of target platform in Boost.Build? Of
course the 
chosen toolset somehow implicitly carries this information
too, but I am 
thinking about something available from boost/config.hpp
where compiler 
and platform is separately factored out.

Would it be possible to get this platform information in
bjam too?

Roland

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

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