Skip to content

Commit

Permalink
add RemoveUnreferencedCodeData option to disable /Zc:inline
Browse files Browse the repository at this point in the history
  • Loading branch information
withmorten committed Apr 5, 2021
1 parent 8e69556 commit 4455e4a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
39 changes: 39 additions & 0 deletions modules/vstudio/tests/vc2010/test_compile_settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,45 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end

--
-- If removeUnreferencedCodeData flag is set, add <RemoveUnreferencedCodeData> element
--

function suite.onRemoveUnreferencedCodeDataOff()
removeunreferencedcodedata "Off"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RemoveUnreferencedCodeData>false</RemoveUnreferencedCodeData>
]]
end

function suite.onRemoveUnreferencedCodeDataOn()
removeunreferencedcodedata "On"
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RemoveUnreferencedCodeData>true</RemoveUnreferencedCodeData>
]]
end

function suite.onRemoveUnreferencedCodeDataNotSpecified()
prepare()
test.capture [[
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
</ClCompile>
]]
end
13 changes: 12 additions & 1 deletion modules/vstudio/vs2010_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@
m.languageStandard,
m.conformanceMode,
m.structMemberAlignment,
m.useFullPaths
m.useFullPaths,
m.removeUnreferencedCodeData
}

if cfg.kind == p.STATICLIB then
Expand Down Expand Up @@ -1515,6 +1516,16 @@
end
end

function m.removeUnreferencedCodeData(cfg)
if cfg.removeUnreferencedCodeData ~= nil then
if cfg.removeUnreferencedCodeData then
m.element("RemoveUnreferencedCodeData", nil, "true")
else
m.element("RemoveUnreferencedCodeData", nil, "false")
end
end
end

function m.additionalCompileOptions(cfg, condition)
local opts = cfg.buildoptions
if _ACTION == "vs2015" or vstudio.isMakefile(cfg) then
Expand Down
6 changes: 6 additions & 0 deletions src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,12 @@
kind = "boolean"
}

api.register {
name = "removeunreferencedcodedata",
scope = "config",
kind = "boolean"
}

api.register {
name = "swiftversion",
scope = "config",
Expand Down

0 comments on commit 4455e4a

Please sign in to comment.