Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-14 04:16:44

Toon Knapen wrote:

> >><user-config.jam>
> >>modules.poke : BLAS_LIBS : f77blas atlas ;
> >>modules.poke : BLAS_LIB_PATH : /usr/local/lib ;
> >></user-config.jam>
> >
> > That doesn't look right to me. I think blas should be a toolset.
> I don't think I am following you here.
> IIUC a toolset is a set of tools and settings(options) for those tools
> such that these tools can be used to transform sources into executables.

No, not exactly. Toolset is a file in v2/tools ;-) It can define generators
(=tools), but it can also define targets, like stlport.jam does.

That would allow the user to use something nice in user-config.jam, for

using blas : f77blas atlas : /usr/local/lib ;

The information the user has to provide is the same, but it look clearer.
Now to your original question. You know that
1. The libraries are all searched
2. The order should be preserved.

This can be done in two ways:

while $(LIBS)
local current = $(LIBS[1]) ;
local next = $(LIBS[2]) ;
lib $(current) : : <search>$(LIB_PATH) <use>$(next) ;
LIBS = $(LIBS[2-]) ;

This automatically generates the right <use> properties so that order is the
same as you want

alias blas : # no sources
: # no requirements
: # no default build
: <find-library>$(LIBS:J=&&) <library-path>$(LIB_PATH)

The latter use the magic "&&" separator, which can be specified in property
values to preserve the order.

You can pick either approach, and you can also wrap it into toolset, by
putting this into blas.jam:

import project ;
project.initialize $(__name__) ;
project blas ;

rule init ( LIBS + : LIB_PATH * )
# The definitions above

For example, if you pick the alternative (2) and write blas.jam, you'll be
able to write:

exe main : main.cpp /blas//blas ;

> Now you suggest to use a toolset for that: do you mean that I e.g.
> should create a blas.jam which is an extension of gcc.jam ?

No, since blas is separator from gcc.jam you'd just create a separate file.

> But how
> could my blas.jam know where to find my blas (/usr/lib, /usr/local/lib,
> /opt/soft/lib,...)? Additionally the blas one uses is orthogonal to the
> choice of compiler ? Next I'm not only linking with a prebuilt lib blas
> but also lapack, slatec(Bessel functions), metis(graph partitioning),
> mpi, SuperLU(LU solver), python, HDF, FlexLM and a few others.

There's yet another approach, which might be simpler -- declare targets in
user-config.jam or site-config.jam

But for the complex cases, like ublas, the user should not be expected to
write all the complex logic, so maybe separate blas.jam is a good idea.

Hope this helps, and thanks for brining those topics up!

- Volodya


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at