Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-12-16 08:03:59


Toon Knapen wrote:

>
> Vladimir Prus wrote:
>
>>
>> This is by design. In general, we don't know if 'libfoo' public headers
>> include headers from some_external_lib. If they do, we need to propagate
>> usage requirements. If they don't, we don't need.
>>
>
>
> But this is exactly what usage requirements are about: they are
> requirements that are propagated, right ? So IIUC they are currently
> only propagated to their _direct_ dependents ?

Right.

>> You can achieve the desired effect by:
>>
>> lib libfoo : foo.cpp foo_dependencies : : : <use>foo_dependencies ;
>>
>
> But if I now also have :
>
> lib libbar : bar.cpp libfoo ;
> exe app : app.cpp libbar ;
>
>
> the usage-requirements are only propagated until libbar but not until
> 'app'. Thus the include-path when compiling bar will not be influenced
> by the usage-requirements of foo_dependencies ?

Right. Againg, the *original* idea was that you might have dependency on
'foo_dependencies' only in your private headers, so propagating it further
is not needed.

>> OTOH, I can't see any case where propagating usage requirements all the
>> way up will hurt, so maybe it's time to revise the behaviour. Opinions?
>
>
> I definitly think it would be better to not only propagate
> usage-requirements to the direct dependents but also to the indirect
> dependents (i.e. dependents of dependents and so forth).

Done -- change and a test are committed. (Patch attached for reference).
Let's see what comes of it.

- Volodya

 --nextPart1114593.8uL3gE0abK Content-Type: text/x-diff; name="use_requirements.diff"
Content-Transfer-Encoding: 8Bit
Content-Disposition: attachment; filename="use_requirements.diff"

Index: build/targets.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/build/targets.jam,v
retrieving revision 1.169
diff -u -r1.169 targets.jam
--- build/targets.jam 7 Dec 2004 11:46:45 -0000 1.169
+++ build/targets.jam 16 Dec 2004 12:58:47 -0000
@@ -1139,6 +1139,9 @@
local result = [ property-set.create
[ $(xusage-requirements).non-dependency ] $(extra) ] ;

+ result = [ $(result).add
+ [ $(subvariant).sources-usage-requirements ] ] ;
+
return $(result) ;
}

@@ -1256,7 +1259,6 @@

local tagged-name = $(name) ;

-
local name_f = [ $(property-set).get <name> ] ;
local tags = [ $(property-set).get <tag> ] ;

Index: test/use_requirements.py
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/test/use_requirements.py,v
retrieving revision 1.15
diff -u -r1.15 use_requirements.py
--- test/use_requirements.py 16 Feb 2004 08:30:12 -0000 1.15
+++ test/use_requirements.py 16 Dec 2004 12:58:47 -0000
@@ -4,15 +4,18 @@
t = Tester()

# Test that use requirements on main target work
+# (and a propagated all the way up, not only to direct
+# dependents)
t.write("project-root.jam", "import gcc ;")

t.write(
"Jamfile",
"""
lib b : b.cpp : <link>shared:<define>SHARED_B
- : : <define>FOO <link>shared:<define>SHARED_B
+ : : <define>FOO <link>shared:<define>SHARED_B
;
- exe a : a.cpp b ;
+ lib c : c.cpp b ;
+ exe a : a.cpp c ;
""")

t.write(
@@ -26,6 +29,17 @@
""")

t.write(
+ "c.cpp",
+"""
+void
+#if defined(_WIN32) && defined(SHARED_B)
+__declspec(dllexport)
+#endif
+create_lib_please() {}\n
+""")
+
+
+t.write(
"a.cpp",
"""
#ifdef FOO
 --nextPart1114593.8uL3gE0abK--


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