Commits

Dimitar Trendafilov  committed d5f3785 Merge

* merged with upstream

  • Participants
  • Parent commits c2a966a, afed351

Comments (0)

Files changed (7)

File src/actions/make/make_cpp.lua

 
 	function cpp.flags(cfg, toolset)
 		_p('  DEFINES   += %s', table.concat(toolset.getdefines(cfg.defines), " "))
-		_p('  INCLUDES  += %s', table.concat(make.esc(toolset.getincludedirs(cfg, cfg.includedirs), " ")))
+		_p('  INCLUDES  += %s', table.concat(toolset.getincludedirs(cfg, cfg.includedirs), " "))
 		_p('  CPPFLAGS  += %s $(DEFINES) $(INCLUDES)', table.concat(toolset.getcppflags(cfg), " "))
 		_p('  CFLAGS    += $(CPPFLAGS) $(ARCH) %s', table.concat(table.join(toolset.getcflags(cfg), cfg.buildoptions), " "))
 		_p('  CXXFLAGS  += $(CFLAGS) %s', table.concat(toolset.getcxxflags(cfg), " "))

File src/actions/make/make_solution.lua

 		for prj in solution.eachproject_ng(sln) do
 			local slnpath = solution.getlocation(sln)
 			local prjpath = path.getrelative(slnpath, project.getlocation(prj))
-			_p(1,'@${MAKE} --no-print-directory -C %s -f %s clean', make.esc(prjpath), make.esc(make.getmakefilename(prj, true)))
+			if prj.external then
+				_p(1, string.format(prj.cleancmd, prj.name, prj.externalname))
+			else
+				_p(1,'@${MAKE} --no-print-directory -C %s -f %s clean', make.esc(prjpath), make.esc(make.getmakefilename(prj, true)))
+			end
 		end
 		_p('')
 	end
 			local slnpath = solution.getlocation(sln)
 			local prjpath = path.getrelative(slnpath, project.getlocation(prj))
 			local filename = make.getmakefilename(prj, true)
-			_p(1,'@${MAKE} --no-print-directory -C %s -f %s config=$(%s_config)', make.esc(prjpath), make.esc(filename), cfgvar)
+			if prj.external then
+				_p(1, string.format(prj.buildcmd, cfgvar, prj.externalname))
+			else
+				_p(1,'@${MAKE} --no-print-directory -C %s -f %s config=$(%s_config)', make.esc(prjpath), make.esc(filename), cfgvar)
+			end
 			
 			_p('endif')
 			_p('')

File src/actions/vstudio/vs2010_vcxproj.lua

 				local relpath = path.getrelative(prjpath, vstudio.projectfile_ng(dep))
 				_x(2,'<ProjectReference Include=\"%s\">', path.translate(relpath))
 				_p(3,'<Project>{%s}</Project>', dep.uuid)
+				if dep.externalname then
+					_p(3, '<LinkLibraryDependencies>true</LinkLibraryDependencies>')
+				end
 				_p(2,'</ProjectReference>')
 			end
 			_p(1,'</ItemGroup>')

File src/base/api.lua

 	}
 
 	api.register {
+		name = "buildcmd",
+		scope = "project",
+		kind = "string"
+	}
+
+	api.register {
+		name = "cleancmd",
+		scope = "project",
+		kind = "string"
+	}
+
+	api.register {
 		name = "configmap",
 		scope = "project",
 		kind = "key-array"
 		
 		-- then mark it as external
 		prj.external = true;
-		prj.externalname = prj.name
+		prj.externalname = path.getname(name)
 		
 		return prj
 	end

File src/base/project.lua

 	function premake.findproject(name)
 		for sln in premake.solution.each() do
 			for prj in premake.solution.eachproject(sln) do
-				if (prj.name == name) then
+				local projectname = prj.externalname or prj.name
+				if (projectname == name) then
 					return  prj
 				end
 			end
 --
 
 	function premake.project.getfilename(prj, pattern)
-		local fname = pattern:gsub("%%%%", prj.externalname or prj.name)
+		local fname = pattern:gsub("%%%%", prj.name)
 		fname = path.join(premake5.project.getlocation(prj), fname)
 		return path.getrelative(os.getcwd(), fname)
 	end

File src/base/solution.lua

 	function solution.findproject(sln, name)
 		name = name:lower()
 		for _, prj in ipairs(sln.projects) do
-			if name == prj.name:lower() then
+			local projectname = prj.externalname or prj.name
+			if name == projectname:lower() then
 				return prj
 			end
 		end

File src/tools/gcc.lua

 					else
 						table.insert(result, "-l" .. link.linktarget.basename)
 					end
+				else
+					table.insert(result, "-l" .. link.project.externalname)	
 				end
 			end
 		end