This repository has been archived on 2022-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
fuck-premake-old2/modules/vstudio/vs2005_csproj_user.lua

90 lines
1.9 KiB
Lua
Raw Normal View History

--
-- 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
--
local p = premake
2015-03-11 19:52:51 +00:00
local m = p.vstudio.cs2005
--
2015-03-11 19:52:51 +00:00
-- Generate a Visual Studio 200x C# user file.
--
m.elements.userProjectPropertyGroup = function()
return {
m.referencePath,
}
end
m.elements.userConfigPropertyGroup = function()
return {
m.localDebuggerCommandArguments,
}
end
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)
local contents = {}
local size = 0
2015-03-11 19:52:51 +00:00
for cfg in p.project.eachconfig(prj) do
contents[cfg] = p.capture(function()
p.push(2)
p.callArray(m.elements.userConfigPropertyGroup, cfg)
p.pop(2)
end)
size = size + #contents[cfg]
end
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>')
end
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
p.pop('</Project>')
end
end
2015-03-11 19:52:51 +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 = p.vstudio.path(prj, cfg.libdirs)
if #paths > 0 then
p.w('<ReferencePath>%s</ReferencePath>', table.concat(paths, ";"))
end
end
2015-03-11 19:52:51 +00:00
function m.localDebuggerCommandArguments(cfg)
if #cfg.debugargs > 0 then
2015-03-11 19:52:51 +00:00
p.x('<StartArguments>%s</StartArguments>', table.concat(cfg.debugargs, " "))
end
end