MCPcopy Create free account
hub / github.com/boostorg/build / LibGenerator

Class LibGenerator

v2/tools/builtin.py:405–442  ·  view source on GitHub ↗

The generator class for libraries (target type LIB). Depending on properties it will request building of the approapriate specific type -- SHARED_LIB, STATIC_LIB or SHARED_LIB.

Source from the content-addressed store, hash-verified

403
404# Ported to trunk@47077
405class LibGenerator (generators.Generator):
406 """ The generator class for libraries (target type LIB). Depending on properties it will
407 request building of the approapriate specific type -- SHARED_LIB, STATIC_LIB or
408 SHARED_LIB.
409 """
410
411 def __init__(self, id, composing = True, source_types = [], target_types_and_names = ['LIB'], requirements = []):
412 generators.Generator.__init__(self, id, composing, source_types, target_types_and_names, requirements)
413
414 def run(self, project, name, prop_set, sources):
415
416 # The lib generator is composing, and can be only invoked with
417 # explicit name. This check is present in generator.run (and so in
418 # builtin.LinkingGenerator), but duplicate it here to avoid doing
419 # extra work.
420 if name:
421 properties = prop_set.raw()
422 # Determine the needed target type
423 actual_type = None
424 properties_grist = get_grist(properties)
425 if '<source>' not in properties_grist and \
426 ('<search>' in properties_grist or '<name>' in properties_grist):
427 actual_type = 'SEARCHED_LIB'
428 elif '<file>' in properties_grist:
429 # The generator for
430 actual_type = 'LIB'
431 elif '<link>shared' in properties:
432 actual_type = 'SHARED_LIB'
433 else:
434 actual_type = 'STATIC_LIB'
435
436 prop_set = prop_set.add_raw(['<main-target-type>LIB'])
437
438 # Construct the target.
439 return generators.construct(project, name, actual_type, prop_set, sources)
440
441 def viable_source_types(self):
442 return ['*']
443
444generators.register(LibGenerator("builtin.lib-generator"))
445

Callers 1

builtin.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected