Share my qmake project file
-
I don't like the default pro file. The objects will be in release/debug in windows, but in linux they are in the same dir of source files. With my method, the objects will be output into .obj/_win32 in windows, .obj/_linux in linux and .obj/_linux_arm and so on. Moc generated files will be in .moc/$[QT_VERSION](e.g. .moc/4.7.3), because they does not depends on platform, but the qt version.
here is config.pri
@CONFIG += #ezx#static ezx
CONFIG += profile
#profiling, -pg is not supported for msvc
debug:!msvc:profile {
QMAKE_CXXFLAGS_DEBUG += -pg
QMAKE_LFLAGS_DEBUG += -pg
}#$$[TARGET_PLATFORM]
#$$[QT_ARCH] #windows symbian windowsce arm
PLATFORM_EXT =
ARCH_EXT =
TOOLCHAIN_EXT =
unix {
PLATFORM_EXT = _unix
linux: PLATFORM_EXT = _linux
maemo*: PLATFORM_EXT = _maemo
} else:win32 {
PLATFORM_EXT = _win32
} else:macx {
PLATFORM_EXT = _macx
}ezx {
QT_VERSION = 2.3.8
CONFIG += qt warn_on release
DEFINES += QT_THREAD_SUPPORT CONFIG_EZX
PLATFORM_EXT = _ezx
QMAKE_CXXFLAGS.ARMCC +=
}#arm: ARCH_EXT = $${ARCH_EXT}arm
#isEqual(QT_ARCH, arm) {
contains(QT_ARCH, arm.*) {
ARCH_EXT = $${ARCH_EXT}$${QT_ARCH}
}
*64: ARCH_EXT = $${ARCH_EXT}_x64llvm: TOOLCHAIN_EXT = _llvm
#msvc:DESTDIR = bin
TARGET = $${TARGET}$${PLATFORM_EXT}$${ARCH_EXT}$${TOOLCHAIN_EXT}
OBJECTS_DIR = .obj/$${PLATFORM_EXT}$${ARCH_EXT}$${TOOLCHAIN_EXT}
#for Qt2, Qt3 which does not have QT_VERSION. Qt4: $$[QT_VERSION]
MOC_DIR = .moc/$${QT_VERSION}
RCC_DIR = .rcc/$${QT_VERSION}
UI_DIR = .ui/$${QT_VERSION}@In a pro file, just write a few information and include config.pri, for example
@TEMPLATE = app
TARGET = hello
INCLUDEPATH += src
LIBS +=
TRANSLATIONS+= i18n/hello_zh-cn.ts
FORMS =include(config.pri)@
-
Why don't you just use shadow building?
Just do create a directory "linux" next to the directory holding your sources, change into it and do qmake ../sources/myprofile.pro and you have all your linux stuff nicely separated from the sources. Of course you can have several other build directories in parallel, each with their own settings.