Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to refer to build directory from a source.
From: Duncan Rance (gmane_at_[hidden])
Date: 2009-02-04 06:30:46


Vladimir Prus wrote:
> Duncan,
> from our IRC discussion I understand you'll be sending a revised example showing
> the actual problem?
>
> - Volodya

Okay. I've put together a test case. I would know where to upload a tar to so I'll
just paste it in at the bottom of this message. I've echoed -------- around each
file name.

This case does build but there is one issue I'd like to resolve:

The problem is that the Framework directory is supposed to be a stand-alone bit of
code that is reusable (it actually comes from a different svn repository.) A
prerequisite is that any user of the Framework provides a ResourcesEnum.h
containing ResourcesEnum_t and the function f.

As you can see, I've had to use <implicit-dependency>../Resources//ResourcesEnum.h
in Framework/Jamfile. What I was trying previously was to pass the path to the
generated ResourcesEnum.h into the ../Framework//Framework target from the
Resources/Jamfile.

I hope this makes it clear what I'm trying to do. Is there a way to do this
without referring to Resources in Framework?

Regards,
Duncan

Code follows:

-------- ./Jamroot --------
using gcc ;
path-constant TOP : . ;
exe a : a.cpp Resources//FrameworkRes : <include>Framework <implicit-dependency>Resources//ResourcesEnum.h ;
-------- ./a.cpp --------
#include "Framework.h"
int main (int argc, char *argv[]) { return x(A); }
-------- ./Resources/Jamfile --------
modules.poke : BOOST_BUILD_PATH : [ modules.peek : BOOST_BUILD_PATH ] Framework ;
import resources ;
resource-lib rootres : root.rbs : <link>static ;
h ResourcesEnum.h : root.rbs ;
cpp ResourcesEnum.cpp : root.rbs ;
lib FrameworkRes : rootres ResourcesEnum.cpp ../Framework//Framework : <link>static ;
-------- ./Resources/root.rbs --------
-------- ./Framework/resources.jam --------
import type ;
import generators ;

type.register RESRBS : rbs ;
type.register RESTXT : txt ;
type.register RESOURCE_LIB : : STATIC_LIB ;

generators.register-standard resources.gensrc : RESRBS : RESTXT ;
generators.register-standard resources.genenumh : RESTXT : H ;
generators.register-standard resources.genenumc : H : CPP ;
generators.register-standard $(__name__).genlib : RESTXT : RESOURCE_LIB ;

actions gensrc
{
        cp $(>) $(<)
}

actions genenumc
{
        echo "#include \"ResourcesEnum.h\"" > $(<)
        echo "int f(ResourcesEnum_t e) { return 2; }" >> $(<)
}

actions genenumh
{
        echo "typedef enum { A } ResourcesEnum_t;int f(ResourcesEnum_t);" > $(<)
}

actions genlib
{
        cp /usr/lib/libm.a $(<)
}
-------- ./Framework/Framework.h --------
#include "ResourcesEnum.h"
int x(ResourcesEnum_t y);
-------- ./Framework/Jamfile --------
lib Framework : Framework.cpp : <link>static <implicit-dependency>../Resources//ResourcesEnum.h ;
-------- ./Framework/Framework.cpp --------
#include "Framework.h"
int x(ResourcesEnum_t y) { return f(y); }


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