示例#1
0
文件: cpp.py 项目: raffber/capnqml
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
文件: qt.py 项目: raffber/capnqml
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)