|
Boost : |
From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2001-11-02 10:27:42
Jeremy Siek wrote:
> david.> My problem so far is that I don't have a clear picture of what people
> david.> want/need to do with prebuilt libraries in a cross-platform build system.
> david.> Let's discuss it. Once I understand it, getting you what you want should be
> david.> trivial.
>
> david.> What is the analogue for non-unix systems? My impression is that only unix
> david.> does the lib + name + .a trick. Is there any point in worrying about the
> david.> non-uniformity? Perhaps the libraries are always named differently on
> david.> different platforms anyway?
>
> I guess by "portably" I meant all unix systems :) I haven't a clue as to
> how to make that kind of thing work for windows :(
>
> BTW, jam doesn't necessarily have to do all the work. I don't mind
> specifying different things on different platforms, as long as there's a
> way to do it.
To link `portably` with external libraries I have added a section to the
Jamrules of my project where the user can specify the paths and names to
all external libraries (remark that all variables I use or in my
project's namespace (called FEMTown) to avoid clashes ):
# begin project specific Jamrules
#path to Boost
FEMTOWN_BOOST_INC_PATH = /usr/local/boost ;
FEMTOWN_BOOST_LIB_PATH = ;
FEMTOWN_BOOST_LIBS = ;
# path to BLAS
FEMTOWN_BLAS_INC_PATH = ;
FEMTOWN_BLAS_LIB_PATH = /usr/lib ;
FEMTOWN_BLAS_LIBS = f77blas atlas g2c ;
# path to SuperLU
FEMTOWN_SUPERLU_INC_PATH = /usr/local ;
FEMTOWN_SUPERLU_LIB_PATH = /usr/local/SuperLU ;
FEMTOWN_SUPERLU_LIBS = superlu_$(SF_PLATFORM) blas_$(SF_PLATFORM) ;
FEMTOWN_BOXPRO_INC_PATH = $(BOXPRO_TOP)/.. ;
FEMTOWN_BOXPRO_LIB_PATH = $(BOXPRO_TOP)/lib ;
FEMTOWN_BOXPRO_LIBS = actran inputoutput box basic ;
# all together
FEMTOWN_INC_PATHS = $(FEMTOWN_BOOST_INC_PATH) $(FEMTOWN_BLAS_INC_PATH)
$(FEMTOWN_SUPERLU_INC_PATH) $(FEMTOWN_BOXPRO_INC_PATH) ;
FEMTOWN_LIB_PATHS = $(FEMTOWN_BOOST_LIB_PATH) $(FEMTOWN_BLAS_LIB_PATH)
$(FEMTOWN_SUPERLU_LIB_PATH) $(FEMTOWN_BOXPRO_LIB_PATH) ;
FEMTOWN_LIBS = $(FEMTOWN_BOOST_LIBS) $(FEMTOWN_BLAS_LIBS)
$(FEMTOWN_SUPERLU_LIBS) $(FEMTOWN_BOXPRO_LIBS) ;
#end project specific Jamrules
When linking an executable I just write something like
#begin excerpt from Jamfile
exe femtown$(SUFEXE)
:
$(CPPSOURCES).cpp
<lib>../src/lib$(MODULE)$(SUFLIB)
<lib>../../driver/src/libdriver$(SUFLIB)
<lib>../../analysis/src/libanalysis$(SUFLIB)
<lib>../../solver/src/libsolver$(SUFLIB)
<lib>../../system/src/libsystem$(SUFLIB)
<lib>../../component/src/libcomponent$(SUFLIB)
<lib>../../material/src/libmaterial$(SUFLIB)
<lib>../../field/src/libfield$(SUFLIB)
<lib>../../domain/src/libdomain$(SUFLIB)
<lib>../../element/src/libelement$(SUFLIB)
<lib>../../interp/src/libinterp$(SUFLIB)
<lib>../../integr/src/libintegr$(SUFLIB)
<lib>../../topology/src/libtopology$(SUFLIB)
<lib>../../geometry/src/libgeometry$(SUFLIB)
<lib>../../math/src/libmath$(SUFLIB)
<lib>../../utilities/src/libutilities$(SUFLIB)
<lib>../../main/src/libmain$(SUFLIB)
:
<include>$(PROJECT_ROOT)/modules
<include>$(FEMTOWN_INC_PATHS)
<library-path>$(FEMTOWN_LIB_PATHS)
<find-library>$(FEMTOWN_LIBS)
;
#end excerp from Jamfile
This works great and seems to be easy on the users (they just have to
customise the Jamrules and it works out of the box). I mainly work on
Linux/gcc but have done something similar for another project (with Jam
before Boost.Build was this mature) and that works on 5 Unix platforms
and Windows.
toon
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk