Boost logo

Boost-Build :

From: Ian Fasel (ianfasel_at_[hidden])
Date: 2004-09-03 23:18:09

Hi, I'm a newcomer to Boost.Build, Jam, etc. Please redirect me if
this is the wrong forum for this question.

I'm trying to use Boost.Build v2 to build MATLAB mex files which are
compiled from a C++ file and link to several libraries built with
Boost.Build already. A simple example is
Which would produce
myfile.mexglx on linux,
myfile.mexmac on mac,
myfile.mexhpux on hpux, etc.

A more complex example would be like:
mex -L/path/to/mylib -lmylib -I/path/to/myincludes -lmat

If someone wants to stop me right here and say "Its not easy" or "Its
so easy here's the code" please do. Otherwise, my initial impression
from Jam documentation is to create a Jamrules file which defines a
UserObject rule for going from .cc to .mexXXX. Does this go out the
window with Boost.Build, or can I still follow Jam documentation?

I'm sure there are a lot of reasons the Jamrules file I'm including
below won't work, but I was surprised that the result of including
this line in a Jamfile:
Echo myfile.$(MEXEXTEN) ;
Was a blank line, not even "myfile." (with nothing where the empty
variable goes). Same for
Echo $(OS) ;

So it seems that I've really misunderstood the relationship between and Jam.

I appreciate any help,


# Here's the Jamrules file I started writing, but I haven't debugged
# because I can't even get past expanding variables! :-)
# Define some new rules for building matlab mex files

MEX = mex ;

if $(UNIX)
switch $(OS)
case HPUX :
MEXEXTEN = mexhpux ;

case LINUX :
MEXEXTEN = mexglx ;

case MACOSX :
MEXEXTEN = mexmac ;

case SOLARIS :
MEXEXTEN = mexsol ;

rule UserObject
switch %(>)
case *.$(MEXEXTEN) : MexCompiler $(<) : $(>) ;

rule MexCompiler
MakeLocate $(<) : $(LOCATE_TARGET) ;
DEPENDS $(<) : $(>) ;

actions MexCompiler
$(MEX) $(>) -I$(HDRS) -I$(STDHDRS) -L$(HDRS) -L$(MEXLIBSDIR) -lm
-lmat ;


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