| 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 ['*'] |