Skip to content

Commit

Permalink
Merge pull request #1113 from Blizzard/buildaction_for_cpp
Browse files Browse the repository at this point in the history
Support buildaction for C++ projects
  • Loading branch information
TurkeyMan authored Jun 9, 2018
2 parents f46a27e + 6a78127 commit fddc822
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
24 changes: 24 additions & 0 deletions modules/vstudio/tests/vc2010/test_files.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,30 @@
end


--
-- Check handling of buildaction.
--
function suite.customBuildTool_onBuildAction()
files { "test.x", "test2.cpp", "test3.cpp" }
filter "files:**.x"
buildaction "FxCompile"
filter "files:test2.cpp"
buildaction "None"
prepare()
test.capture [[
<ItemGroup>
<ClCompile Include="test3.cpp" />
</ItemGroup>
<ItemGroup>
<FxCompile Include="test.x" />
</ItemGroup>
<ItemGroup>
<None Include="test2.cpp" />
</ItemGroup>
]]
end


--
-- Check handling of files with custom build rules.
--
Expand Down
14 changes: 10 additions & 4 deletions modules/vstudio/vs2010_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1028,12 +1028,18 @@


function m.categorizeFile(prj, file)
-- If any configuration for this file uses a custom build step,
-- that's the category to use
for cfg in project.eachconfig(prj) do
local fcfg = fileconfig.getconfig(file, cfg)
if fileconfig.hasCustomBuildRule(fcfg) then
return m.categories.CustomBuild
if fcfg then
-- If any configuration for this file uses a custom build step, that's the category to use
if fileconfig.hasCustomBuildRule(fcfg) then
return m.categories.CustomBuild
end

-- also check for buildaction
if fcfg.buildaction then
return m.categories[fcfg.buildaction] or m.categories.None
end
end
end

Expand Down
11 changes: 0 additions & 11 deletions src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,6 @@
name = "buildaction",
scope = "config",
kind = "string",
allowed = {
"Application",
"Compile",
"Component",
"Copy",
"Embed",
"Form",
"None",
"Resource",
"UserControl",
},
}

api.register {
Expand Down

0 comments on commit fddc822

Please sign in to comment.