added a buildinput command to add additional input dependencies to custom build commands.

This commit is contained in:
Damien Courtois 2014-09-25 10:41:27 +02:00
parent ee305d4ff1
commit 4e7dc976ba
3 changed files with 34 additions and 0 deletions

View File

@ -114,6 +114,13 @@
tokens = true,
}
api.register {
name = "buildinputs",
scope = "config",
kind = "list:path",
tokens = true,
}
api.register {
name = "buildrule", -- DEPRECATED
scope = "config",

View File

@ -656,6 +656,11 @@
if filecfg.buildmessage then
m.element("Message", condition, '%s', filecfg.buildmessage)
end
if filecfg.buildinputs and #filecfg.buildinputs > 0 then
local inputs = project.getrelative(prj, filecfg.buildinputs)
m.element("AdditionalInputs", condition, '%s', table.concat(inputs, " "))
end
end
end

View File

@ -115,6 +115,28 @@
]]
end
function suite.customBuild_onBuildRuleWithAdditionalInputs()
files { "hello.cg" }
filter "files:**.cg"
buildcommands { "cgc $(InputFile)" }
buildoutputs { "$(InputName).obj" }
buildinputs { "common.cg.inc" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="hello.cg">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InputName).obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">common.cg.inc</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cgc $(InputFile)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InputName).obj</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">common.cg.inc</AdditionalInputs>
</CustomBuild>
</ItemGroup>
]]
end
--
-- If a PCH source is specified, ensure it is included in the file configuration.