Exemplo n.º 1
0
    def _SendToJob(self, type):
        self.job.AddCommandGroup(self.sourceFiles, False)
        if type == 'shared':
            binaryName = self.binary + osutil.SharedLibSuffix()
        elif type == 'executable':
            binaryName = self.binary + osutil.ExecutableSuffix()
        elif type == 'static':
            binaryName = osutil.StaticLibPrefix(
            ) + self.binary + osutil.StaticLibSuffix()
        binaryPath = os.path.join(self.runner.outputFolder,
                                  self.job.workFolder, binaryName)

        if len(self.sourceFiles) > 0:
            self.alwaysRelink = True

        if type == 'static':
            if osutil.IsUnixy():
                args = ['ar']
                args.append('rcs')
                args.append(binaryName)
                args.extend([i for i in self.objFiles])
                self.job.AddCommand(LinkCommand(args, self, binaryPath))
                return
            else:
                args = ['lib.exe']
                args.append('/OUT:' + binaryName)
                args.extend([i for i in self.objFiles])
                self.job.AddCommand(LinkCommand(args, self, binaryPath))
                return

        if self.hadCxxFiles:
            cc = self.compiler.cxx
        else:
            cc = self.compiler.cc
        args = cc.command.split(' ')
        args.extend([i for i in self.objFiles])
        if isinstance(cc, MSVC):
            args.append('/link')
        args.extend(self.compiler['POSTLINKFLAGS'])
        args.extend(self.env['POSTLINKFLAGS'])
        if isinstance(cc, CompatGCC):
            if type == 'shared':
                if self.runner.target['platform'] == 'darwin':
                    args.append('-dynamiclib')
                else:
                    args.append('-shared')
            args.extend(['-o', binaryName])
        elif isinstance(cc, MSVC):
            args.append('/OUT:' + binaryName)
            if type == 'shared':
                args.append('/DLL')
            args.append('/PDB:"' + self.binary + '.pdb' + '"')
        self.job.AddCommand(LinkCommand(args, self, binaryPath))
Exemplo n.º 2
0
	def __init__(self, binary, runner, job, compiler):
		BinaryBuilder.__init__(self, binary, runner, job, compiler)
		self.binaryFile = osutil.StaticLibPrefix() + binary + osutil.StaticLibSuffix()