Boost logo

Boost Users :

From: Chris Drexler (CKolumbus_at_[hidden])
Date: 2003-08-18 04:16:59


Dear Listmembers,

since a few weeks I'm using boost within a development system
which should be changed towards operating system independence.
As boost-buil V2 has a lot of nice features I wanted to base
the build process on it. Unfortunatly it's very confusing
to get all the information I need and sometimes it is not clear
to which boost-build version (v1 or v2) some documentation
belongs to. I hope this list is the right place to ask some
questions about this.

I'm going to describe the my current setup first (which is
a little bit longish in order to cover all important points,
hopefully) and afterwards I'll explain the problems.

The scenario: We have some self-made class libraries which
depend on downloaded packages (one is boost). So I thought
of using the (usage-)dependency features of boost-build v2
for automatically using the right include paths and the
according libraries. (I'm using milestone 6 of boost-build)

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 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?

- 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

-------------------------------------------------------------------
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 wanted because now the paths to the
   package directies appear twice, once in root/Jamfile and once in
   root/pkgs/Jamfile.

Thanks you very much !

Best Regards,
Chris Drexler


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net