refactors optimise check to function premake.config.isoptimizedbuild(flags) which is not local scope as it can be used in other places

adds function premake.config.should_link_incrementally(cfg)
adds new flag NoIncrementalLink
This commit is contained in:
liamDevine 2010-11-01 22:05:45 +00:00
parent ac8d017332
commit c2a22602c0
3 changed files with 36 additions and 0 deletions

View File

@ -88,6 +88,7 @@
"NoExceptions",
"NoFramePointer",
"NoImportLib",
"NoIncrementalLink",
"NoManifest",
"NoMinimalRebuild",
"NoNativeWChar",

View File

@ -15,7 +15,18 @@
premake.config = { }
function premake.config.isoptimizedbuild(flags)
return flags.Optimize or flags.OptimizeSize or flags.OptimizeSpeed
end
function premake.config.should_link_incrementally(cfg)
if cfg.kind == "StaticLib"
or premake.config.isoptimizedbuild(cfg.flags)
or cfg.flags.NoIncrementalLink then
return false
end
return true
end
--
-- Determine if a configuration represents a "debug" or "release" build.
-- This controls the runtime library selected for Visual Studio builds

View File

@ -56,3 +56,27 @@
prepare()
return test.istrue(premake.config.isdebugbuild(cfg))
end
function suite.shouldIncrementallyLink_staticLib_returnsFalse()
kind "StaticLib"
prepare()
return test.isfalse(premake.config.should_link_incrementally(cfg))
end
function suite.shouldIncrementallyLink_optimizeFlagSet_returnsFalse()
flags { "Optimize" }
prepare()
return test.isfalse(premake.config.should_link_incrementally(cfg))
end
function suite.shouldIncrementallyLink_NoIncrementalLinkFlag_returnsFalse()
flags { "NoIncrementalLink" }
prepare()
return test.isfalse(premake.config.should_link_incrementally(cfg))
end
function suite.shouldIncrementallyLink_notStaticLib_NoIncrementalLinkFlag_noOptimiseFlag_returnsTrue()
prepare()
return test.istrue(premake.config.should_link_incrementally(cfg))
end