Пример #1
0
 def generate_combined(self, generator, cx):
   outputs = []
   proj_path = paths.Join(cx.localFolder, self.name_ + self.compiler.projectFileSuffix)
   node = nodes.ProjectNode(cx, proj_path, self)
   for builder in self.builders_:
     tag_folder = generator.addFolder(cx, builder.localFolder)
     objFile = paths.Join(tag_folder, builder.outputFile)
     pdbFile = paths.Join(tag_folder, builder.name_ + '.pdb')
     objNode = generator.addOutput(cx, objFile, node)
     pdbNode = generator.addOutput(cx, pdbFile, node)
     outputs.append(CppNodes(objNode, pdbNode))
   generator.addProjectNode(cx, node)
   return outputs
Пример #2
0
def export_source_files(node, xml):
  files = {}
  all_builders = set()
  for builder in node.project.builders_:
    for source in builder.sources:
      file = os.path.relpath(
        paths.Join(node.context.currentSourcePath, source),
        paths.Join(node.context.localFolder)
      )
      builders = files.setdefault(file, set())
      builders.add(builder)
    all_builders.add(builder)

  def emit(file, kind):
    builders = files[file]
    excluded = all_builders - builders

    if len(excluded) == 0:
      xml.tag(kind, Include = file)
      return

    with xml.block(kind, Include = file):
      for builder in excluded:
        xml.tag('ExcludedFromBuild', 'true', Condition = condition_for(builder))


  with xml.block('ItemGroup'):
    for file in files:
      _, ext = os.path.splitext(file)
      if ext != '.rc':
        emit(file, 'ClCompile')

  with xml.block('ItemGroup'):
    for file in files:
      _, ext = os.path.splitext(file)
      if ext == '.rc':
        emit(file, 'ResourceCompile')
Пример #3
0
    def addOutputFile(self, context, path, contents):
        folder, filename = os.path.split(path)
        if not filename:
            raise Exception('Must specify a file, {} is a folder'.format(path))

        folder_node = self.generateFolder(context.localFolder, folder)
        data = {
            'path': paths.Join(folder_node, filename),
            'contents': contents,
        }

        _, outputs = self.addCommand(context = context,
                                     node_type = nodetypes.BinWrite,
                                     folder = folder_node,
                                     data = data,
                                     inputs = [],
                                     outputs = [filename])
        return outputs[0]