|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-07-06 04:48:26
Hi Philipp,
> I am using Boost.Build v2 in one of my own projects (switching
> from ugly Makefile hacks which were terribly slow). It works
> great and is much more powerful and faster than make with
> respect to dependencies (implicit and explicit) without much
> programming, great, thanks a lot! I want to use external
> libraries in my project and have two questions regarding this. I
> am using Debian GNU/Linux and I am a complete newbie in the Jam
> / Boost.Build world.
>
>
> - Libraries (also the internal ones) are linked twice to my
> executables.
...
> How can I have the linking just once?
Are you using m9.1 release or CVS version? In 9.1 the libraries are
duplicated so work around GNU ld sensitivity to the order of libraries on
the command line. In current version, we compute the right order
automatically, so libraries are no longer duplicated.
> - I would like to have one file where all external libraries are
> declared. On some other systems, not all libraries are
> installed and I would like to have a configuration option in
> this same file which can be evaluated in the Jamfiles for
> conditional compiles. I guess the file site-config.jam is
> intended for this. Most of the stuff, I got to work, but I
> think it is a little bit ugly.
...
> if [ site-config.HAS_PARDISO ] = true {
> obj pardiso : pardiso.cc : : <use>/site-config//pardiso ;
> SOURCES += pardiso ;
> LIBS += <library>/site-config//pardiso ;
> }
> ----8<----8<----8<----8<----8<----8<----8<----
> However, I suspect there is a simpler way to achieve this.
> Could you give me a hint, please?
If you only wanted to link to "pardiso" library, you can do this:
- in site-config.jam
if $(library is present) {
lib pardiso .........
} else {
alias pardiso ;
}
- in your Jamfiles:
......... <library>/site-config//pardiso ;
Unfortunately, you also add some file to your project depending on presense
of the library, and there's no builtin way to do this. The way you do it is
perfectly OK, though if you are not scared of being the first one to try a
new idea I've just got, you can try:
in site-config.jam
feature.feature have-pardiso : yes no ;
if /*no library */
{
feature.set-default <have-pardiso> : no ;
}
in Jamfile
lib whatever : a.cpp : <have-pardiso>yes:<source>pardiso.cc ;
At least quick experiment I did in
http://zigzag.cs.msu.su:7813/working_copy/v2/example/pardiso/
worked. (You can replace :7813 with /~ghost is you're behind firewall).
HTH,
Volodya
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