1 # Copyright 2002-2017 Rene Rivera
2 # Copyright 2002-2017 Vladimir Prus
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE_1_0.txt or copy at
5 # http://www.boost.org/LICENSE_1_0.txt)
10 class searched-lib-generator : generator
16 # The requirements cause the generators to be tried *only* when we are
17 # building a lib target with a 'search' feature. This seems ugly --- all
18 # we want is to make sure searched-lib-generator is not invoked deep
19 # inside transformation search to produce intermediate targets.
20 generator.__init__ searched-lib-generator : : SEARCHED_LIB ;
23 rule run ( project name ? : property-set : sources * )
27 # If 'name' is empty, it means we have not been called to build a
28 # top-level target. In this case, we just fail immediately, because
29 # searched-lib-generator cannot be used to produce intermediate
32 local properties = [ $(property-set).raw ] ;
34 if <link>shared in $(properties)
39 local search = [ feature.get-values <search> : $(properties) ] ;
41 local a = [ new null-action $(property-set) ] ;
42 local lib-name = [ feature.get-values <name> : $(properties) ] ;
44 local t = [ new searched-lib-target $(lib-name) : $(project)
45 : $(shared) : $(search) : $(a) ] ;
46 # We return sources for a simple reason. If there is
47 # lib png : z : <name>png ;
48 # the 'z' target should be returned, so that apps linking to 'png'
49 # will link to 'z', too.
50 return [ property-set.create <xdll-path>$(search) ]
51 [ virtual-target.register $(t) ] $(sources) ;
56 generators.register [ new searched-lib-generator ] ;
58 class searched-lib-target : abstract-file-target
67 abstract-file-target.__init__ $(name) : SEARCHED_LIB : $(project)
70 self.shared = $(shared) ;
71 self.search = $(search) ;
76 return $(self.shared) ;
81 return $(self.search) ;
84 rule actualize-location ( target )