2009-03-25 23:04:32 +00:00
|
|
|
--
|
|
|
|
-- vs2005_csproj_user.lua
|
|
|
|
-- Generate a Visual Studio 2005/2008 C# .user file.
|
2015-03-11 19:52:51 +00:00
|
|
|
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
|
2009-03-25 23:04:32 +00:00
|
|
|
--
|
|
|
|
|
2014-02-08 15:44:57 +00:00
|
|
|
local p = premake
|
2015-03-11 19:52:51 +00:00
|
|
|
local m = p.vstudio.cs2005
|
2011-02-02 18:27:52 +00:00
|
|
|
|
|
|
|
|
2012-01-12 21:59:15 +00:00
|
|
|
--
|
2015-03-11 19:52:51 +00:00
|
|
|
-- Generate a Visual Studio 200x C# user file.
|
2012-01-12 21:59:15 +00:00
|
|
|
--
|
2013-05-22 15:15:48 +00:00
|
|
|
|
2015-03-11 20:11:09 +00:00
|
|
|
m.elements.userProjectPropertyGroup = function()
|
|
|
|
return {
|
|
|
|
m.referencePath,
|
|
|
|
}
|
|
|
|
end
|
2013-05-22 15:15:48 +00:00
|
|
|
|
2015-03-11 20:11:09 +00:00
|
|
|
m.elements.userConfigPropertyGroup = function()
|
|
|
|
return {
|
|
|
|
m.localDebuggerCommandArguments,
|
|
|
|
}
|
|
|
|
end
|
2013-05-22 15:15:48 +00:00
|
|
|
|
2015-03-11 20:11:09 +00:00
|
|
|
function m.generateUser(prj)
|
|
|
|
-- Only want output if there is something to configure
|
|
|
|
local prjGroup = p.capture(function()
|
|
|
|
p.push(2)
|
|
|
|
p.callArray(m.elements.userProjectPropertyGroup, prj)
|
|
|
|
p.pop(2)
|
|
|
|
end)
|
2013-05-22 15:15:48 +00:00
|
|
|
|
2015-03-11 20:11:09 +00:00
|
|
|
local contents = {}
|
|
|
|
local size = 0
|
2015-01-02 22:26:13 +00:00
|
|
|
|
2015-03-11 19:52:51 +00:00
|
|
|
for cfg in p.project.eachconfig(prj) do
|
2015-03-11 20:11:09 +00:00
|
|
|
contents[cfg] = p.capture(function()
|
|
|
|
p.push(2)
|
|
|
|
p.callArray(m.elements.userConfigPropertyGroup, cfg)
|
|
|
|
p.pop(2)
|
2015-01-26 22:04:29 +00:00
|
|
|
end)
|
2015-03-11 20:11:09 +00:00
|
|
|
size = size + #contents[cfg]
|
|
|
|
end
|
2015-01-26 22:04:29 +00:00
|
|
|
|
2015-03-11 20:11:09 +00:00
|
|
|
if #prjGroup > 0 or size > 0 then
|
|
|
|
p.vstudio.projectElement()
|
|
|
|
|
|
|
|
if #prjGroup > 0 then
|
|
|
|
p.push('<PropertyGroup>')
|
|
|
|
p.outln(prjGroup)
|
2015-03-11 19:52:51 +00:00
|
|
|
p.pop('</PropertyGroup>')
|
2015-01-26 22:04:29 +00:00
|
|
|
end
|
2015-01-02 22:26:13 +00:00
|
|
|
|
2015-03-11 20:11:09 +00:00
|
|
|
for cfg in p.project.eachconfig(prj) do
|
|
|
|
if #contents[cfg] > 0 then
|
|
|
|
p.push('<PropertyGroup %s>', m.condition(cfg))
|
|
|
|
p.outln(contents[cfg])
|
|
|
|
p.pop('</PropertyGroup>')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-03-12 15:26:29 +00:00
|
|
|
p.pop('</Project>')
|
2015-03-11 20:11:09 +00:00
|
|
|
end
|
2012-01-12 21:59:15 +00:00
|
|
|
end
|
2015-01-26 22:04:29 +00:00
|
|
|
|
2015-03-11 19:52:51 +00:00
|
|
|
|
|
|
|
|
2015-03-11 20:11:09 +00:00
|
|
|
---
|
|
|
|
-- Output any reference paths required by the project.
|
|
|
|
---
|
|
|
|
|
|
|
|
function m.referencePath(prj)
|
|
|
|
-- Per-configuration reference paths aren't supported (are they?) so just
|
|
|
|
-- use the first configuration in the project
|
|
|
|
local cfg = p.project.getfirstconfig(prj)
|
|
|
|
local paths = path.translate(p.project.getrelative(prj, cfg.libdirs))
|
|
|
|
if #paths > 0 then
|
|
|
|
p.w('<ReferencePath>%s</ReferencePath>', table.concat(paths, ";"))
|
|
|
|
end
|
2015-01-02 22:26:13 +00:00
|
|
|
end
|
|
|
|
|
2015-03-11 20:11:09 +00:00
|
|
|
|
|
|
|
|
2015-03-11 19:52:51 +00:00
|
|
|
function m.localDebuggerCommandArguments(cfg)
|
2015-01-02 22:26:13 +00:00
|
|
|
if #cfg.debugargs > 0 then
|
2015-03-11 19:52:51 +00:00
|
|
|
p.x('<StartArguments>%s</StartArguments>', table.concat(cfg.debugargs, " "))
|
2015-01-02 22:26:13 +00:00
|
|
|
end
|
|
|
|
end
|