Example #1
0
def lib(names,
        sources=[],
        requirements=[],
        default_build=[],
        usage_requirements=[]):
    """The implementation of the 'lib' rule. Beyond standard syntax that rule allows
    simplified: 'lib a b c ;'."""

    if len(names) > 1:
        if any(r.startswith('<name>') for r in requirements):
            get_manager().errors()(
                "When several names are given to the 'lib' rule\n" +
                "it is not allowed to specify the <name> feature.")

        if sources:
            get_manager().errors()(
                "When several names are given to the 'lib' rule\n" +
                "it is not allowed to specify sources.")

    project = get_manager().projects().current()
    result = []

    for name in names:
        r = requirements[:]

        # Support " lib a ; " and " lib a b c ; " syntax.
        if not sources and not any(r.startswith("<name>") for r in requirements) \
           and not any(r.startswith("<file") for r in requirements):
            r.append("<name>" + name)

        result.append(
            targets.create_typed_metatarget(name, "LIB", sources, r,
                                            default_build, usage_requirements))
    return result
Example #2
0
def notfile(target_name, action, sources, requirements, default_build):

    requirements.append("<action>" + action)

    return targets.create_typed_metatarget(target_name, "NOTFILE_MAIN",
                                           sources, requirements,
                                           default_build, [])
Example #3
0
def lib(names, sources=[], requirements=[], default_build=[], usage_requirements=[]):
    """The implementation of the 'lib' rule. Beyond standard syntax that rule allows
    simplified: 'lib a b c ;'."""

    if len(names) > 1:
        if any(r.startswith('<name>') for r in requirements):
            get_manager().errors()("When several names are given to the 'lib' rule\n" +
                                   "it is not allowed to specify the <name> feature.")

        if sources:
            get_manager().errors()("When several names are given to the 'lib' rule\n" +
                                   "it is not allowed to specify sources.")

    project = get_manager().projects().current()
    result = []

    for name in names:
        r = requirements[:]

        # Support " lib a ; " and " lib a b c ; " syntax.
        if not sources and not any(r.startswith("<name>") for r in requirements) \
           and not any(r.startswith("<file") for r in requirements):
            r.append("<name>" + name)

        result.append(targets.create_typed_metatarget(name, "LIB", sources,
                                                      r,
                                                      default_build,
                                                      usage_requirements))
    return result
Example #4
0
def notfile(target_name, action, sources, requirements, default_build):

    requirements.append("<action>" + action)

    return targets.create_typed_metatarget(target_name, "NOTFILE_MAIN", sources, requirements,
                                           default_build, [])