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",
|
"NoExceptions",
|
||||||
"NoFramePointer",
|
"NoFramePointer",
|
||||||
"NoImportLib",
|
"NoImportLib",
|
||||||
|
"NoIncrementalLink",
|
||||||
"NoManifest",
|
"NoManifest",
|
||||||
"NoMinimalRebuild",
|
"NoMinimalRebuild",
|
||||||
"NoNativeWChar",
|
"NoNativeWChar",
|
||||||
|
@ -15,7 +15,18 @@
|
|||||||
|
|
||||||
premake.config = { }
|
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.
|
-- Determine if a configuration represents a "debug" or "release" build.
|
||||||
-- This controls the runtime library selected for Visual Studio builds
|
-- This controls the runtime library selected for Visual Studio builds
|
||||||
|
@ -56,3 +56,27 @@
|
|||||||
prepare()
|
prepare()
|
||||||
return test.istrue(premake.config.isdebugbuild(cfg))
|
return test.istrue(premake.config.isdebugbuild(cfg))
|
||||||
end
|
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