mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
add multilink app
This commit is contained in:
parent
060d1f6b4a
commit
daa753e077
@ -117,5 +117,8 @@ SUBDIRS =
|
||||
#SUBDIRS += test/QQtWidgetClickSoundHelperTest
|
||||
|
||||
#这是一对,用于测试Multi-link对其他的lib的链接能力
|
||||
#注意lib工程必须独立存在
|
||||
#SUBDIRS += test/QQtBasedLibTest
|
||||
#SUBDIRS += test/QQtMultiLinkTest
|
||||
|
||||
#
|
||||
SUBDIRS += test/QQtMultiLinkTest
|
||||
|
@ -1,8 +1,8 @@
|
||||
#-------------------------------------------------------------
|
||||
#app_deploy.pri
|
||||
#add_deploy.pri
|
||||
#提供app发布函数,只是app工程使用
|
||||
#-------------------------------------------------------------
|
||||
#Multi-link技术 app_deploy部分只能应用于Qt5,Qt4没有windeployqt程序,如果用户为Qt4编译了windeployqt那么也可以用于Qt4。
|
||||
#Multi-link技术 add_deploy部分只能应用于Qt5,Qt4没有windeployqt程序,如果用户为Qt4编译了windeployqt那么也可以用于Qt4。
|
||||
|
||||
################################################################################
|
||||
#内部用函数
|
||||
@ -12,10 +12,10 @@
|
||||
#在build path修复app (macOS专有)
|
||||
#copy lib
|
||||
#fix bundle路径链接
|
||||
defineReplace(app_deploy_with_lib_on_mac) {
|
||||
defineReplace(add_deploy_with_lib_on_mac) {
|
||||
#need QQT_BUILD_PWD
|
||||
deploy_path = $$1
|
||||
isEmpty(1): error("app_deploy_with_lib_on_mac(deploy_path) requires one argument")
|
||||
isEmpty(1): error("add_deploy_with_lib_on_mac(deploy_path) requires one argument")
|
||||
create_command = $$create_mac_sdk()
|
||||
APP_DEST_DIR=$${deploy_path}
|
||||
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
|
||||
@ -53,14 +53,14 @@ defineReplace(fix_app_bundle_with_qqt_in_building_path_on_mac) {
|
||||
#need QQT_BUILD_PWD
|
||||
APP_DEST_DIR=$${DESTDIR}
|
||||
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
|
||||
command = $$app_deploy_with_lib_on_mac($${APP_DEST_DIR})
|
||||
command = $$add_deploy_with_lib_on_mac($${APP_DEST_DIR})
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
##########################################
|
||||
#app的发布函数命令
|
||||
##########################################
|
||||
defineReplace(get_app_deploy_on_mac) {
|
||||
defineReplace(get_add_deploy_on_mac) {
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$RM_DIR $${APP_DEPLOY_PWD}/$${TARGET}.app $$CMD_SEP
|
||||
command += $$COPY_DIR $${APP_DEST_DIR}/$${TARGET}.app $${APP_DEPLOY_PWD}/$${TARGET}.app
|
||||
@ -68,7 +68,7 @@ defineReplace(get_app_deploy_on_mac) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_app_deploy_on_win) {
|
||||
defineReplace(get_add_deploy_on_win) {
|
||||
#need QQT_BUILD_PWD
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
@ -92,7 +92,7 @@ defineReplace(get_app_deploy_on_win) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_app_deploy_on_linux) {
|
||||
defineReplace(get_add_deploy_on_linux) {
|
||||
#need QQT_BUILD_PWD
|
||||
|
||||
command =
|
||||
@ -108,7 +108,7 @@ defineReplace(get_app_deploy_on_linux) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_app_deploy_on_android) {
|
||||
defineReplace(get_add_deploy_on_android) {
|
||||
#need QQT_BUILD_PWD
|
||||
|
||||
command =
|
||||
@ -127,11 +127,11 @@ defineReplace(get_app_deploy_on_android) {
|
||||
#app发布lib到自己的目标里,必须先发布app,如果没有先发布app会出错。
|
||||
#lib发布lib,没有的事情
|
||||
#解释,从app build目录里拷贝是有原因的,在Creator编译完成后,我把依赖库拷贝过去了,add_library()实现的。
|
||||
defineReplace(get_app_deploy_lib_on_mac) {
|
||||
defineReplace(get_add_deploy_lib_on_mac) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("get_app_deploy_lib_on_mac(libname) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_lib_on_mac(libname) requires one argument")
|
||||
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
@ -141,11 +141,11 @@ defineReplace(get_app_deploy_lib_on_mac) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_app_deploy_lib_on_windows) {
|
||||
defineReplace(get_add_deploy_lib_on_windows) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("get_app_deploy_lib_on_windows(libname) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_lib_on_windows(libname) requires one argument")
|
||||
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
@ -167,11 +167,11 @@ defineReplace(get_app_deploy_lib_on_windows) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_app_deploy_lib_on_linux) {
|
||||
defineReplace(get_add_deploy_lib_on_linux) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("get_app_deploy_lib_on_linux(libname) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_lib_on_linux(libname) requires one argument")
|
||||
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
@ -182,11 +182,11 @@ defineReplace(get_app_deploy_lib_on_linux) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_app_deploy_lib_on_android) {
|
||||
defineReplace(get_add_deploy_lib_on_android) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("get_app_deploy_lib_on_android(libname) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_lib_on_android(libname) requires one argument")
|
||||
|
||||
command =
|
||||
command += $${APP_DEST_PWD}/lib$${libname}.so
|
||||
@ -198,7 +198,7 @@ defineReplace(get_app_deploy_lib_on_android) {
|
||||
################################################################################
|
||||
#外部用函数
|
||||
################################################################################
|
||||
defineTest(app_deploy) {
|
||||
defineTest(add_deploy) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
|
||||
@ -212,50 +212,54 @@ defineTest(app_deploy) {
|
||||
##4.8 qmake arm32 return() 函数无效
|
||||
!isEmpty(APP_DEPLOY_ROOT) {
|
||||
#这里定义了一个配置开关,但是用户可以忽略
|
||||
#CONFIG += app_deploy
|
||||
#CONFIG += add_deploy
|
||||
message("$${TARGET} has deployed some app files")
|
||||
}
|
||||
|
||||
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP
|
||||
contains(QSYS_PRIVATE, Win32||Win64) {
|
||||
#发布windows版本
|
||||
QMAKE_POST_LINK += $$get_app_deploy_on_win()
|
||||
QMAKE_POST_LINK += $$get_add_deploy_on_win()
|
||||
} else: contains(QSYS_PRIVATE, macOS) {
|
||||
#发布苹果版本,iOS版本也是这个?
|
||||
QMAKE_POST_LINK += $$get_app_deploy_on_mac()
|
||||
QMAKE_POST_LINK += $$get_add_deploy_on_mac()
|
||||
} else: contains(QSYS_PRIVATE, Android||AndroidX86) {
|
||||
ANDROID_EXTRA_LIBS += $$get_app_deploy_on_android()
|
||||
ANDROID_EXTRA_LIBS += $$get_add_deploy_on_android()
|
||||
} else {
|
||||
#发布linux、e-linux,这个是一样的。
|
||||
QMAKE_POST_LINK += $$get_app_deploy_on_linux()
|
||||
QMAKE_POST_LINK += $$get_add_deploy_on_linux()
|
||||
}
|
||||
|
||||
export(QMAKE_POST_LINK)
|
||||
|
||||
return (1)
|
||||
}
|
||||
|
||||
defineTest(app_deploy_lib) {
|
||||
defineTest(add_deploy_lib) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("app_deploy_lib(libname) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("add_deploy_lib(libname) requires one argument")
|
||||
|
||||
message("$${TARGET} has deployed lib $${libname}.")
|
||||
|
||||
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP
|
||||
contains(QSYS_PRIVATE, Win32||Win64) {
|
||||
#发布windows版本
|
||||
QMAKE_POST_LINK += $$get_app_deploy_lib_on_win($${libname})
|
||||
QMAKE_POST_LINK += $$get_add_deploy_lib_on_win($${libname})
|
||||
} else: contains(QSYS_PRIVATE, macOS) {
|
||||
#发布苹果版本,iOS版本也是这个?
|
||||
QMAKE_POST_LINK += $$get_app_deploy_lib_on_mac($${libname})
|
||||
QMAKE_POST_LINK += $$get_add_deploy_lib_on_mac($${libname})
|
||||
} else: contains(QSYS_PRIVATE, Android||AndroidX86) {
|
||||
ANDROID_EXTRA_LIBS += $$get_app_deploy_lib_on_android($${libname})
|
||||
ANDROID_EXTRA_LIBS += $$get_add_deploy_lib_on_android($${libname})
|
||||
} else {
|
||||
#发布linux、e-linux,这个是一样的。
|
||||
QMAKE_POST_LINK += $$get_app_deploy_lib_on_linux($${libname})
|
||||
QMAKE_POST_LINK += $$get_add_deploy_lib_on_linux($${libname})
|
||||
}
|
||||
|
||||
export(QMAKE_POST_LINK)
|
||||
|
||||
return (1)
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#---------------------------------------------------------------------
|
||||
#app_deploy_config.pri
|
||||
#add_deploy_config.pri
|
||||
#用于发布app的配置文件。
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
defineReplace(app_deploy_config_on_mac) {
|
||||
defineReplace(add_deploy_config_on_mac) {
|
||||
dirs = $$1
|
||||
!isEmpty(2): error("app_deploy_config_on_mac(dirs) requires one argument")
|
||||
isEmpty(1): error("app_deploy_config_on_mac(dirs) requires one argument")
|
||||
!isEmpty(2): error("add_deploy_config_on_mac(dirs) requires one argument")
|
||||
isEmpty(1): error("add_deploy_config_on_mac(dirs) requires one argument")
|
||||
|
||||
command =
|
||||
command += $$COPY_DIR $${dirs} $${APP_DEST_PWD}/$${TARGET}.app/Contents/MacOS/ $$CMD_SEP
|
||||
@ -16,11 +16,11 @@ defineReplace(app_deploy_config_on_mac) {
|
||||
}
|
||||
|
||||
|
||||
defineReplace(app_deploy_config_on_linux) {
|
||||
defineReplace(add_deploy_config_on_linux) {
|
||||
#need QQT_BUILD_PWD
|
||||
dirs = $$1
|
||||
!isEmpty(2): error("app_deploy_config_on_linux(dirs) requires one argument")
|
||||
isEmpty(1): error("app_deploy_config_on_linux(dirs) requires one argument")
|
||||
!isEmpty(2): error("add_deploy_config_on_linux(dirs) requires one argument")
|
||||
isEmpty(1): error("add_deploy_config_on_linux(dirs) requires one argument")
|
||||
command =
|
||||
command += $$COPY_DIR $${dirs} $${APP_DEST_PWD} $$CMD_SEP
|
||||
command += $$COPY_DIR $${dirs} $${APP_DEPLOY_PWD}
|
||||
@ -28,10 +28,10 @@ defineReplace(app_deploy_config_on_linux) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineTest(app_deploy_config) {
|
||||
defineTest(add_deploy_config) {
|
||||
|
||||
APP_CONFIG_PWD = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("app_deploy_config(APP_CONFIG_PWD) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("add_deploy_config(APP_CONFIG_PWD) requires one argument")
|
||||
|
||||
#如果 TARGET 没有配置 APP_CONFIG_PWD 那么返回,不拷贝任何配置
|
||||
#qmake 或逻辑为 | 或者 ||
|
||||
@ -43,15 +43,15 @@ defineTest(app_deploy_config) {
|
||||
##4.8 qmake arm32 return() 函数无效
|
||||
##qmake 与逻辑为 :
|
||||
!isEmpty(APP_CONFIG_PWD):!isEmpty(APP_DEPLOY_PWD) {
|
||||
CONFIG += app_deploy_config
|
||||
CONFIG += add_deploy_config
|
||||
message("$${TARGET} has deploied some config files")
|
||||
}
|
||||
|
||||
isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP
|
||||
contains(QSYS_PRIVATE, Win32||Win64) {
|
||||
QMAKE_POST_LINK += $$app_deploy_config_on_linux("$${APP_CONFIG_PWD}\\*")
|
||||
QMAKE_POST_LINK += $$add_deploy_config_on_linux("$${APP_CONFIG_PWD}\\*")
|
||||
} else: contains(QSYS_PRIVATE, macOS) {
|
||||
QMAKE_POST_LINK += $$app_deploy_config_on_mac("$${APP_CONFIG_PWD}/*")
|
||||
QMAKE_POST_LINK += $$add_deploy_config_on_mac("$${APP_CONFIG_PWD}/*")
|
||||
} else: contains(QSYS_PRIVATE, Android||AndroidX86) {
|
||||
#分为Host为Windows和类Unix两种情况。
|
||||
#Android下使用qrc,无法发布配置文件。
|
||||
@ -59,7 +59,7 @@ defineTest(app_deploy_config) {
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
QMAKE_POST_LINK += $$app_deploy_config_on_linux("$${APP_CONFIG_PWD}/*")
|
||||
QMAKE_POST_LINK += $$add_deploy_config_on_linux("$${APP_CONFIG_PWD}/*")
|
||||
}
|
||||
|
||||
return (1)
|
||||
@ -72,4 +72,4 @@ APP_DEST_DIR=$${DESTDIR}
|
||||
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
|
||||
|
||||
#这个需要用户手动调用.这个目录一般在源代码目录里
|
||||
#app_deploy_config(<config_path>)
|
||||
#add_deploy_config(<config_path>)
|
||||
|
@ -18,6 +18,9 @@ include($${PWD}/add_multi_link_technology.pri)
|
||||
################################################################################
|
||||
#这里的pri提供multi link的全部函数
|
||||
################################################################################
|
||||
#公共的基础header.pri
|
||||
include ($${PWD}/add_base_header.pri)
|
||||
|
||||
#app发布所需要的函数
|
||||
include ($${PWD}/add_deploy.pri)
|
||||
|
||||
@ -27,21 +30,24 @@ include ($${PWD}/add_deploy_config.pri)
|
||||
#app链接所需要的函数
|
||||
include ($${PWD}/add_library.pri)
|
||||
|
||||
#program version
|
||||
include ($${PWD}/add_version.pri)
|
||||
|
||||
####################################################################################
|
||||
#app base manager 都做了一下这些事情
|
||||
####################################################################################
|
||||
#发布app和libQQt
|
||||
#注意,此处强制发布App 不需要用户手动调用。
|
||||
#注意,此处强制依赖LibQQt,不需要用户手动发布LibQQt。
|
||||
app_deploy()
|
||||
app_deploy_lib(QQt)
|
||||
#如果用户依赖了其他的lib,便可以用app_deploy_lib进行拷贝依赖到app发布区域。
|
||||
#并且这个工作,后续持续收到app_deploy配置开关的控制。
|
||||
#note: app_deploy 一个配置开关 一个函数 两个都有效使用
|
||||
add_deploy()
|
||||
add_deploy_lib(QQt)
|
||||
#如果用户依赖了其他的lib,便可以用add_deploy_lib进行拷贝依赖到app发布区域。
|
||||
#并且这个工作,后续持续收到add_deploy配置开关的控制。
|
||||
#note: add_deploy 一个配置开关 一个函数 两个都有效使用
|
||||
#注意,用户必须先发布lib 再发布app
|
||||
|
||||
#发布配置
|
||||
#用户手动调用app_deploy_config(源配置文件所在位置)
|
||||
#用户手动调用add_deploy_config(源配置文件所在位置)
|
||||
|
||||
#链接其他链接库
|
||||
#在app_custom_manager.pri里进行
|
||||
|
@ -33,10 +33,8 @@ HEADERS += \
|
||||
FORMS += \
|
||||
mainwindow.ui
|
||||
|
||||
APP_CONFIG_PWD = $${PWD}/AppRoot
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
APP_CONFIG_PWD ~=s,/,\\,g
|
||||
}
|
||||
|
||||
system(touch main.cpp)
|
||||
include (../../multi-link/app_base_manager.pri)
|
||||
include (../../multi-link/add_base_manager.pri)
|
||||
|
||||
add_deploy()
|
||||
message($$QMAKE_POST_LINK)
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "qqtbasedlibtest.h"
|
||||
//#include "qqtbasedlibtest.h"
|
||||
|
||||
MainWindow::MainWindow ( QWidget* parent ) :
|
||||
QMainWindow ( parent ),
|
||||
ui ( new Ui::MainWindow )
|
||||
{
|
||||
ui->setupUi ( this );
|
||||
QQtBasedLibTest l;
|
||||
//QQtBasedLibTest l;
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
Loading…
x
Reference in New Issue
Block a user