PDA

View Full Version : Qt Project How to ?



sunil.thaha
1st February 2007, 13:25
Could someone help me write a .pro file that by default compiles in both release and debug mode. In release mode. I don't want the debug message from qDebug() to get printed

I tried some thing like this. But to no avail



TEMPLATE = app
TARGET = Driver

DESTDIR = ../Bin

CONFIG += qt \
plugin \
warn_on \
debug_and_release \
build_all

UI_DIR = Build/Ui
MOC_DIR = Build/Moc
OBJECTS_DIR = Build/Obj

CONFIG( debug, debug|release ) {
CONFIG += console #show console in Windows platform
CONFIG -= app_bundle #console in MAC also
unix: TARGET = $$join( TARGET,,,_debug)
else: TARGET = $$join( TARGET,,d)
}

release {
DEFINES += QT_NO_DEBUG_OUTPUT
}
INCLUDEPATH = ../Common/Include \
../Plugins/Include

DEPENDPATH += ../Common/Include \
../Plugins/Include

#HEADERS +=

SOURCES += Src/main.cpp

jacek
1st February 2007, 18:03
Try this:

CONFIG += debug_and_release

CONFIG( release, debug|release ) {
DEFINES += RELEASE
}

CONFIG( debug, debug|release ) {
DEFINES += DEBUG
}

sunil.thaha
2nd February 2007, 06:54
Sorry I did not get you ?

jacek
2nd February 2007, 09:58
If you run qmake on that .pro file, you'll two Makefiles, which look like this:

Makefile.Debug:

...
DEFINES = -DDEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
...

Makefile.Release:

...
DEFINES = -DRELEASE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
...

Now you can replace DEFINES += xxx with whatever you want.

sunil.thaha
9th August 2007, 10:56
with CONFIG += debug_and_release

In Qt 4.1.4 running qmake && make; compiles the project in debug mode
where as in Qt 4.3.0, the Makefile generated runs the Makefile.Release by default, can I force it use the Makefile.debug