premake-core icon indicating copy to clipboard operation
premake-core copied to clipboard

[Visual Studio] Add /LTCG flag via premake

Open vkduy opened this issue 4 years ago • 1 comments

Discussed in https://github.com/premake/premake-core/discussions/1832

Originally posted by mrgoldengun March 4, 2022 Hello,

I have a question about flags { "LinkTimeOptimization" } When I turned on this flag, the Visual Studio add /GL (Whole Program Optimization) and /LTCG:incremental (Link Time Code Generation). How can I config /GL and /LTCG (without incremental) via premake? AFAIK, It seems we don't have an option to do that in premake.

If I understand correctly, /LTCG is different from /LTCG:incremental https://docs.microsoft.com/en-us/cpp/build/reference/ltcg-link-time-code-generation?view=msvc-170

vkduy avatar Mar 09 '22 02:03 vkduy

a workaround is to remove that flags and add:

buildoptions { "/GL" }
linkoptions { "/LTCG" }

agreppin avatar Mar 11 '22 08:03 agreppin