qsint QMake 脚本结构说明 - huxianhua/QT_Study GitHub Wiki
qsint 编译脚本结构
目录结构
- qsint
- src
- src.pro
- Charts
- Core
Charts
src.pro
# 生成方式 [app,lib,vcapp,vclib,subdirs]
TEMPLATE = subdirs
# 顺序进行目录编译(禁用了多核构建)
CONFIG += ordered
SUBDIRS += Core Charts
解决多核构建
TEMPLATE = subdirs
SUBDIRS = src plugins tests docs
# plugins 依赖 src
plugins.depends = src
# test 依赖 src
tests.depends = src plugins
TEMPLATE = subdirs
src_lib.subdir = src/lib
src_lib.target = sub-src-lib
src_plugins.subdir = src/plugins
src_plugins.target = sub-plugins
src_plugins.depends = sub-src-lib
SUBDIRS = src_lib src_plugins
Core.pro
include (Core.pri)
include (../src.pri)
HEADERS += *.h
SOURCES += *.cpp
INCLUDEPATH += ./ ./actionpanel
RESOURCES += \
actionpanel/schemes.qrc \
res/CommonIcons.qrc
Core.pri
- 设置库名,与 release,debug, 库名 + d, 需要包含的 QT 类
CONFIG(release,debug|release){
LIBNAME = QSCore
}
CONFIG(debug,debug|release){
LIBNAME = QSCored
}
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
src.pri
- 此文件 Charts 与 Core 都有用到,公用的 pri,
- 设置生成 lib, QT程序,静态库,目标名,生成目录
# PRO 文件说明
## 生成库
TEMPLATE = lib
# 设置是 QT 程序,[编译器标志,连接库选项]
# [release,debug,warn_on,warn_off]
# [qt,thread,x11,windows,console,dll,staticlib,plugin]
# 如:CONFIG += qt debug,使用qt库的应用程序,debug版本
CONFIG += QT
## 生成静态库
CONFIG += staticlib
## 包括文件
include(../qsint.pri)
## 生成的库名
TARGET = $$LIBNAME
## 生成的目录
DESTDIR = $$OUT_PWD/../../lib
qsint.pri
- 此文件 Charts 与 Core 都有用到,设置 UI_DIR 与 库后缀
CONFIG(release,debug|release){
# ui文件转换的路径
UI_DIR = release
}
CONFIG(debug,debug|release){
# ui文件转换的路径
UI_DIR = debug
}
win32 {
LIB_SUFFIX = lib
}
unix {
LIB_SUFFIX = so
}