Link time optimization flag not working for Visual Studio?

I am trying to disable link time optimization for the release build in Projucer for Visual Studio in an audio plugin project but that doesn’t appear to be set in the generated Visual Studio project. Bug or user error?

depends on compiler, I believe. Disabling Link Time Optimization when using the Intel C++ compiler on Visual Studio 2015 does not actually disable my link time optimization. If I’m compiling with the native Visual C++ compiler, the link time optimization does in fact disable accordingly.

With a current project, I cannot compile the PROJECT_SharedCode binary with Intel C++ compiler as it bloats the .lib object to 3GB.

I am using Visual Studio 2017 version 15.5.0 preview 3 here.

I can obviously manually set the whole program optimization/link time code generation off, but it’s royally annoying to do each time I’ve saved the project with Projucer, since the audio plugin solutions have the 3 separate projects etc…

sounds like a bug!

Yep, it was a bug in the Projucer. This should be fixed on the develop brach shortly.

1 Like

I am guessing optimization was disabled by default, previously? I noticed my release build going way up but haven’t linked (no pun intended) it to link-time optimization before. (at the same time I upgraded my project to latest JUCE, I had added a bunch of static libraries for a dependency and I thought that was messing up with the build).

Yes. LTO can be very expensive.

1 Like

@t0m is it worth it in your experience?
Please feel free to send me to read something if you have a link to share. Thanks.

Unfortunately it depends on the structure of your app. If the linking between separate compilation units is low then it shouldn’t have much of an effect (this is one of the reasons that JUCE modules #include multiple .cpp files into one place - you get most of the benefits of LTO at a fraction of the cost).

To get a definitive answer you’ll have to measure.

1 Like

Makes sense. Thanks.