Write a Qt pro file (1)
2016-04-10 本文已影响215人
Feel君
Part 1:
QT += qml quick widgets
TEMPLATE = app
# Use Precompiled headers (PCH)
PRECOMPILED_HEADER = Global.h
# HEDDERS FILES
HEADERS += version.h Global.h
# SOURCE FILES
SOURCES += main.cpp
# UI FILES
FORMS +=
# RC FILES
RC_FILE += resource.rc
DISTFILES +=
# include pri
include(core/core.pri)
Part 2:
# COMMON -------------------------------------------------------------------------------------------
#
# 作用
#
# a. 生成一般程序结构: 程序路径为app目录.
# b. qml文件,js文件,以及图片格式文件(jpg\gif\png\svg)自动添加到qrc文件内.
# c. 可控制是否将以上自动文件生成的qrc文件编译链接到目标文件中.
TARGET = $$qtLibraryTarget($$TARGET)
# 自定义程序结构
OUT_PWD = $$PWD/../../app
TEMP_DIR = $$PWD/tmp
DESTDIR = $$OUT_PWD/bin
MOC_DIR += $$TEMP_DIR/moc
UI_DIR += $$TEMP_DIR/ui
# 编译选项
DEFINES +=
CONFIG+=debug_and_release
CONFIG(debug, debug|release) {
# TARGET = $${TARGET}d
OBJECTS_DIR += $$TEMP_DIR/debug/obj
DEFINES += _DEBUG
LIBS += -L$${DESTDIR} -lmetalibd
} else {
# TARGET = $${TARGET}
OBJECTS_DIR += $$TEMP_DIR/release/obj
LIBS += -L$${DESTDIR} -lmetalib
}
# \end COMMON -------------------------------------------------------------------------------------------