List Info

Thread: Re: Mid-level example of using bjam outside of boost




Re: Mid-level example of using bjam outside of boost
country flaguser name
Australia
2007-07-24 18:29:53
boost-build-requestlists.boost.org wrote:
> ------------------------------
> From: "Tim St. Clair" <timothyscgmail.com>
> Subject: Re: [Boost-build] Mid-level example of using
bjam outside of boost
> 	boost
> To: "Boost.Build developer's and user's
list"
> 	<boost-buildlists.boost.org>
> Message-ID:
> 	<ef85fd8f0707240839s2e4e49a9kbc77e66391cb95ccmail.gmail.com>
> Content-Type: text/plain;
charset="iso-8859-1"
>
> >From what you are telling me it appears that I need
to grab all which is in
> tools/build/v2 in order to build.  That's fine, I'm
willing to bite that
> dep.  However it would be very useful if there was a
step by step process
> somewhere which outlines how-to setup a project.
>
> It would also be nice if there were some open source
projects which use bjam
> which I could reference.  After looking at (N) bjam
files I can usually
> gleen the forest through the trees.
>
> So if you know of any other projects which I can look

that would be
> *useful*
>
> -Tim
>   

Hi Tim,

I use bjam quite a bit.

This is not a mid-level example, but it is a project for a
tool I wrote 
that simply runs N tasks in parallel. It doesn't use
libraries, but 
others we have do. Here's how it works. I've got the source
for the 
project files below.

- I made an RPM to install all the boost-build jam files
under 
/usr/share/boost-build. (That's the directory in the boost
distribution 
which contains site-config.jam, user-config.jam, etc)
- My project contains boost-build.jam, project-root.jam and
Jamfile all 
in the one directory. I don't use "Jamroot"
spelling for the jam root 
for a simple project because they can't live in the same
directory, but 
Jamfile and project-root.jam can.

If you want to do libraries within the same source tree, you
just make a 
hierarchy of directories that contain Jamfiles rather than
just having 
one. Look up how to use the lib target in the official docs.
They cover 
that okay. If you're using pre-compiled libraries, use
"alias" instead. 
I've used bjam on a source tree with ~300K LOC and 30 or so
sublibraries 
and this approach works well. I saw behaviour I didn't
understand using 
<search> to add search paths for libraries so I mostly
just use 
<cxxflags> and <linkflags> to do what I want.

bjam's great at lazily compiling c++ the "right"
way, but i find it not 
as good at handling complex pre-build tasks like automatic
source code 
generation and checking source for style rules, if that's
the stuff 
you're looking for in examples. I'm sure it can be done but
it was just 
too complex for me to spend time learning it. I just run a
tool before 
bjam to do that sort of thing. To do arbitary post-build
tasks like 
FTP'ing to a remote server etc etc you should look into
using the "make" 
rule.

It may be a small example, but it's by no means a toy one --
it's 
complete and it gets the job done for me.

HTH,
Matthew

Contents of project folder:

main.cpp
========
#include <iostream>
....
int main()
{
   ...
}
========


boost-build.jam:
======
boost-build /usr/share/boost-build  ;
======

project-root.jam:
==========
project root ;
==========

Jamfile:
==========
project pexec ;

using gcc : : ccache gcc4 ;

exe pexec
    : # sources
    [ glob *.cpp ]
    : <linkflags>-lstdc++
    ;

# install to ./bin/ to run easily
install bin : pexec ;
==========

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )