added support for additional manifest files to vs201x actions

This commit is contained in:
dcourtois 2013-09-06 17:32:06 +02:00
parent bb18026fcc
commit 36d62865b1
3 changed files with 83 additions and 0 deletions

View File

@ -245,6 +245,7 @@
"clCompile",
"resourceCompile",
"link",
"manifest",
"buildEvents",
"imageXex",
"deploy",
@ -366,6 +367,33 @@
end
--
-- Write the manifest section.
--
function vc2010.manifest(cfg)
if cfg.kind == premake.STATICLIB then
return
end
local manifests = {}
for _, fname in ipairs(cfg.files) do
if path.getextension(fname) == ".manifest" then
table.insert(manifests, project.getrelative(cfg.project, fname))
end
end
-- when a project is not using manifest files, visual studio doesn't write the section.
if #manifests == 0 then
return
end
_p(2,'<Manifest>')
_x(3,'<AdditionalManifestFiles>%s %%(AdditionalManifestFiles)</AdditionalManifestFiles>', table.concat(manifests, " "))
_p(2,'</Manifest>')
end
--
-- Write out the pre- and post-build event settings.
--

View File

@ -0,0 +1,54 @@
--
-- tests/actions/vstudio/vc2010/test_manifest.lua
-- Validate generation of Manifest block in Visual Studio 201x C/C++ projects.
-- Copyright (c) 2090-2012 Jason Perkins and the Premake project
--
local suite = test.declare("vs2010_manifest")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
--
-- Setup
--
local sln, prj, cfg
function suite.setup()
_ACTION = "vs2010"
sln, prj = test.createsolution()
kind "ConsoleApp"
end
local function prepare(platform)
cfg = project.getconfig(prj, "Debug", platform)
vc2010.manifest(cfg)
end
--
-- Check the basic element structure with default settings.
--
function suite.defaultSettings()
files { "source/test.manifest" }
prepare()
test.capture [[
<Manifest>
<AdditionalManifestFiles>source/test.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
]]
end
--
-- Check that there is no manifest when using static lib
--
function suite.staticLib()
kind "StaticLib"
files { "test.manifest" }
prepare()
test.capture [[
]]
end

View File

@ -141,6 +141,7 @@
dofile("actions/vstudio/vc2010/test_filters.lua")
dofile("actions/vstudio/vc2010/test_item_def_group.lua")
dofile("actions/vstudio/vc2010/test_link.lua")
dofile("actions/vstudio/vc2010/test_manifest.lua")
dofile("actions/vstudio/vc2010/test_nmake_props.lua")
dofile("actions/vstudio/vc2010/test_output_props.lua")
dofile("actions/vstudio/vc2010/test_project_configs.lua")