tags:

views:

498

answers:

2

I installed Qt for Mac, and am compiling my Qt project after adding in the .Pro file

CONFIG(release, debug|release):QMAKE_CXXFLAGS += -O3 -fomit-frame-pointer

to optimize for speed.

However, I always see that the command where g++ is ran, includes -Os, which optimizes for size. I would like to remove it.

I tried several approaches, like

CONFIG(release, debug|release):QMAKE_CFLAGS_RELEASE -= -Os
CONFIG(release, debug|release):QMAKE_CXXFLAGS -= -Os

and

CONFIG(release, debug|release):QMAKE_CXXFLAGS = -O3 -fomit-frame-pointer
CONFIG(release, debug|release):QMAKE_CFLAGS_RELEASE = -O3 -fomit-frame-pointer
(no +)

But nothing. -Os ALWAYS appear.

How do I change this?

I found the qmake.conf file under /usr/local/QT4.5/mkspecs. It includes a mac-g++.conf file, but I cannot change it, and chmod doesn't work: chmod: mac-g++.conf: Operation not permitted

Any ideas?

A: 

You should run qmake command in your project directory after you edited the .pro file.

Pavel Shved
thanks Pavel! actually QT Creator runs QMake automatically when i change the pro file. do i need to run it manually (I dont see the difference)?do such changes work for you?I could change the Makefile manually but it would require a manual step every time... thanks again,Lior
Lior
@Lior: I was actually just trying to guess what could help you, I don't even own a mac nor use a qt creator. Try to run qmake manually and if it yields the makefile with the correct flags, maybe, you should not edit the .pro file either. Instead, you should try to edit CFLAGS inside som king of "Project options" windows in Qt Creator.
Pavel Shved
A: 

The chmod command is failing because that directory is owned by root (i.e., not your user).

You could handle that with:

sudo chmod ....

I guess my big question is whether you know that -O3 really optimizes for speed or not. As Pavel indicated, you can edit the Makefile and build manually and test. My guess is that -O3 won't make much of a difference and might be slightly worse.

As far as setting CXXFLAGS in Qt Creator, your best bet is to override the call to Make. In the "Projects" section, go to "Build Steps" and "Make" and add CXXFLAGS='-O3 -fomit-frame-pointer' to the "Make arguments" section.

Hope that helps!

Geoff Hutchison