Boost logo

Boost-Build :

Subject: Re: [Boost-build] Generating multiple CPP/H targets from a single source
From: Fabien Chêne (fabien.chene_at_[hidden])
Date: 2010-08-05 03:41:44


Hi

2010/8/4 Vladimir Prus <vladimir_at_[hidden]>:
> Tyson Marchuk wrote:
>
>>   Thanks for the reply Volodya.
>>
>> I looked at the Generated headers section in the documentation, and I
>> tried adding <implicit-dependency> to my Jamfile, but this doesn't seem
>> to be solution. The generated files are in the same main target as the
>> files that include them so according to the documentation this should be
>> handled automatically.
>>
>> My Jamfile (names changed) is just:
>> <code>
>> exe testQtAndCodeGenerator
>>     :
>>     SourceForCodeGenerator.idl
>>     AQt4Dialog.ui
>>     AQt4DialogWrapper.h
>>     AQt4DialogWrapper.cxx
>>     AnotherQt4Class.h
>>     AnotherQt4Class.cxx
>>     main.cxx
>>     /qt4//QtCore
>>     /qt4//QtGui
>>     /codeGenerator//codeGenerator
>>     : <include>.
>>     ;
>>
>> install bindir : testQtAndCodeGenerator : <location>../bin ;
>> </code>
>>
>> Note above that the code generator will turn SourceForCodeGenerator.idl
>> into:
>> SourceForCodeGenerator.h
>> SourceForCodeGeneratorPlugin.h
>> SourceForCodeGeneratorSupport.h
>> SourceForCodeGenerator.cpp
>> SourceForCodeGeneratorPlugin.cpp
>> SourceForCodeGeneratorSupport.cpp
>>
>> These headers will be included in the other source files in the project.
>>
>> Maybe this feature was added in a later version of Boost.Build? I'm
>> using milestone 10.
>
> You really should try a later version, then -- nightly built preferably.
> Detection of dependencies from .cpp file to a generated header is something
> that original jam lacked, and was implemented in Boost.Jam; but I don't
> remember when exactly.

I encouter the same bug, from a similar generator, and it fails
sometimes, particularly when using parallelism.

Here is a reduced jamfile:

exe test : test.idl ;

it will produce:
test.gen.h
test.gen.hh
test.gen.cxx
test.genSK.cxx

Dependencies are as follows:
test.genSK.cxx includes the file test.gen.hh
test.gen.cxx includes the file test.gen.h
test.gen.h includes the file test.gen.hh

I think that the problem here is that bjam can't know that
test.gen.cxx will depend on test.gen.h without looking at generated
files -- and bjam can't look at them when they are not yet generated.
So, we need a way to teach bjam that there is a dependency.

I've been playing for a while with virtual-target.depends, DEPENDS
without any luck.
I've tryed a nightly build and Boost.Build 3.1.18 without success.

About the OP's example, it looks the same
SourceForCodeGeneratorSupport.cpp depends on
SourceForCodeGeneratorSupport.h but bjam don't know it when files are
not yet generated. Right ?

-- 
Fabien

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