Where is compiler optimization turned off/on?



  • I might want to play with this; can someone tell me where in the preferences I can find it?

    Thanks.



  • Play with them for Qt libraries or for your libraries?

    For Qt build, they are set in $(QTDIR)\mkspecs<your compiler>\qmake.conf



  • Check the qmake Variable Reference documentation, and look for the entry on QMAKE_CXXFLAGS.



  • [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.



  • [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?



  • 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.



  • 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?



  • 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.



  • 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...



  • "-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.



  • Thanks, Volker. I'm sure the weirdness I was seeing was cockpit error, then.



  • The default debug flags are simply "-g" which is set for QMAKE_CFLAGS_DEBUG and QMAKE_CXXFLAGS_DEBUG.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.