mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
更新mingw下的编译类型,debug和release区分开
This commit is contained in:
parent
1522cf685d
commit
40ea4cd60a
@ -22,7 +22,8 @@ SUBDIRS =
|
||||
#lessThan(QT_MAJOR_VERSION , 5):SUBDIRS += test/qqtwebclient
|
||||
|
||||
#need OpenCV
|
||||
#SUBDIRS += examples/QQtOpenCVExample
|
||||
#
|
||||
SUBDIRS += examples/QQtOpenCVExample
|
||||
|
||||
#这是一对,用于测试Multi-link对其他的lib的链接能力
|
||||
#SUBDIRS += test/QQtMultiLinkTest
|
||||
|
@ -7,6 +7,7 @@
|
||||
#######################################################################################
|
||||
#初始化设置
|
||||
#######################################################################################
|
||||
#3.4
|
||||
LIBRARYVER =
|
||||
DEBUG = d
|
||||
contains(BUILD, Release) {
|
||||
|
@ -3,11 +3,11 @@
|
||||
##link QQt
|
||||
################################################################
|
||||
#简介
|
||||
#add link library 连接过程 用于源代码编写的时候。包括头文件和添加库
|
||||
#add link library 链接过程 用于源代码编写的时候。包括头文件和添加库
|
||||
#add deploy library 编译过程 用于源代码编译的时候。发布库
|
||||
#add dependent library 包括以上两个过程
|
||||
#一般app才会使用add dependent library, lib使用add link library。
|
||||
#到这里用户必须明白,连接概念到不了app,lib里才有链接概念。
|
||||
#到这里用户必须明白,链接概念到不了app,lib里才有链接概念。
|
||||
#依赖概念才会在app里出现。
|
||||
#这是重点。
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#######################################################################################
|
||||
#初始化设置
|
||||
#######################################################################################
|
||||
#1.1.0
|
||||
LIBRARYVER =
|
||||
DEBUG = d
|
||||
#这个地方,mingw比较特殊必须发布release版本,其他平台不清楚。
|
||||
|
@ -12,9 +12,9 @@ MainWindow::MainWindow ( QWidget* parent ) :
|
||||
// read an image
|
||||
cv::Mat image = cv::imread ( "./tt.png", 1 );
|
||||
// create image window named "My Image"
|
||||
cv::namedWindow ( "My Image" );
|
||||
cv::namedWindow ( "OpenCV Image" );
|
||||
// show the image on window
|
||||
cv::imshow ( "My Image", image );
|
||||
cv::imshow ( "OpenCV Image", image );
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -1,11 +1,13 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
#add_base_header.pri
|
||||
#应用程序和Library的基础header。
|
||||
#包含app工程、lib工程通用的宏(定义)、配置(定义)、依赖、[头文件]、编译参数、[平台]编译设置
|
||||
#---------------------------------------------------------------------------------
|
||||
#################################################################
|
||||
##definition and configration
|
||||
##need QSYS
|
||||
##################################################################in theory, this should not be limited to 4.8.0, no limit is good.
|
||||
#################################################################
|
||||
#in theory, this should not be limited to 4.8.0, no limit is good.
|
||||
##Qt version
|
||||
QT += core sql network gui xml
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
@ -102,17 +104,18 @@ win32 {
|
||||
#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|Windows|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)
|
||||
}
|
||||
#contains(QSYS_PRIVATE, Win32|Windows|Win64 || iOS|iOSSimulator)
|
||||
#header里不再使用平台进行判定,而是使用工程当中定义的CONFIG static[lib] 和 dll进行判定。
|
||||
#理论上mingw编译的Qt library不应该是静态的啊...
|
||||
#Qt is static by mingw32 building
|
||||
contains(CONFIG, static*){
|
||||
#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) {
|
||||
}
|
||||
#link and build all need this macro
|
||||
contains(DEFINES, LIB_STATIC_LIBRARY) {
|
||||
}
|
||||
|
||||
################################################################
|
||||
|
@ -2,6 +2,10 @@
|
||||
#add_base_manager.pri
|
||||
#应用程序和Library的基础管理器,统一使用这个管理器。
|
||||
#---------------------------------------------------------------------------------
|
||||
#简介
|
||||
#在这个管理器里,App和Lib工程其实是区分开的。
|
||||
#尤其动态编译 配置开关、宏定义 是在这里处理的,但是静态编译 配置开关在这里、宏定义在base_header里。这里需要加强理解。
|
||||
#这是重点。
|
||||
|
||||
################################################################################
|
||||
#包含这个pri依赖的pri
|
||||
@ -57,13 +61,16 @@ include ($${PWD}/add_base_header.pri)
|
||||
##definition and configration
|
||||
##need QSYS
|
||||
#################################################################
|
||||
contains(TEMPLATE, app) {
|
||||
#这个编译,build pane比较简洁
|
||||
CONFIG += silent
|
||||
|
||||
contains(TEMPLATE, .*app) {
|
||||
#add base manager对App的处理很少,App通过函数基本上能解决所有的事情
|
||||
#macOS下必须开开bundle
|
||||
contains(QSYS_PRIVATE, macOS){
|
||||
CONFIG += app_bundle
|
||||
}
|
||||
} else: contains(TEMPLATE, lib) {
|
||||
} else: contains(TEMPLATE, .*lib) {
|
||||
##base manager 对lib的处理很重要
|
||||
##区分了在不同目标下Qt library的不同形态,其实就是要求lib工程和Qt library保持一样的状态。
|
||||
##尤其在windows平台下,还提供了LIB_STATIC_LIBRARY 和 LIB_LIBRARY两个宏的支持
|
||||
@ -78,9 +85,12 @@ contains(TEMPLATE, app) {
|
||||
mingw {
|
||||
#on my computer , Qt library are all static library?
|
||||
#create static lib (important, only occured at builder pro)
|
||||
CONFIG += staticlib
|
||||
#CONFIG += staticlib
|
||||
#在add_base_header里设置
|
||||
#DEFINES += LIB_STATIC_LIBRARY
|
||||
#在我电脑上编译别的lib mingw下是dll格式的。
|
||||
CONFIG += dll
|
||||
DEFINES += LIB_LIBRARY
|
||||
} else {
|
||||
#create dynamic lib (important, only occured at builder pro)
|
||||
CONFIG += dll
|
||||
|
@ -38,7 +38,8 @@ defineReplace(get_add_deploy_on_windows) {
|
||||
msvc{
|
||||
command += windeployqt $${APP_DEPLOY_PWD}\\$${TARGET}.exe --debug -verbose=1
|
||||
} else {
|
||||
command += windeployqt $${APP_DEPLOY_PWD}\\$${TARGET}.exe --release -verbose=1
|
||||
#过去you'yi'dua有一段时间,这里必须发布release版本,mingw的才能通过,现在debug的才能通过
|
||||
command += windeployqt $${APP_DEPLOY_PWD}\\$${TARGET}.exe --debug -verbose=1
|
||||
}
|
||||
} else: equals(BUILD, Release) {
|
||||
command += $$CMD_SEP
|
||||
|
@ -76,12 +76,15 @@ defineReplace(get_add_deploy_library_on_windows) {
|
||||
|
||||
command =
|
||||
command += $$RM $${APP_BUILD_PWD}\\$${librealname}.* $$CMD_SEP
|
||||
#拷贝sdk到build
|
||||
#build的地方调试需要.lib等其他文件
|
||||
command += $$COPY_DIR $${LIB_LIB_PWD}\\$${librealname}.* $${APP_BUILD_PWD} $$CMD_SEP
|
||||
#拷贝sdk到build
|
||||
command += $$COPY_DIR $${LIB_BIN_PWD}\\$${librealname}.* $${APP_BUILD_PWD} $$CMD_SEP
|
||||
|
||||
command += $$RM $${APP_DEPLOY_PWD}\\$${librealname}.* $$CMD_SEP
|
||||
#deploy的地方不需要.lib等文件
|
||||
#拷贝sdk到deploy
|
||||
command += $$COPY_DIR $${LIB_LIB_PWD}\\$${librealname}.* $${APP_DEPLOY_PWD}
|
||||
command += $$COPY_DIR $${LIB_BIN_PWD}\\$${librealname}.* $${APP_DEPLOY_PWD}
|
||||
|
||||
#message($$command)
|
||||
|
||||
@ -174,8 +177,12 @@ defineTest(add_deploy_library) {
|
||||
|
||||
LIB_STD_DIR = $${libname}/$${QSYS_STD_DIR}
|
||||
LIB_SDK_PWD = $${LIB_SDK_ROOT}/$${LIB_STD_DIR}
|
||||
LIB_BIN_PWD = $${LIB_SDK_PWD}/bin
|
||||
LIB_LIB_PWD = $${LIB_SDK_PWD}/lib
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
LIB_STD_DIR~=s,/,\\,g
|
||||
LIB_SDK_PWD~=s,/,\\,g
|
||||
LIB_BIN_PWD~=s,/,\\,g
|
||||
LIB_LIB_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
@ -234,11 +241,14 @@ defineReplace(get_add_deploy_libraries_on_windows) {
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_libraries_on_windows(libname) requires one argument")
|
||||
|
||||
command =
|
||||
#拷贝sdk到build
|
||||
#build 需要.lib .exp等文件
|
||||
command += $$COPY_DIR $${LIB_LIB_PWD}\\* $${APP_BUILD_PWD} $$CMD_SEP
|
||||
#拷贝sdk到build
|
||||
command += $$COPY_DIR $${LIB_BIN_PWD}\\* $${APP_BUILD_PWD} $$CMD_SEP
|
||||
|
||||
#deploy不需要.lib .exp等文件
|
||||
#拷贝sdk到deploy
|
||||
command += $$COPY_DIR $${LIB_LIB_PWD}\\* $${APP_DEPLOY_PWD}
|
||||
command += $$COPY_DIR $${LIB_BIN_PWD}\\* $${APP_DEPLOY_PWD}
|
||||
|
||||
#message($$command)
|
||||
|
||||
@ -319,8 +329,12 @@ defineTest(add_deploy_libraries) {
|
||||
|
||||
LIB_STD_DIR = $${libname}/$${QSYS_STD_DIR}
|
||||
LIB_SDK_PWD = $${LIB_SDK_ROOT}/$${LIB_STD_DIR}
|
||||
LIB_BIN_PWD = $${LIB_SDK_PWD}/bin
|
||||
LIB_LIB_PWD = $${LIB_SDK_PWD}/lib
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
LIB_STD_DIR~=s,/,\\,g
|
||||
LIB_SDK_PWD~=s,/,\\,g
|
||||
LIB_BIN_PWD~=s,/,\\,g
|
||||
LIB_LIB_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ contains(QMAKE_HOST.os,Windows) {
|
||||
COPY = copy /y
|
||||
COPY_DIR = xcopy /s /q /y /i /r /h
|
||||
MK_DIR = mkdir
|
||||
RM = del
|
||||
RM = del /q
|
||||
CD = cd /d
|
||||
RM_DIR = rd /s /q
|
||||
#PATH_SEP=\\
|
||||
|
@ -58,6 +58,7 @@ defineReplace(get_add_sdk_dir_struct) {
|
||||
!contains(QSYS_PRIVATE, macOS) {
|
||||
command += $$MK_DIR $$LIB_INC_DIR $$CMD_SEP
|
||||
}
|
||||
command += $$MK_DIR $$LIB_BIN_DIR $$CMD_SEP
|
||||
command += $$MK_DIR $$LIB_LIB_DIR $$CMD_SEP
|
||||
command += $$MK_DIR $$LIB_CMAKE_DIR $$CMD_SEP
|
||||
command += $$MK_DIR $$LIB_PRI_PATH
|
||||
@ -72,7 +73,9 @@ defineReplace(get_add_windows_sdk) {
|
||||
#copy header
|
||||
command += $${COPY_DIR} $${LIB_SRC_PWD}\\*.h* $${LIB_INC_DIR} $$CMD_SEP
|
||||
#should be *.dll *.lib
|
||||
command += $${COPY_DIR} $${LIB_BUILD_PWD}\\* $${LIB_LIB_DIR}
|
||||
command += $${COPY_DIR} $${LIB_BUILD_PWD}\\* $${LIB_LIB_DIR} $$CMD_SEP
|
||||
#move *.dll
|
||||
command += $${MOVE} $${LIB_LIB_DIR}\\*.dll $${LIB_BIN_DIR}
|
||||
|
||||
return ($$command)
|
||||
}
|
||||
@ -249,6 +252,7 @@ defineReplace(get_add_sdk_private){
|
||||
|
||||
#qqt defined these dir struct, used from qt library
|
||||
LIB_INC_DIR = include/$${libname}
|
||||
LIB_BIN_DIR = bin
|
||||
LIB_LIB_DIR = lib
|
||||
LIB_CMAKE_DIR=lib/cmake/$${libname}
|
||||
LIB_PRI_PATH=mkspecs/modules
|
||||
@ -264,6 +268,7 @@ defineReplace(get_add_sdk_private){
|
||||
LIB_SDK_PWD~=s,/,\\,g
|
||||
|
||||
LIB_INC_DIR~=s,/,\\,g
|
||||
LIB_BIN_DIR = bin
|
||||
LIB_LIB_DIR = lib
|
||||
LIB_CMAKE_DIR~=s,/,\\,g
|
||||
LIB_PRI_PATH~=s,/,\\,g
|
||||
|
@ -37,8 +37,11 @@ TEMPLATE = lib
|
||||
#################################################################
|
||||
include (../multi-link/add_base_manager.pri)
|
||||
|
||||
#根据multi-link提供的动态编译 静态编译设定进行编译,添加我自己的QQt的宏定义。
|
||||
contains(DEFINES, LIB_LIBRARY) {
|
||||
DEFINES += QQT_LIBRARY
|
||||
} else:contains(DEFINES, LIB_STATIC_LIBRARY) {
|
||||
DEFINES += QQT_STATIC_LIBRARY
|
||||
}
|
||||
|
||||
#################################################################
|
||||
|
@ -75,23 +75,21 @@ msvc {
|
||||
##-----------------------------------------------
|
||||
#link QQt static library in some occation on windows
|
||||
#when link QQt static library, if no this macro, headers can't be linked on windows.
|
||||
contains(QSYS_PRIVATE, Win32|Windows|Win64 || iOS|iOSSimulator) {
|
||||
#Qt is static by mingw32 building
|
||||
mingw|ios{
|
||||
#on my computer, Qt library are all static library?
|
||||
DEFINES += QQT_STATIC_LIBRARY
|
||||
message(Build $${TARGET} QQT_STATIC_LIBRARY is defined. build and link)
|
||||
}
|
||||
#Qt is static by mingw32 building ?
|
||||
contains(CONFIG, static*){
|
||||
#on my computer, Qt library are all static library?
|
||||
DEFINES += QQT_STATIC_LIBRARY
|
||||
message(Build $${TARGET} QQT_STATIC_LIBRARY is defined. build and link)
|
||||
}
|
||||
|
||||
#link and build all need this macro
|
||||
contains(DEFINES, QQT_STATIC_LIBRARY) {
|
||||
DEFINES += QCUSTOMPLOT_STATIC_LIBRARY
|
||||
DEFINES += QZXING_STATIC_LIBRARY
|
||||
DEFINES += QT_QTSOAP_STATIC_LIBRARY
|
||||
DEFINES += BUILD_QDEVICEWATCHER_STATIC
|
||||
DEFINES += QT_QTMMLWIDGET_STATIC_LIBRARY
|
||||
DEFINES += QT_GUMBO_STATIC_LIBRARY
|
||||
}
|
||||
#link and build all need this macro
|
||||
contains(DEFINES, QQT_STATIC_LIBRARY) {
|
||||
DEFINES += QCUSTOMPLOT_STATIC_LIBRARY
|
||||
DEFINES += QZXING_STATIC_LIBRARY
|
||||
DEFINES += QT_QTSOAP_STATIC_LIBRARY
|
||||
DEFINES += BUILD_QDEVICEWATCHER_STATIC
|
||||
DEFINES += QT_QTMMLWIDGET_STATIC_LIBRARY
|
||||
DEFINES += QT_GUMBO_STATIC_LIBRARY
|
||||
}
|
||||
|
||||
################################################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user