Boost logo

Boost-Build :

From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2008-01-04 16:45:35


   Hi Christopher.

> the project uses pre built dynamic libraries which
> are arranged like this:
>
> /$(src_root_path)/$(library_name)/include/
>
> with the binaries arranged like this
>
> /$(bin_root_path)/$(library_name)/$(lib_version)/
>
> This runs on a UNIX platform and the paths of the shared objects are
> hardcoded into the executable ( <dll-paths> true ? )

   See <dll-path> and <hardcode-dll-paths> properties. See
http://boost.org/boost-build2/doc/html/bbv2/faq/dll-path.html for more
information but I guess you're on top of that already...

> At the moment I have got it working on one example by using this as a rule
>
> lib monkey_biz : : <name>monkey_biz.6.5
> <search>$(bin_root_path)/6.5/lib_debug
> <include>$(src_root_path)/monkey_biz/src ;
>
> (the debug and release versions of the libraries are in separate places
> too, but I think I can handle that!)
>
> and repeating for every library, and adding this as a target later on.
> Now while this functions, it is ugly and I know (hope?!) boost build can
> do better.
>
> What I would like to do is have a list of (module_name,
> module_version) , pass each onto a function which than creates the
> target as above, so that the jamfile itself can be clear and simple.
> Trouble is I'm not sure where to start.

   At first glance it looks to me like you want/need a simple rule
wrapping the 'lib' main target rule. Try adding something like this to
your project's Jamfile:

rule my-typical-prebuilt-lib ( module_name : module_version
     : prerequisites * : default-build * )
     for local variant in debug release
         lib $(module_name)
             :
             # No sources.
             :
             <name>$(module_name)$(module_version)
             <search>$(bin_root_path)/$(module_version)/lib_$(variant)
             <include>$(src_root_path)/$(module_name)/src
             <variant>$(variant)
             $(prerequisites)
             :
             $(default-build) ;

and then using it to define your prebuilt library targets like this:

my-typical-prebuilt-lib monkey_biz : 6.5 ;

   Sorry if any syntax errors sneaked in... I just typed this into the
mail and have not taken the time to test it.

> Do I need to create a generator, or a class or something else.

   Generators are a Boost Build (and not Boost Jam) concept and
represent objects used to convert one type of Boost Build target (a.k.a.
meta target) into another, e.g. to convert .cpp files to .obj files or
.obj files to .lib files. After reading in your project definition and
your build request for the exact list of targets you want to build,
Boost Build uses generators to construct a full plan for the needed
build. Not something you'd need here...

   Hope this helps.

   Best regards,
     Jurko Gospodnetić


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