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:
parent
ac8d017332
commit
c2a22602c0
@ -88,6 +88,7 @@
|
||||
"NoExceptions",
|
||||
"NoFramePointer",
|
||||
"NoImportLib",
|
||||
"NoIncrementalLink",
|
||||
"NoManifest",
|
||||
"NoMinimalRebuild",
|
||||
"NoNativeWChar",
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user