From 4e7dc976baabe7f324e65aeb6236d24c56ac084e Mon Sep 17 00:00:00 2001 From: Damien Courtois Date: Thu, 25 Sep 2014 10:41:27 +0200 Subject: [PATCH] added a buildinput command to add additional input dependencies to custom build commands. --- src/_premake_init.lua | 7 +++++++ src/actions/vstudio/vs2010_vcxproj.lua | 5 +++++ tests/actions/vstudio/vc2010/test_files.lua | 22 +++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/src/_premake_init.lua b/src/_premake_init.lua index 75fb6a5d..de6e6858 100644 --- a/src/_premake_init.lua +++ b/src/_premake_init.lua @@ -114,6 +114,13 @@ tokens = true, } + api.register { + name = "buildinputs", + scope = "config", + kind = "list:path", + tokens = true, + } + api.register { name = "buildrule", -- DEPRECATED scope = "config", diff --git a/src/actions/vstudio/vs2010_vcxproj.lua b/src/actions/vstudio/vs2010_vcxproj.lua index 6fa59577..16e468e9 100644 --- a/src/actions/vstudio/vs2010_vcxproj.lua +++ b/src/actions/vstudio/vs2010_vcxproj.lua @@ -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 diff --git a/tests/actions/vstudio/vc2010/test_files.lua b/tests/actions/vstudio/vc2010/test_files.lua index c9ce9bbe..a8aa06f9 100755 --- a/tests/actions/vstudio/vc2010/test_files.lua +++ b/tests/actions/vstudio/vc2010/test_files.lua @@ -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 [[ + + + Document + cgc $(InputFile) + $(InputName).obj + common.cg.inc + cgc $(InputFile) + $(InputName).obj + common.cg.inc + + + ]] + end + -- -- If a PCH source is specified, ensure it is included in the file configuration.