mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
191 lines
7.5 KiB
Plaintext
191 lines
7.5 KiB
Plaintext
|
#---------------------------------------------------------------------------------
|
|||
|
#app_base_manager.pri
|
|||
|
#应用程序和Library的基础管理器,统一使用这个管理器。
|
|||
|
#
|
|||
|
#---------------------------------------------------------------------------------
|
|||
|
|
|||
|
################################################################################
|
|||
|
#包含这个pri依赖的pri
|
|||
|
################################################################################
|
|||
|
include ($${PWD}/add_platform.pri)
|
|||
|
include ($${PWD}/add_function.pri)
|
|||
|
|
|||
|
################################################################################
|
|||
|
#多链接技术入口
|
|||
|
################################################################################
|
|||
|
include($${PWD}/add_multi_link_technology.pri)
|
|||
|
|
|||
|
################################################################################
|
|||
|
#这里的pri提供multi link的全部函数
|
|||
|
################################################################################
|
|||
|
#公共的基础header.pri
|
|||
|
include ($${PWD}/add_base_header.pri)
|
|||
|
|
|||
|
#app发布所需要的函数
|
|||
|
include ($${PWD}/add_deploy.pri)
|
|||
|
|
|||
|
#app发布配置项需要的函数
|
|||
|
include ($${PWD}/add_deploy_config.pri)
|
|||
|
|
|||
|
#链接lib所需要的函数 包含lib头文件所需要的函数 设置lib宏所需要的函数
|
|||
|
include ($${PWD}/add_library.pri)
|
|||
|
|
|||
|
#program version
|
|||
|
include ($${PWD}/add_version.pri)
|
|||
|
|
|||
|
#lib发布sdk所需要的函数
|
|||
|
include ($${PWD}/add_sdk.pri)
|
|||
|
|
|||
|
####################################################################################
|
|||
|
#base manager 都做了一下这些事情
|
|||
|
####################################################################################
|
|||
|
|
|||
|
#################################################################
|
|||
|
##definition and configration
|
|||
|
##need QSYS
|
|||
|
#################################################################
|
|||
|
##Qt version
|
|||
|
QT += core sql network gui xml
|
|||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
|||
|
|
|||
|
# release open debug output
|
|||
|
CONFIG(debug, debug|release) {
|
|||
|
} else {
|
|||
|
DEFINES -= QT_NO_DEBUG_OUTPUT
|
|||
|
}
|
|||
|
|
|||
|
#mingw要加速编译,make -j20,-j参数是最好的解决办法。
|
|||
|
|
|||
|
#close win32 no using fopen_s warning
|
|||
|
win32:DEFINES += _CRT_SECURE_NO_WARNINGS #fopen fopen_s
|
|||
|
|
|||
|
#msvc支持设置
|
|||
|
msvc {
|
|||
|
MSVC_CCFLAGS =
|
|||
|
#this three pragma cause mingw errors
|
|||
|
msvc:MSVC_CCFLAGS += /wd"4819" /wd"4244" /wd"4100"
|
|||
|
|
|||
|
#UTF8编码
|
|||
|
DEFINES += __MSVC_UTF8_SUPPORT__
|
|||
|
msvc:MSVC_CCFLAGS += /execution-charset:utf-8
|
|||
|
msvc:MSVC_CCFLAGS += /source-charset:utf-8
|
|||
|
#msvc:MSVC_CCFLAGS += /utf-8 #这一个是快捷方式,顶上边两个。
|
|||
|
|
|||
|
#指定/mp编译选项,编译器将使用并行编译,同时起多个编译进程并行编译不同的cpp
|
|||
|
msvc:MSVC_CCFLAGS += /MP
|
|||
|
#指出:这个FLAG只能用于MSVC
|
|||
|
|
|||
|
msvc:QMAKE_CFLAGS += $${MSVC_CCFLAGS}
|
|||
|
msvc:QMAKE_CXXFLAGS += $${MSVC_CCFLAGS}
|
|||
|
|
|||
|
#指定stable.h这个头文件作为编译预处理文件,MFC里这个文件一般叫stdafx.h 然后在 stable.h里 包含你所用到的所有 Qt 头文件
|
|||
|
#在.pro 文件中加入一行, 加在这里,加速编译。
|
|||
|
#msvc:PRECOMPILED_HEADER = $${PWD}/lib-qt.h
|
|||
|
#指出:precompiler header只能用于MSVC
|
|||
|
#这个功能可用,可是编译问题比较多,不方便,所以默认不开开。
|
|||
|
}
|
|||
|
|
|||
|
#################################################################
|
|||
|
##build lib or link lib
|
|||
|
#################################################################
|
|||
|
##different target:
|
|||
|
##-----------------------------------------------
|
|||
|
##win platform:
|
|||
|
##build lib dll + LIB_LIBRARY
|
|||
|
##build lib lib + LIB_STATIC_LIBRARY
|
|||
|
##link lib lib + LIB_STATIC_LIBRARY
|
|||
|
##link lib dll + ~~
|
|||
|
##- - - - - - - - - - - - - - - - - - - - -
|
|||
|
##*nix platform:
|
|||
|
##build and link lib dll or lib + ~~
|
|||
|
##-----------------------------------------------
|
|||
|
#link Lib static library in some occation on windows
|
|||
|
#when link Lib static library, if no this macro, headers can't be linked on windows.
|
|||
|
#在这里添加了LIB_STATIC_LIBRARY 用户可以使用 还有LIB_LIBRARY
|
|||
|
contains(QSYS_PRIVATE, Win32|Win64 || iOS|iOSSimulator) {
|
|||
|
#Qt is static by mingw32 building
|
|||
|
mingw|ios{
|
|||
|
#on my computer, Qt library are all static library?
|
|||
|
DEFINES += LIB_STATIC_LIBRARY
|
|||
|
message(Build $${TARGET} LIB_STATIC_LIBRARY is defined. build and link)
|
|||
|
}
|
|||
|
|
|||
|
#link and build all need this macro
|
|||
|
contains(DEFINES, LIB_STATIC_LIBRARY) {
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
################################################################
|
|||
|
##build cache (此处为中间目标目录,对用户并不重要)
|
|||
|
##此处加以干涉,使目录清晰。
|
|||
|
##此处关于DESTDIR的设置,导致用户必须把这个文件的包含,提前到最前边的位置,才能进行App里的目录操作。
|
|||
|
##删除干涉?
|
|||
|
##用户注意:(done in app_base_manager), 首先include(app_link_lib_library.pri),然后做app的工作,和include其他pri,包括LibLib提供的其他pri,保证这个顺序就不会出错了。
|
|||
|
##对编译目标目录进行干涉管理,显得更加细腻。
|
|||
|
##用户注意:这里相当于给编译中间目录加了一个自动校准,属于校正范畴。
|
|||
|
################################################################
|
|||
|
isEmpty(OBJECTS_DIR):OBJECTS_DIR = obj
|
|||
|
isEmpty(MOC_DIR):MOC_DIR = obj/moc.cpp
|
|||
|
isEmpty(UI_DIR):UI_DIR = obj/ui.h
|
|||
|
isEmpty(RCC_DIR):RCC_DIR = qrc
|
|||
|
#这样做保持了App工程和LibLib工程中间目录的一致性,但是并不必要。
|
|||
|
isEmpty(DESTDIR):DESTDIR = bin
|
|||
|
|
|||
|
################################################################
|
|||
|
##Lib Functions Macro
|
|||
|
################################################################
|
|||
|
#You need switch these more macro according to your needs when you build this library
|
|||
|
#You can tailor Lib with these macro.
|
|||
|
#Default: macroes is configed, some open, some close, compatibled to special accotation.
|
|||
|
##App希望裁剪LibLib,开关这个文件里的组件宏,用户有必要读懂这个头文件。up to so.
|
|||
|
|
|||
|
##################C++11 Module###############################
|
|||
|
#if you use C++11, open this annotation. suggest: ignore
|
|||
|
#DEFINES += __CPP11__
|
|||
|
contains (DEFINES, __CPP11__) {
|
|||
|
#macOS gcc Qt4.8.7
|
|||
|
#qobject.h fatal error: 'initializer_list' file not found,
|
|||
|
#Qt4.8.7 can't support c++11 features
|
|||
|
#QMAKE_CXXFLAGS += "-std=c++11"
|
|||
|
#QMAKE_CXXFLAGS += "-std=c++0x"
|
|||
|
|
|||
|
#below: gcc version > 4.6.3
|
|||
|
#Open this Config, Why in Qt4 works? see qmake config auto ignored this feature.
|
|||
|
#In Qt5? don't need open this config, qmake auto add c++11 support on linux plat.
|
|||
|
#on windows mingw32? need test
|
|||
|
#CONFIG += c++11
|
|||
|
|
|||
|
#compile period
|
|||
|
#LibLib need c++11 support. Please ensure your compiler version.
|
|||
|
#LibLib used override identifier
|
|||
|
#lambda also need c++11
|
|||
|
}
|
|||
|
|
|||
|
#################################################################
|
|||
|
##library
|
|||
|
##################################################################
|
|||
|
equals (QKIT_PRIVATE, iOSSimulator):{
|
|||
|
#error need
|
|||
|
#QMAKE_CXXFLAGS +=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
|
|||
|
}
|
|||
|
|
|||
|
win32 {
|
|||
|
LIBS += -luser32
|
|||
|
}else: unix {
|
|||
|
equals(QSYS_PRIVATE, macOS) {
|
|||
|
#min macosx target
|
|||
|
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9
|
|||
|
#deperated
|
|||
|
#QMAKE_MAC_SDK=macosx10.12
|
|||
|
#MACOSXSDK = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$${QMAKE_MACOSX_DEPLOYMENT_TARGET}.sdk
|
|||
|
#QMAKE_LIBDIR = $${MACOSXSDK}
|
|||
|
#LIBS += -F$${MACOSXSDK}/System/Library/Frameworks
|
|||
|
#LIBS += -L$${MACOSXSDK}/usr/lib
|
|||
|
LIBS += -framework DiskArbitration -framework Cocoa -framework IOKit
|
|||
|
}else:contains(QSYS_PRIVATE, iOS|iOSSimulator){
|
|||
|
QMAKE_LFLAGS += -ObjC -lsqlite3 -lz
|
|||
|
QMAKE_IOS_DEPLOYMENT_TARGET = 8
|
|||
|
}
|
|||
|
}
|
|||
|
|