|
Boost-Build : |
Subject: Re: [Boost-build] Get full source path in generator rule
From: ÐлекÑей БадÑев (leemouse_at_[hidden])
Date: 2009-03-30 22:55:43
Vladimir Prus пишет:
> On Monday 30 March 2009 16:07:46 ÐлекÑей Ðœ. БадÑев wrote:
>
>> Hi
>> Sorry for my bad English please.
>> I have my own generator (similar as headers-to-doxyfile rule in doxygen.jam)
>> And in the rule, named same as corresponding action, I need full path to
>> sources, provided to generator.
>> Below is text of my rule. But my code is not work - $(files) is emty...
>> Help me please solve this problem.
>>
>> rule headers-to-projfile ( target : sources * : properties * )
>> {
>> local text "# Generated by Boost.Build version 2" ;
>> local output-dir = [ on $(target) return $(LOCATE) ] ;
>> text += "OUTPUT_DIRECTORY = \"$(output-dir)\"" ;
>> local files ;
>> for local src in $(sources) {
>> files += [ on $(src) return $(LOCATE) ] ;
>> }
>>
>
> The LOCATE variable is only set for generated targets, not for leaf targets. In
> fact, the rule/action pair that is used to build the final build command is a
> slightly lower level than you need. I suggest you define your own generator
> class, and then the 'run' method will be passed a list of virtual-target objects.
> Those have the 'path' method.
>
Hi, Vladimir!
I apply your solution to my code and below is fragment of rule "run" of
my generator class, those generate path's to sources:
local headers ;
for src in $(sources) {
local src-dir = [ $(src).path ] ;
local src-name = [ $(src).name ] ;
local path-const src-path = [ path.join $(src-dir)
$(src-name) ] ;
headers += $(src-path) ;
ECHO "src-path: $(src-path)" ;
}
BUT! Here is output when I build my project with that generator
(see ECHO for debug purpose):
src-path: test/main.cpp
src-path: test/person.hpp
src-path: test/string.hpp
src-path: test/tc_clear.cpp
src-path: test/tc_ctr_copy.cpp
src-path: test/tc_ctr_def.cpp
src-path: test/tc_ctr_fill.cpp
src-path: test/tc_insert.cpp
src-path: test/tc_insert_after.cpp
src-path: test/tc_insert_child.cpp
src-path: test/tc_insert_tree.cpp
src-path: test/tc_op_assign.cpp
src-path: test/tc_push_pop.cpp
src-path: test/tc_swap.cpp
src-path: test/tree_traits.hpp
src-path: test/type_list.hpp
src-path: test/value_gen.hpp
src-path: doc/src/dirs.hpp
src-path: doc/src/groups.hpp
src-path: doc/src/mainpage.hpp
src-path: include/dotconf/tree.hpp
src-path: include/dotconf/tree_iterator.hpp
It is relative path's - but I need absolute path's.
How I can get full (absolute) path's to source files?
-- С уважением, ÐлекÑей БадÑев г. Кемерово пр-Ñ‚ Ленина д.90Ртел. +7 904 375 7805
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