Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-08-27 03:12:39


Hi Chris,

Chris Drexler wrote:
> root
>
> + pkgs + boost_1_30_0
>
> | + log4cpp_0.3.4b + include
> | + lib
>
> + mylib + include
>
> | + src
>
> + myapps + testapp + src
>
>
> The idea was to separate the information of which package versions to
> use and where libraries and include files reside.
>
>
> For this I put a Jamfile into 'pkgs' which consist of the following entries
> (OS independence not included right now)
>
> -------------------------------------------------------------------
>
> project pkgs ;
>
> BOOST = boost_1_30_0 ;
> LOG4CPP = log4cpp-0.3.4b ;
>
> # system libraries
> lib winsock : : <name>Ws2_32.lib ;
> lib advapi : : <name>Advapi32.lib ;
>
>
> alias all : log4cpp boost ;
> alias boost : : <include>$(BOOST) ;
>
> lib log4cpp
>
> : <file>$(LOG4CPP)/msvc6/log4cpp/Release/log4cpp.lib <variant>release
> :
> : <library>winsock <library>advapi
>
> ;
> lib log4cpp
>
> : <file>$(LOG4CPP)/msvc6/log4cpp/Debug/log4cpp.lib <variant>debug
> :
> : <library>winsock <library>advapi
>
> ;
> -------------------------------------------------------------------
>
> and the Jamfile in 'root' (where project-root.jam and boost-build.jam
> resides) contains
>
> -------------------------------------------------------------------
>
> project MyProject
>
> : default-build debug <link>static
>
> ;
>
> use-project /pkgs : ./pkgs ;
> use-project /MyLib: ./mylib ;
>
> -------------------------------------------------------------------
>
> The Jamfile in 'mylib' uses several of the libraries defined in
> 'pkgs'
>
> -------------------------------------------------------------------
> project MyLib
>
> : usage-requirements <include>./include
> : requirements <include>./include
> : source-location ./src
>
> ;
>
>
> LIBSRC =
> [ .. whatever ..]
> ;
>
>
> lib MyLib : $(LIBSRC) : : : <library>/pkgs//log4cpp ;
> lib MyLib2 : $(LIBSRC) : : : <library>/pkgs//all ;
>
> -------------------------------------------------------------------
>
> and the application 'testapp' depends on 'mylib'
> -------------------------------------------------------------------
> project testapp
>
> : requirements <library>/MyLib//MyLib
> : source-location ./src
>
> ;
>
> exe test
>
> : testapp.cpp
>
> ;
>
> exe test2
>
> : testapp.cpp
> :
> : <library>/MyLib//MyLib2
>
> ;
> -------------------------------------------------------------------
>
>
> Problems/Questions
> ==================
> - I already know from this list that "include-only" libraries are
> not supported right now. The line
>
> alias boost : : <include>$(BOOST) ;
>
> hasn't been removed just to demonstrate the final idea.

I hope we'll support it quite soon. But <include> should be
"usage-requirements", not requirements as in the example above. With a little
tweak to the codebase, you'll be able to write

alias boost : : : < incude>$(BOOST) ;

> - I had to put a (empty) 'project-root.jam' file into 'pkgs'.
> Otherwise I get the error message:
>
> error: default build can be specified only in first alternative
> main target is ../../../pkgs/log4cpp
>
> Any ideas why this happens?
> I get the same error message if I put the prebuild declarations,
> e.g. of log4cpp release/debug, into the main Jamfile in root.

That's a bug. Fortunately, Michael Stevens has identified and fixed it
already. The fix will be included in the next milestone, to be released
really soon. Or you might check out the CVS state.

> - If I put the prebuild declarations, again c.f. log4cpp, into
> the Jamfile in root (after having solved the problem described
> in the last paragraph ), how can I access the entries as depencies
> as the reference via the package name ('/pkgs//log4cpp')
> is not possible any more as the something similar to the line
> 'use-project /pkgs : ./pkgs ;' is missing.

Hmm... you probably can try saying that your root project is called "/pkgs"
with

use-project /pkgs : . ;

Do I understand correctly that it's only a workaround to the previous bug?

> - the library dependcies for 'log4cpp' are correct and the
> appropriate library is linked BUT the include depencies
> are not used (neither for boost nor for log4cpp).
> I had to add the paths once more into the Jamfile in 'root'
> to make them available. After the changes the Jamfile looks
> like this

In the case above, I see <include> only for "alias" invocation, which indeed
does not work. Did I miss some other place?

> -------------------------------------------------------------------
> BOOST = pkgs/boost_1_30_0 ;
> LOG4CPP = pkgs/log4cpp-0.3.4b ;
>
> project MyProject
>
> : default-build debug <link>static
> : requirements
>
> <include>$(BOOST)
> <include>$(LOG4CPP)/include
> ;
>
> use-project /pkgs : ./pkgs ;
> use-project /MyLib: ./mylib ;
>
> -------------------------------------------------------------------
>
> This is not what I want because now the paths to the
> package directories appear twice, once in root/Jamfile and once in
> root/pkgs/Jamfile.

Yep, that's not acceptable.

- 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