예제 #1
0
    def run(self, project, name, prop_set, sources):

        # The lib generator is composing, and can be only invoked with
        # explicit name. This check is present in generator.run (and so in
        # builtin.LinkingGenerator), but duplicate it here to avoid doing
        # extra work.
        if name:
            properties = prop_set.raw()
            # Determine the needed target type
            actual_type = None
            properties_grist = get_grist(properties)
            if '<source>' not in properties_grist  and \
               ('<search>' in properties_grist or '<name>' in properties_grist):
                actual_type = 'SEARCHED_LIB'
            elif '<file>' in properties_grist:
                # The generator for
                actual_type = 'LIB'
            elif '<link>shared' in properties:
                actual_type = 'SHARED_LIB'
            else:
                actual_type = 'STATIC_LIB'

            prop_set = prop_set.add_raw(['<main-target-type>LIB'])

            # Construct the target.
            return generators.construct(project, name, actual_type, prop_set,
                                        sources)
예제 #2
0
파일: builtin.py 프로젝트: boostorg/build
    def run(self, project, name, prop_set, sources):
        assert isinstance(project, targets.ProjectTarget)
        assert isinstance(name, basestring) or name is None
        assert isinstance(prop_set, property_set.PropertySet)
        assert is_iterable_typed(sources, virtual_target.VirtualTarget)
        # The lib generator is composing, and can be only invoked with
        # explicit name. This check is present in generator.run (and so in
        # builtin.LinkingGenerator), but duplicate it here to avoid doing
        # extra work.
        if name:
            properties = prop_set.raw()
            # Determine the needed target type
            actual_type = None
            properties_grist = get_grist(properties)
            if "<source>" not in properties_grist and ("<search>" in properties_grist or "<name>" in properties_grist):
                actual_type = "SEARCHED_LIB"
            elif "<file>" in properties_grist:
                # The generator for
                actual_type = "LIB"
            elif "<link>shared" in properties:
                actual_type = "SHARED_LIB"
            else:
                actual_type = "STATIC_LIB"

            prop_set = prop_set.add_raw(["<main-target-type>LIB"])

            # Construct the target.
            return generators.construct(project, name, actual_type, prop_set, sources)
예제 #3
0
파일: builtin.py 프로젝트: Beman/build
    def run(self, project, name, prop_set, sources):

        # The lib generator is composing, and can be only invoked with
        # explicit name. This check is present in generator.run (and so in
        # builtin.LinkingGenerator), but duplicate it here to avoid doing
        # extra work.
        if name:
            properties = prop_set.raw()
            # Determine the needed target type
            actual_type = None
            properties_grist = get_grist(properties)
            if '<source>' not in properties_grist  and \
               ('<search>' in properties_grist or '<name>' in properties_grist):
                actual_type = 'SEARCHED_LIB'
            elif '<file>' in properties_grist:
                # The generator for 
                actual_type = 'LIB'
            elif '<link>shared' in properties:
                actual_type = 'SHARED_LIB'
            else:
                actual_type = 'STATIC_LIB'

            prop_set = prop_set.add_raw(['<main-target-type>LIB'])

            # Construct the target.
            return generators.construct(project, name, actual_type, prop_set, sources)
예제 #4
0
    def construct(self, name, source_targets, ps):

        source_targets = self.targets_to_stage(source_targets, ps)
        ps = self.update_location(ps)

        ename = ps.get('name')
        if ename:
            ename = ename[0]
        if ename and len(source_targets) > 1:
            get_manager().errors(
            )("When <name> property is used in 'install', only one source is allowed"
              )

        result = []

        for i in source_targets:

            staged_targets = []
            new_ps = self.adjust_properties(i, ps)

            # See if something special should be done when staging this type. It
            # is indicated by the presence of a special "INSTALLED_" type.
            t = i.type()
            if t and b2.build.type.registered("INSTALLED_" + t):

                if ename:
                    get_manager().errors(
                    )("In 'install': <name> property specified with target that requires relinking."
                      )
                else:
                    (r,
                     targets) = generators.construct(self.project(), name,
                                                     "INSTALLED_" + t, new_ps,
                                                     [i])
                    assert isinstance(r, property_set.PropertySet)
                    staged_targets.extend(targets)

            else:
                staged_targets.append(
                    copy_file(self.project(), ename, i, new_ps))

            if not staged_targets:
                get_manager().errors()(
                    "Unable to generate staged version of " + i)

            result.extend(get_manager().virtual_targets().register(t)
                          for t in staged_targets)

        return (property_set.empty(), result)
예제 #5
0
파일: stage.py 프로젝트: Bandeira/sps
    def construct(self, name, source_targets, ps):

        source_targets = self.targets_to_stage(source_targets, ps)
        ps = self.update_location(ps)

        ename = ps.get("name")
        if ename:
            ename = ename[0]
        if ename and len(source_targets) > 1:
            get_manager().errors()("When <name> property is used in 'install', only one source is allowed")

        result = []

        for i in source_targets:

            staged_targets = []
            new_ps = self.adjust_properties(i, ps)

            # See if something special should be done when staging this type. It
            # is indicated by the presence of a special "INSTALLED_" type.
            t = i.type()
            if t and b2.build.type.registered("INSTALLED_" + t):

                if ename:
                    get_manager().errors()(
                        "In 'install': <name> property specified with target that requires relinking."
                    )
                else:
                    (r, targets) = generators.construct(self.project(), name, "INSTALLED_" + t, new_ps, [i])
                    assert isinstance(r, property_set.PropertySet)
                    staged_targets.extend(targets)

            else:
                staged_targets.append(copy_file(self.project(), ename, i, new_ps))

            if not staged_targets:
                get_manager().errors()("Unable to generate staged version of " + i)

            result.extend(get_manager().virtual_targets().register(t) for t in staged_targets)

        return (property_set.empty(), result)