Пример #1
0
	def testCompile(self):
		from tests.compile.TestCompilation import TestCompilation
		project = TestCompilation.build_easy_prj.getProject()
		compilation = BaseCompilation(project)
#		compilation.setGoalFSItem(FSItem("C:\Work", "hello.exe"))
		tmpDir = tempfile.mkdtemp()
#		strat = AllocInSpecifDirStrategy(tmpDir, ".o")
#		compilation.setAllocateObjStrategy(strat)
#		compilation.setCompiler(GPPCompiler())
		we = StoreCallsWillExecutor()
		from wudoo.compile.cpp.Front import setupPathsFromRoot, wdefaultBuild
		def setupCompilationCallback(compilation, project):
			setupPathsFromRoot(compilation, project, tmpDir)
		wdefaultBuild(project, setupCompilationCallback, we)
#		compilation.compile(we)
#		compilation.resolveDependings(we)
#		compilation.buildBinary(we)
		we.history.sort()
		cmd = we.history[2]
		self.assertTrue(cmd.find("g++") > -1)
		self.assertTrue(cmd.find("-c") > -1)
		self.assertTrue(cmd.find("Main.cpp") > -1)
		self.assertTrue(cmd.find("-o") > -1)
		self.assertTrue(cmd.find("Main.o") > -1)
		cmd = we.history[0]
		self.assertTrue(cmd.find("g++") > -1)
		self.assertTrue(cmd.find("Hello.o") > -1)
		self.assertTrue(cmd.find("Main.o") > -1)
Пример #2
0
	def testEasyBuildReal(self):
		from tests.compile.TestCompilation import TestCompilation
		from wudoo.compile.cpp.Front import setupPathsFromRoot, wdefaultBuild
		project = TestCompilation.build_easy_prj.getProject()
		tmpDir = tempfile.mkdtemp()
		def setupCompilationCallback(compilation, project):
			setupPathsFromRoot(compilation, project, tmpDir)
		wdefaultBuild(project, setupCompilationCallback)
		project = CPPProject("Prj", tmpDir, tmpDir)
		project.addSrcFolders("\n".join(os.listdir(tmpDir)))
		project.setSourceFilter(ExtensionBasedFilter({"o": "o", "exe": "exe"}));
		project.findSources()
		objItems = project.getSourceItems()
		objPaths = [io.getPathNameExt(1) for io in objItems]
		objPaths.sort()
		self.assertEquals(["Bin\\BuildEasy.exe", "Obj\\Src\\Hello.o", "Obj\\Src\\Main.o"], objPaths)
Пример #3
0
	def testBuildDepend(self):
		project = TestEasyExamples.build_useexphdr_prj.getProject()
		tmpDir = tempfile.mkdtemp()
		from wudoo.compile.cpp.Front import setupPathsFromRoot, wdefaultBuild
		def setupCompilationCallback(compilation, project):
			setupPathsFromRoot(compilation, project, tmpDir)
		wdefaultBuild(project, setupCompilationCallback)
		project = CPPProject("PrjFindSources", tmpDir, tmpDir)
		project.addSrcFolders("\n".join(os.listdir(tmpDir)))
		project.setSourceFilter(ExtensionBasedFilter({"o": "o", "exe": "exe"}));
		project.findSources()
		objItems = project.getSourceItems()
		objPaths = [io.getPathNameExt(1) for io in objItems]
		objPaths.sort()
		self.assertEquals(
			["Bin\\UseExportHdr.exe", "Obj\\Src\\main.o", "Outer\\ExportHdr\\SrcMain\\main.o", "Outer\\ExportHdr\\Src\\ExportHello.o"],
			objPaths
			)
Пример #4
0
	def testProxyStatlibEquilibristic(self):
		project = TestEasyExamples.build_dependproxy_prj.getProject()
		project.findSources()
		tmpDir = tempfile.mkdtemp()
		from wudoo.compile.cpp.Front import wdefaultBuild, setupPathsFromRoot  
		def setupTmpdirCallback(compilation, project):
			setupPathsFromRoot(compilation, project, tmpDir)
		wdefaultBuild(project, setupTmpdirCallback)
	
		project = CPPProject("Prj", tmpDir, tmpDir)
		project.addSrcFolders("\n".join(os.listdir(tmpDir)))
		project.setSourceFilter(ExtensionBasedFilter({"o": "o", "exe": "exe"}));
		project.findSources()
		objItems = project.getSourceItems()
		objPaths = [io.getPathNameExt(1) for io in objItems]
		objPaths.sort()
		self.assertEquals(["Bin\\UseExportHdr-dependProxy.exe", "Obj\\CM\\sub-missions\\sub-src\\proxy\\main.o", "Outer\\ExportHdr\\SrcMain\\main.o", "Outer\\ExportHdr\\Src\\ExportHello.o", "Outer\\SLib-UseExportHdr\\CM\\sub-missions\\sub-src\\slib\\foo.o", "Outer\\SLib-UseExportHdr\\Src\\main.o"], 
			objPaths
			)