Russian Qt Forum

Qt => Установка, сборка, отладка, тестирование => Тема начата: Godfather от Июнь 03, 2008, 12:49



Название: Создание .pro-файла
Отправлено: Godfather от Июнь 03, 2008, 12:49
у меня следующий .pro-файл:
Цитировать
TEMPLATE = app
TARGET = aist

QT += xml sql
QTPLUGIN += qgif qjpeg qgif qmng qtiff qsqlmysql qsqlodbc qsqlite

CONFIG += qt windows debug_and_release buildall

# global.h constants.h
HEADERS += много-много хедеров
SOURCES += много-много исходников
FORMS += много-много форм

INCLUDEPATH += .\GeneratedFiles
INCLUDEPATH += .\lib\zlib\

LIBS += crypt32.lib cryptui.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib

win32:debug {
   CONFIG += debug
   INCLUDEPATH += .\GeneratedFiles\Debug
   DESTDIR = .\Console\Debug
   MOC_DIR = .\GeneratedFiles\Debug
   OBJECTS_DIR = .\Console\Debug
   LIBS += QtMaind.lib QtCored4.lib QtGuid4.lib QtSqld4.lib QtXmld4.lib
   QMAKE_CXXFLAGS += /Fd".\Console\Debug\vc90.pdb" /GS-
   QMAKE_LFLAGS += /DEBUG
   DEFINES += _DEBUG
   
   LIBS += .\Debug\zlib.lib
}

win32:release {
   CONFIG += release precompile_header
   INCLUDEPATH += .\GeneratedFiles\Release
   DESTDIR = .\Console\Release
   MOC_DIR = .\GeneratedFiles\Release
   OBJECTS_DIR = .\Console\Release
   LIBS += QtMain.lib QtCore4.lib QtGui4.lib QtSql4.lib QtXml4.lib
   QMAKE_CXXFLAGS += /Fd".\Console\Release\vc90.pdb" /GS-
   DEFINES += _RELEASE NDEBUG
   
   LIBS += .\Release\zlib.lib
}

UI_HEADERS_DIR = .\GeneratedFiles

RCC_DIR = .\GeneratedFiles .\Resources
почему когда я запускаю qmake создается Makefile которые игнорируют debug- и release-scope

т.е. Makefile.Debug содержит строки типа
Цитировать
DEFINES       = -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -D_DEBUG -D_RELEASE -DNDEBUG
CXXFLAGS      = /Fd.\Console\Debug\vc90.pdb /Fd.\Console\Release\vc90.pdb
получается что вобе конфигурации содержат и те и те настройки :(

я же хочу что бы debug собрался в .\Console\Debug, release в .\Console\Release

VS 2008
Qt 4.3.5


Название: Re: Создание .pro-файла
Отправлено: Alex03 от Июнь 03, 2008, 13:20
это?
Код:
CONFIG += debug_and_release

 CONFIG(debug, debug|release) {
     TARGET = debug_binary
 } else {
     TARGET = release_binary
 }


Название: Re: Создание .pro-файла
Отправлено: Godfather от Июнь 03, 2008, 13:35
о! премного благодарен!!

а скажи пожалуйста чем отличается CONFIG(debug, debug|release) { } от просто CONFIG(debug) { } ?


Название: Re: Создание .pro-файла
Отправлено: Alex03 от Июнь 04, 2008, 05:58
Я лишь скопировал текст с ассистента... Второй параметр не обязателен, служит для определения одного из взаимно исключающих наборов...

Цитировать
CONFIG(config)

[Conditional]

This function can be used to test for variables placed into the CONFIG variable. This is the same as regular old style (tmake) scopes, but has the added advantage a second parameter can be passed to test for the active config. As the order of values is important in CONFIG variables (i.e. the last one set will be considered the active config for mutually exclusive values) a second parameter can be used to specify a set of values to consider. For example:
Код:
  CONFIG = debug
  CONFIG += release
  CONFIG(release, debug|release):message(Release build!) #will print
  CONFIG(debug, debug|release):message(Debug build!) #no print
Because release is considered the active setting (for feature parsing) it will be the CONFIG used to generate the build file. In the common case a second parameter is not needed, but for specific mutual exclusive tests it is invaluable.

Т.е. я бы туда ещё добавил строчки для полной ясности :)
Код:
  CONFIG(release):message(Release build!) #will print
  CONFIG(debug):message(Debug build!) #will print

PS Читайте ассистент, там многое есть. :)