Commits

Dimitar Trendafilov committed afed351

* added support for custom commands for building and cleaning external projects

Comments (0)

Files changed (2)

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('')
 	}
 
 	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