Boost logo

Boost-Build :

From: Mateusz Loskot (mateusz_at_[hidden])
Date: 2006-12-27 09:47:52


Hi,

I'm a kind of Boost.Build newbie and I'm going to migrate a few projects
based on GNU Autoconf/Automake/Libtool to Boost.Build v2.
So, I'd like to ask for some guidelines, best practices and
URLs/pointers where I should look first.

So far, I've read and exercised following documents:
- manual, sections 21 - 24
http://www.boost.org/tools/build/v2/index.html
- Getting Started on the Wiki

After this reading, the BB2 looks very promising to me and
I'd like to move on.
Here are some of questions I'd like to ask here:

0. Is bjam 3.1.11 a good version to start with Boost.Build.2 ?
This version is currently available in Ubuntu 6.10.
I'm asking, because I'm experiencing some strange problems when trying
to run bjam --v2 command.

Below I'm trying to summary my configuration and steps I'm taking to
use bjam on my Ubuntu 6.10 box:

a) echo $BOOST_BUILD_PATH
/usr/share/boost-build

b) Trying to build boost/tools/build/v2/example/hello but not from
BOOST_ROOT location. I copied 'example' directory to another directory.

$ ls
hello.cpp Jamroot
$ bjam --v2
Failed to find the project root for directory '.'.
Did not find a project-root.jam file there or in any of its parent
directories.
Please consult the documentation at 'http://www.boost.org'.

c) Trying to fix, but I'm not sure about these steps,
it's just my intuition:

$ touch project-root.jam
$ ls
hello.cpp Jamroot project-root.jam
$ bjam --v2
/usr/share/boost-build/build/project.jam:213: in load-jamfile from
module project
error: Unable to load Jamfile.
error: Could not find a Jamfile in directory '.'.
error: Attempted to find it with pattern '[Jj]amfile.v2 [Jj]amfile
[Jj]amfile.jam'.
error: Please consult the documentation at 'http://www.boost.org'.
/usr/share/boost-build/build/project.jam:67: in project.load from module
project
/usr/share/boost-build/build-system.jam:75: in load from module build-system
/usr/share/boost-build/kernel/modules.jam:259: in import from module modules
/usr/share/boost-build/kernel/bootstrap.jam:120: in boost-build from module
/home/mloskot/workshop/boost/bb2/example/boost-build.jam:2: in module
scope from module

d) ...following on what my intuition is telling me:

$ ls
hello.cpp Jamroot project-root.jam
$ mv Jamroot Jamfile
$ ls
hello.cpp Jamfile project-root.jam
$ bjam --v2
...found 9 targets...
...updating 5 targets...
MkDir1 bin
MkDir1 bin/gcc
MkDir1 bin/gcc/debug
gcc.compile.c++ bin/gcc/debug/hello.o
gcc.link bin/gcc/debug/hello
...updated 5 targets...

e) I'm not sure:
- if BOOST_BUILD_PATH is working for me, becasue...
- why I need to create empty project-root.jam?
- why I need to rename Jamroot to Jamfile?
- is Jamroot appropriate for multi-subprojects project and
  Jamfile for flat / one-level project?

I'd be thankful for pointing what I'm doing wrong here.

1. How to migrate ./configure based steps to BB2?
Here, I'd like to learn how to enable users to enable/disable optional
features in my software. For example, my ./configure supports
--with-pgsql option that enables/disables PostgreSQL support in my
software. What is the equivalent of such configuration/options in BB2?

2. How can I tell bjam to compile using 'gcc' instead of 'g++'?
I'd like to compile C sources with lib rule defined as follows:

lib mylib : a.c b.c

As I see, bjam calls g++ what causes errors flood about missing
declarations, etc.
How can I control selection of gcc/g++ command?
or better:
How can I control selection of C or C++ compilation mode?

3. Is there any repository of predefined/custom rules for Boost.Build?
Here, I mean something like http://autoconf-archive.cryp.to/
where I can find existing or publish my own macros ie. detecting various
DBMS client libraries, etc.
Is there anything like that for Boost.Build?

Thanks for any help in advance.

Cheers

-- 
Mateusz Loskot
http://mateusz.loskot.net

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