Merge pull request #135 from rhuvendiek/master

Add midl compiler tags to Visual Studio vxproj files
This commit is contained in:
starkos 2015-07-01 14:11:54 -04:00
commit 9a64c379cd
3 changed files with 51 additions and 1 deletions

View File

@ -583,7 +583,8 @@
"none",
"resourceCompile",
"customBuild",
"customRule"
"customRule",
"midlCompile"
}
m.elements.files = function(prj, groups)
@ -779,6 +780,35 @@
end
end
function m.midlCompileFiles(prj, groups)
local files = groups.MidlCompile or {}
if #files > 0 then
p.push('<ItemGroup>')
for i, file in ipairs(files) do
local contents = p.capture(function ()
p.push()
for cfg in project.eachconfig(prj) do
local condition = m.condition(cfg)
local filecfg = fileconfig.getconfig(file, cfg)
if cfg.system == premake.WINDOWS then
m.excludedFromBuild(cfg, filecfg)
end
end
p.pop()
end)
if #contents > 0 then
p.push('<Midl Include=\"%s\">', path.translate(file.relpath))
p.outln(contents)
p.pop('</Midl>')
else
p.x('<Midl Include=\"%s\" />', path.translate(file.relpath))
end
end
p.pop('</ItemGroup>')
end
end
function m.categorize(prj, file)
-- If any configuration for this file uses a custom build step,
@ -803,6 +833,8 @@
return "ClInclude"
elseif path.isresourcefile(file.name) then
return "ResourceCompile"
elseif path.isidlfile(file.name) then
return "MidlCompile"
else
return "None"
end

View File

@ -197,6 +197,14 @@
return path.hasextension(fname, ".rc")
end
--
-- Returns true if the filename represents a Windows idl file.
--
function path.isidlfile(fname)
return path.hasextension(fname, ".idl")
end
--
-- Takes a path which is relative to one location and makes it relative

View File

@ -68,6 +68,16 @@
]]
end
function suite.midlCompile_onIDLFile()
files { "idl/interfaces.idl" }
prepare()
test.capture [[
<ItemGroup>
<Midl Include="idl\interfaces.idl" />
</ItemGroup>
]]
end
function suite.none_onTxtFile()
files { "docs/hello.txt" }
prepare()