Where is compiler optimization turned off/on?
-
wrote on 18 Mar 2011, 09:01 last edited by
Play with them for Qt libraries or for your libraries?
For Qt build, they are set in $(QTDIR)\mkspecs<your compiler>\qmake.conf
-
wrote on 18 Mar 2011, 09:11 last edited by
Check the qmake Variable Reference documentation, and look for the entry on QMAKE_CXXFLAGS.
-
wrote on 18 Mar 2011, 09:49 last edited by
[quote author="Andre" date="1300439484"]Check the qmake Variable Reference documentation, and look for the entry on QMAKE_CXXFLAGS.[/quote]
This is only valid, if you want to play with optimization in your executable. And then you have to take care, that they fit to Qt binaries.
-
wrote on 18 Mar 2011, 12:58 last edited by
[quote author="Gerolf" date="1300438870"]Play with them for Qt libraries or for your libraries?
For Qt build, they are set in $(QTDIR)\mkspecs<your compiler>\qmake.conf[/quote]
Thanks, Gerolf. This would be for my own programs; I'm not trying to change any Qt code.
Since you pointed me to a file, do I gather correctly that changing these values is done directly with file manipulation, and not via a Qt interface?
-
wrote on 18 Mar 2011, 13:02 last edited by
yes, but manipulating these files is for tunig Qt itself, not your binaries.
To tune yout binaries, look at Andre's post.
You ahve to deal with qmake project files. -
wrote on 18 Mar 2011, 13:07 last edited by
OK, I'll dig up the documentation and take a look. Thanks, Gerolf.
EDIT:
You know, it just occurred to me that I probably should have asked this question differently -- are the optimization options something that typically cause issues for "ordinary" developers?
-
wrote on 18 Mar 2011, 17:24 last edited by
The default optimization settings for the release target are usually sufficient. I would not bother fiddling around with them unless you are doing some really heavy number crunching or multimedia decoding or the like.
-
wrote on 18 Mar 2011, 17:56 last edited by
Oh, I'm sure they're fine for the release build. I was more thinking about whether optimization is fully disabled for debug builds. I was having some weird stuff happen, and thought it was worth a look to make sure that optimization was off for debug.
Thanks...
-
wrote on 19 Mar 2011, 18:38 last edited by
"-O2" only appears in the the QMAKE_CFLAGS_RELEASE and QMAKE_CXXFLAGS_RELEASE config variables.
So, from a short look, optimization should be off in all debug settings.
-
wrote on 19 Mar 2011, 22:16 last edited by
Thanks, Volker. I'm sure the weirdness I was seeing was cockpit error, then.
-
wrote on 19 Mar 2011, 22:29 last edited by
The default debug flags are simply "-g" which is set for QMAKE_CFLAGS_DEBUG and QMAKE_CXXFLAGS_DEBUG.
11/12