diff --git a/Core/JSON/jsonProjectHandlers.lua b/Core/JSON/jsonProjectHandlers.lua index 535aa20..19b1cf0 100644 --- a/Core/JSON/jsonProjectHandlers.lua +++ b/Core/JSON/jsonProjectHandlers.lua @@ -456,6 +456,41 @@ local kAllProjectHeaders = "linkDepends", "includeDepends" } +local function auBlockProjectKeyLtoNotMsvc(processor, value) + if (value) then + auFilter{"toolset:clang", "not system:windows"} + --buildoptions "-flto=thin" + --linkoptions "-Wl,-mllvm,-threads=4" + buildoptions "-flto" + linkoptions "-flto" + auFilter{} + end +end + +local function auBlockProjectKeyLtoMsvc(processor, value) + if (value) then + auFilter{"toolset:msc"} + --linkoptions "/LTCG" + flags { "LinkTimeOptimization" } + flags { "NoIncrementalLink" } + buildoptions "/GL" + auFilter{} + end +end + +local function auBlockProjectKeyLtoClang(processor, value) + auBlockProjectKeyLtoNotMsvc(processor, value) +end + +local function auBlockProjectKeyLtoNotClang(processor, value) + auBlockProjectKeyLtoMsvc(processor, value) +end + +local function auBlockProjectKeyLto(processor, value) + auBlockProjectKeyLtoMsvc(processor, value) + auBlockProjectKeyLtoNotMsvc(processor, value) +end + auProjectBlockHandlers = { links = auBlockProjectKeyLinks, @@ -489,7 +524,12 @@ auProjectBlockHandlers = unpack = auBlockProjectKeyUnpack, m4 = auBlockProjectKeyM4, bigObject = auBlockProjectKeyBigObject, - rtti = auBlockProjectKeyRtti + rtti = auBlockProjectKeyRtti, + lto = auBlockProjectKeyLto, + ltoNotMsvc = auBlockProjectKeyLtoNotMsvc, + ltoNotClang = auBlockProjectKeyLtoNotClang, + ltoMsvc = auBlockProjectKeyLtoMsvc, + ltoClang = auBlockProjectKeyLtoClang } auProjectBlockHandlers["soft-depends"] = auBlockProjectKeySoftDepends @@ -520,7 +560,8 @@ kGenericTasks = { "msvcIgnore", "excludes", "depends", "require", "m4", "vala", "eval", "lua", "events", "actions", "staticImpDefines", "features", "links", "soft-depends", "resourceScript", "protobuf", "unpack", - "bigObject", "rtti" + "bigObject", "rtti", "lto", "ltoNotMsvc", "ltoNotClang", "ltoMsvc", + "ltoClang" } local kReferenceTasks = {"eval", "includes", "defines", "include", "includes", "protobuf", "actions"} --, "features"}