|
Boost-Build : |
Subject: Re: [Boost-build] Generated header files.
From: Mathias Lorente (mathias.lorente_at_[hidden])
Date: 2008-12-04 09:56:25
Vladimir Prus wrote:
> Mathias Lorente wrote:
>
>
>
>> First the header files are generated, then my library is built.
>> New definition to build my library:
>>
>> lib my_lib
>> : [ glob-tree *.cpp : .svn ]
>> : <implicit-dependency>../utils//gen
>> <link>static
>> <define>BUILDING_LIBRARY
>> <variant>debug:<define>ENABLE_DEBUG_LOG
>> ;
>>
>
> 'implicit-dependency' should refer to the header target, not the utility
> that generates it.
>
> - Volodya
In fact my input and generated files are in subdirectories. When I try:
<implicit-dependency>my_subdir/header.h I got following error messages:
c:/travail/boost_1_37_0/tools/build/v2/build\virtual-target.jam:1047:
in virtual-target.register-actual-name from module virtual-target
error: Duplicate name of actual target: <p.>res\header.h
error: previous virtual target {
Jamfile</c:/travail/tests/bjam/lib>%Jamfile</c:/travail/tests/bjam/lib>.generate-header-res/header.h.H
{ gcc%gcc.link-gen.exe.EXE { gcc%gcc.compile.c++-gen.o.OBJ {
gen.cpp.CPP } } } { res/header.txt. } }
...
But, if I reference the generator utility and remove leading './'
everything goes right!
To sum up:
- I need to launch bjam twice to update the library with following jam
file (first time generate header file, second time build the library):
project : requirements <include>res ;
make ./res/header.h
: ../utils//gen ./res/header.txt
: @generate-header
: <location>.
;
actions generate-header
{
echo $(<)
$(>[1]) $(>[2])
}
lib my_lib
: [ glob-tree *.cpp : .svn ]
: <implicit-dependency>../utils//gen
<link>static
<define>BUILDING_LIBRARY
<variant>debug:<define>ENABLE_DEBUG_LOG
;
- I get the above error with following jamfile (../utils//gen replaced
by ./res/header.h):
project : requirements <include>res ;
make ./res/header.h
: ../utils//gen ./res/header.txt
: @generate-header
: <location>.
;
actions generate-header
{
echo $(<)
$(>[1]) $(>[2])
}
lib my_lib
: [ glob-tree *.cpp : .svn ]
: <implicit-dependency>./res/header.h
<link>static
<define>BUILDING_LIBRARY
<variant>debug:<define>ENABLE_DEBUG_LOG
;
- I get what I want with this one ('./res/header' replaced by 'res/header'):
project : requirements <include>res ;
make res/header.h
: ../utils//gen res/header.txt
: @generate-header
: <location>.
;
actions generate-header
{
echo $(<)
$(>[1]) $(>[2])
}
lib my_lib
: [ glob-tree *.cpp : .svn ]
: <implicit-dependency>../utils//gen
<link>static
<define>BUILDING_LIBRARY
<variant>debug:<define>ENABLE_DEBUG_LOG
;
I hope this post will help someone else.
Thanks again Volodya for your great help.
Mathias
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