Пример #1
0
def compile(sources, use_default=True):
    ret = []
    for source in nodes(sources):
        if not isinstance(source, FileNode):
            continue
        target = source.to_file().to_builddir().append_extension('.o')
        if source.to_file().extension.lower() == 'c':
            task = CCompile(sources=source, targets=target, use_default=use_default)
            if use_default:
                task.use(':cpp/cc')
        else:
            # make sure we are a bit failsafe and we just compile unkown
            # file endings with a cxx compiler. There are a lot of
            # esoteric file extensions for cpp out there.
            task = CxxCompile(sources=source, targets=target, use_default=use_default)
            if use_default:
                task.use(':cpp/cxx')
        ret.append(task)
        dep_scan = DependencyScan(source)
        assert len(dep_scan.targets) >= 1
        header_dep_node = dep_scan.targets[0]
        task.use(header_dep_node)
        for header in header_dep_node.read().value('headers', []):
            task.depends(header)
        ret.append(dep_scan)
    return group(ret)
Пример #2
0
Файл: d.py Проект: raffber/wasp
def compile(*sources):
    ret = []
    for source in nodes(sources):
        assert isinstance(source, FileNode)
        target = source.to_file().to_builddir().append_extension('.o')
        task = Compile(sources=source, targets=target)
        ret.append(task)
    return wasp.group(ret).use(':d/dc')
Пример #3
0
def moc(fs):
    fs = nodes(fs)
    ret = []
    for f in fs:
        tgt = file(f).to_builddir().append_extension('moc.cpp')
        t = shell(cmd='{moc} -o {tgt} {src}', sources=f.to_file(), targets=tgt)
        t.require('moc', spawn=find_moc)
        ret.append(t)
    return group(ret)