confused by difference bewteen setting debug/release in creator build and .pro
I am building a .pro based Qt project using Qt creator. I really like Creator. But I am quite confused by the difference between setting the build in creator to debug/release and doing the same thing in the .pro file.
Ideally I just want to set debug or release builds in creator and not to have to change the .pro file.
If I put this in the .pro file:
Code:
CONFIG = qt warn_on resources uic
TEMPLATE = app
win32 {
QMAKE_CXXFLAGS += -EHsc
debug {
QMAKE_CXXFLAGS += -Gm
}
release {
QMAKE_CXXFLAGS += -Zi -GL
}
}
Then set the creator build to debug, it builds it with release setting (e.g. -O2). The build output is:
qmake.exe" D:\personal\asg\asg.pro -r -spec win32-msvc2010
I also tried:
qmake.exe" D:\personal\asg\asg.pro -r -spec win32-msvc2010 "CONFIG+=debug"
But it didn't seem to make any difference.
I can only seem to get it to do what I want by setting "CONFIG=debug" in both the .pro file and the creator build. This makes changing between debug and release builds tedious.
I have had a look through the qmake and creator documentation, but I couldn't find anything useful. I'm sure there must be a straightforward answer.
Re: confused by difference bewteen setting debug/release in creator build and .pro
Re: confused by difference bewteen setting debug/release in creator build and .pro
That didn't work either.
I added:
-config debug
As additional args for the debug build in creator and left the .pro as:
CONFIG = qt warn_on resources uic
Notice the -O2 flags in the output, so it is still building as release:
14:29:44: Running steps for project asg...
14:29:44: Starting: "C:\Qt\4.8.3\bin\qmake.exe" D:\personal\asg\asg.pro -r -spec win32-msvc2010 -config debug
14:29:44: The process "C:\Qt\4.8.3\bin\qmake.exe" exited normally.
14:29:44: Starting: "C:\Qt\qtcreator-2.5.2\bin\jom.exe"
c:\Qt\4.8.3\bin\uic.exe MainWindow.ui -o ui_MainWindow.h
c:\Qt\4.8.3\bin\uic.exe NewGameDialog.ui -o ui_NewGameDialog.h
cl -c -nologo -Zm200 -Zc:wchar_t- -EHsc -O2 -MD -W3 -w34100 -w34189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"c:\Qt\4.8.3\include\QtCore" -I"c:\Qt\4.8.3\include\QtGui" -I"c:\Qt\4.8.3\include" -I"." -I"c:\Qt\4.8.3\include\ActiveQt" -I"." -I"c:\Qt\4.8.3\mkspecs\win32-msvc2010" -Fo @C:\Users\andyb\AppData\Local\Temp\GameView.obj.60 60.0.jom
Re: confused by difference bewteen setting debug/release in creator build and .pro
I found the answer on Stackoverflow. Looks like the answer is to do this in the .pro file:
Code:
CONFIG -= debug_and_release
CONFIG( debug, debug|release ) {
CONFIG -= release
}
else {
CONFIG -= debug
CONFIG += release
}
This seems to work , but Yuk! Surely there must be a more elegant way?
Re: confused by difference bewteen setting debug/release in creator build and .pro
A more elegant way to do what exactly?
Re: confused by difference bewteen setting debug/release in creator build and .pro
Set CONFIG to 'debug' or 'release' from the Creator IDE, without having to modify the .pro file.
Re: confused by difference bewteen setting debug/release in creator build and .pro
How did the pro file look like initially? I really have no problems in modifying CONFIG when invoking qmake :)
Re: confused by difference bewteen setting debug/release in creator build and .pro
The Release mode enables optimizations and generates without any debug data, so it is fully optimized. . Lots of your code could be completely removed or rewritten in Release mode. The resulting executable will most likely not match up with your written code. Because of this release mode will run faster than debug mode due to the optimizations. More about.....Debug and Release build
Walsh
Re: confused by difference bewteen setting debug/release in creator build and .pro
Quote:
Originally Posted by
AndyBrice
I can only seem to get it to do what I want by setting "CONFIG=debug" in both the .pro file and the creator build. This makes changing between debug and release builds tedious.
Make sure your project is actually setup to use debug settings when you choose the debug build. Go to "Projects" in the left dock, make sure the Debug build configuration is chosen at the top of the screen and that your qmake setting is using CONFIG+=debug using the example below:
qmake qaws.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64
Hope that helps.