示例#1
0
 def getExecutableLibrary(self, program):
     '''Executable libraries follow the naming scheme: lib<project>-<lang>-<program>-exec.a'''
     return project.ProjectPath(
         os.path.join(
             'lib', 'lib' + self.project.getName() + '-' +
             self.language.lower() + '-' + program + '-exec.a'),
         self.project.getUrl())
示例#2
0
  def setupSourceDB(self, proj):
    '''Load any existing source database for the given project, and register its save method'''
    import project

    root     = project.ProjectPath('', proj.getUrl())
    filename = project.ProjectPath('bsSource.db', proj.getUrl())
    self.debugPrint('Reading source database for '+proj.getUrl()+' from '+str(filename), 2, 'sourceDB')
    if os.path.exists(str(filename)):
      try:
        dbFile        = open(str(filename), 'r')
        self.sourceDB = cPickle.load(dbFile)
        self.sourceDB.filename = filename
        dbFile.close()
      except Exception, e:
        self.debugPrint('Source database '+str(filename)+' could not be read: '+str(e)+'. Creating a new one', 2, 'sourceDB')
        self.sourceDB = sourceDatabase.SourceDB(root, filename)
示例#3
0
 def getServerLibrary(self, package, proj=None, lang=None):
     '''Server libraries follow the naming scheme: lib<project>-<lang>-<package>-server.a'''
     if proj is None: proj = self.project
     if lang is None: lang = self.language
     return project.ProjectPath(
         os.path.join(
             'lib', 'lib' + proj.getName() + '-' + lang.lower() + '-' +
             package + '-server.a'), proj.getUrl())
示例#4
0
 def getRuntimeIncludes(self):
     '''Return the includes for the SIDL Runtime'''
     proj = self.getRuntimeProject()
     return [
         project.ProjectPath(
             self.getServerRootDir(self.getRuntimeLanguage(),
                                   self.getRuntimePackage()), proj.getUrl())
     ]
示例#5
0
 def getRuntimeLibraries(self):
     '''Return the libraries for the SIDL Runtime'''
     proj = self.getRuntimeProject()
     return [
         project.ProjectPath(
             self.getServerLibrary(proj.getName(),
                                   self.getRuntimeLanguage(),
                                   self.getRuntimePackage()), proj.getUrl())
     ]
示例#6
0
 def getServerCompileTarget(self, package):
     '''All purposes are in Cxx, so only a Cxx compiler is necessary for the skeleton and implementation.'''
     inputTag = ['server ' + package]
     if len(self.usingSIDL.staticPackages):
         inputTag.append('client')
     (target, compiler) = self.getGenericCompileTarget(inputTag)
     (iorTarget,
      iorCompiler) = self.getIORCompileTarget('server ' + package)
     compiler.includeDirs.append(
         project.ProjectPath(
             self.usingSIDL.getServerRootDir(self.language, package),
             self.project.getUrl()))
     inputTags = [compiler.output.tag, iorCompiler.output.tag]
     archiveTag = self.language.lower() + ' server library directory'
     sharedTag = self.language.lower() + ' server shared library'
     clientTag = self.language.lower() + ' client shared library'
     library = self.getServerLibrary(package)
     linker = build.buildGraph.BuildGraph()
     archiver = build.processor.DirectoryArchiver(self.sourceDB,
                                                  self,
                                                  'cp',
                                                  inputTags,
                                                  archiveTag,
                                                  isSetwise=1,
                                                  library=library)
     consolidator = build.transform.Consolidator(archiveTag, archiveTag,
                                                 'old ' + archiveTag)
     sharedLinker = build.processor.SharedLinker(self.sourceDB,
                                                 self,
                                                 None,
                                                 archiveTag,
                                                 sharedTag,
                                                 isSetwise=1,
                                                 library=library)
     sharedLinker.extraLibraries.extend(self.extraLibraries)
     libraryAdder = build.processor.LibraryAdder(
         [clientTag, 'old ' + clientTag], sharedLinker)
     archiveFilter = build.transform.Filter(archiveTag)
     linker.addVertex(archiver)
     linker.addEdges(consolidator, [archiver])
     linker.addEdges(libraryAdder, [consolidator])
     linker.addEdges(sharedLinker, [libraryAdder])
     linker.addEdges(archiveFilter, [sharedLinker])
     linker.addEdges(build.transform.Remover(inputTags), [archiveFilter])
     target.appendGraph(iorTarget)
     target.appendGraph(linker)
     return target
示例#7
0
    def setupExtraOptions(self, lang, compileGraph):
        '''Set client include directories for all dependencies and the runtime library for linking'''
        import os

        # Hack for excluding build system: Should ask if it is a dependency for Runtime
        useRuntime = not self.project.getUrl(
        ) == 'bk://sidl.bkbits.net/BuildSystem'

        for vertex in compileGraph.vertices:
            if hasattr(vertex, 'defines'):
                # Custom defines
                vertex.defines.extend(self.defines)
            if hasattr(vertex, 'includeDirs'):
                dfs = build.buildGraph.BuildGraph.depthFirstVisit(
                    self.dependenceGraph, self.project)
                # Client includes for project dependencies
                vertex.includeDirs.extend([
                    project.ProjectPath(self.usingSIDL.getClientRootDir(lang),
                                        v.getUrl()) for v in dfs
                ])
                # Runtime includes
                if useRuntime:
                    vertex.includeDirs.extend(
                        self.usingSIDL.getRuntimeIncludes())
                # Custom includes
                vertex.includeDirs.extend(self.includeDirs)
            if hasattr(vertex, 'extraLibraries'):
                if useRuntime:
                    if not (self.project == self.usingSIDL.getRuntimeProject()
                            and lang == self.usingSIDL.getRuntimeLanguage()):
                        # Runtime libraries
                        vertex.extraLibraries.extend(
                            self.usingSIDL.getRuntimeLibraries())
                # Custom libraries
                vertex.extraLibraries.extend(self.extraLibraries)
        return compileGraph