mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
add add deploy library
This commit is contained in:
parent
88b6fd1201
commit
279be43c60
@ -8,6 +8,7 @@
|
||||
#内部用函数
|
||||
#获取命令
|
||||
################################################################################
|
||||
THIS_PRI_PWD = $${PWD}
|
||||
|
||||
#在build path修复app (macOS专有)
|
||||
#copy lib
|
||||
@ -120,25 +121,53 @@ defineReplace(get_add_deploy_on_android) {
|
||||
#app发布lib到自己的目标里,必须先发布app,如果没有先发布app会出错。
|
||||
#lib发布lib,没有的事情
|
||||
#解释,从app build目录里拷贝是有原因的,在Creator编译完成后,我把依赖库拷贝过去了,add_library()实现的。
|
||||
defineReplace(get_add_deploy_lib_on_mac) {
|
||||
defineReplace(get_add_deploy_library_on_mac) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_lib_on_mac(libname) requires one argument")
|
||||
librealname = $$2
|
||||
isEmpty(1): error("get_add_deploy_library_on_mac(libname, librealname) requires at last one argument")
|
||||
!isEmpty(3): error("get_add_deploy_library_on_mac(libname, librealname) requires at most two argument")
|
||||
isEmpty(2): librealname = $${libname}
|
||||
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$COPY_DIR $${APP_DEST_PWD}/$${TARGET}.app/Contents/Frameworks/$${libname}.framework $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/Frameworks
|
||||
command += $$MK_DIR $${APP_BUILD_PWD}/$${TARGET}.app/Contents/Frameworks &&
|
||||
#拷贝sdk到build
|
||||
command += $$COPY_DIR $${LIB_LIB_PWD}/$${librealname}.framework $${APP_BUILD_PWD}/$${TARGET}.app/Contents/Frameworks/ &&
|
||||
#更改app bundle链接Lib的位置。
|
||||
command += install_name_tool -change $${librealname}.framework/Versions/Current/$${librealname} \
|
||||
@rpath/$${librealname}.framework/Versions/Current/$${librealname} \
|
||||
$${APP_BUILD_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} &&
|
||||
command += macdeployqt $${APP_BUILD_PWD}/$${TARGET}.app -verbose=1 &&
|
||||
lessThan(QT_MAJOR_VERSION, 5){
|
||||
command += chmod +x $${THIS_PRI_PWD}/mac_deploy_qt4.sh &&
|
||||
command += $${THIS_PRI_PWD}/mac_deploy_qt4.sh $${APP_BUILD_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} &&
|
||||
}
|
||||
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/Frameworks &&
|
||||
#拷贝sdk到deploy
|
||||
command += $$COPY_DIR $${LIB_LIB_PWD}/$${librealname}.framework $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/Frameworks/ &&
|
||||
#更改app bundle链接Lib的位置。
|
||||
command += install_name_tool -change $${librealname}.framework/Versions/Current/$${librealname} \
|
||||
@rpath/$${librealname}.framework/Versions/Current/$${librealname} \
|
||||
$${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET} &&
|
||||
command += macdeployqt $${APP_DEPLOY_PWD}/$${TARGET}.app -verbose=1
|
||||
lessThan(QT_MAJOR_VERSION, 5){
|
||||
command += &&
|
||||
command += chmod +x $${THIS_PRI_PWD}/mac_deploy_qt4.sh &&
|
||||
command += $${THIS_PRI_PWD}/mac_deploy_qt4.sh $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/$${TARGET}
|
||||
}
|
||||
|
||||
#message($$command)
|
||||
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_add_deploy_lib_on_windows) {
|
||||
defineReplace(get_add_deploy_library_on_windows) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_lib_on_windows(libname) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_library_on_windows(libname) requires one argument")
|
||||
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
@ -160,11 +189,11 @@ defineReplace(get_add_deploy_lib_on_windows) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_add_deploy_lib_on_linux) {
|
||||
defineReplace(get_add_deploy_library_on_linux) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_lib_on_linux(libname) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_library_on_linux(libname) requires one argument")
|
||||
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
@ -175,11 +204,11 @@ defineReplace(get_add_deploy_lib_on_linux) {
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_add_deploy_lib_on_android) {
|
||||
defineReplace(get_add_deploy_library_on_android) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_lib_on_android(libname) requires one argument")
|
||||
isEmpty(1)|!isEmpty(2): error("get_add_deploy_library_on_android(libname) requires one argument")
|
||||
|
||||
command =
|
||||
command += $${APP_DEST_PWD}/lib$${libname}.so
|
||||
@ -228,31 +257,37 @@ defineTest(add_deploy) {
|
||||
return (1)
|
||||
}
|
||||
|
||||
defineTest(add_deploy_lib) {
|
||||
defineTest(add_deploy_library) {
|
||||
#APP_DEPLOY_PWD
|
||||
#APP_DEST_PWD
|
||||
|
||||
libname = $$1
|
||||
isEmpty(1)|!isEmpty(2): error("add_deploy_lib(libname) requires one argument")
|
||||
librealname = $$2
|
||||
isEmpty(1): error("add_deploy_library(libname, librealname) requires at last one argument")
|
||||
!isEmpty(3): error("add_deploy_library(libname, librealname) requires at most two argument")
|
||||
isEmpty(2): librealname = $${libname}
|
||||
|
||||
message("$${TARGET} has deployed lib $${libname}.")
|
||||
LIB_STD_DIR = $${libname}/$${QSYS_STD_DIR}
|
||||
LIB_SDK_PWD = $${LIB_SDK_ROOT}/$${LIB_STD_DIR}
|
||||
LIB_LIB_PWD = $${LIB_SDK_PWD}/lib
|
||||
|
||||
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP
|
||||
contains(QSYS_PRIVATE, Win32||Win64) {
|
||||
#发布windows版本
|
||||
QMAKE_POST_LINK += $$get_add_deploy_lib_on_win($${libname})
|
||||
QMAKE_POST_LINK += $$get_add_deploy_library_on_win($${libname})
|
||||
} else: contains(QSYS_PRIVATE, macOS) {
|
||||
#发布苹果版本,iOS版本也是这个?
|
||||
QMAKE_POST_LINK += $$get_add_deploy_lib_on_mac($${libname})
|
||||
QMAKE_POST_LINK += $$get_add_deploy_library_on_mac($${libname})
|
||||
} else: contains(QSYS_PRIVATE, Android||AndroidX86) {
|
||||
ANDROID_EXTRA_LIBS += $$get_add_deploy_lib_on_android($${libname})
|
||||
ANDROID_EXTRA_LIBS += $$get_add_deploy_library_on_android($${libname})
|
||||
} else {
|
||||
#发布linux、e-linux,这个是一样的。
|
||||
QMAKE_POST_LINK += $$get_add_deploy_lib_on_linux($${libname})
|
||||
QMAKE_POST_LINK += $$get_add_deploy_library_on_linux($${libname})
|
||||
}
|
||||
|
||||
export(QMAKE_POST_LINK)
|
||||
|
||||
message("$${TARGET} has deployed lib $${libname}.")
|
||||
return (1)
|
||||
}
|
||||
|
||||
@ -276,6 +311,7 @@ message(Deploy $${TARGET} to $$APP_DEPLOY_ROOT/$${TARGET}/$$QSYS_STD_DIR)
|
||||
#起始位置 编译位置 中间目标位置
|
||||
APP_DEST_PWD=$${DESTDIR}
|
||||
isEmpty(APP_DEST_PWD):APP_DEST_PWD=.
|
||||
APP_BUILD_PWD = $$APP_DEST_PWD
|
||||
|
||||
#set app deploy pwd
|
||||
#APP_DEPLOY_PWD is here.
|
||||
@ -286,5 +322,3 @@ APP_DEPLOY_PWD = $${APP_DEPLOY_ROOT}/$${TARGET}/$${QSYS_STD_DIR}
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
APP_DEPLOY_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#---------------------------------------------------------------------
|
||||
#add_deploy_config.pri
|
||||
#用于发布app的配置文件。
|
||||
#用于发布app的配置文件。只是app工程使用
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
defineReplace(add_deploy_config_on_mac) {
|
||||
|
@ -317,12 +317,6 @@ defineTest(add_sdk){
|
||||
LIB_SDK_PWD = $${LIB_SDK_ROOT}/$${LIB_STD_DIR}
|
||||
#message(QQt sdk install here:$${LIB_SDK_PWD})
|
||||
|
||||
contains(CONFIG, link_from_sdk) {
|
||||
LIB_LIB_PWD = $${LIB_SDK_ROOT}/$${LIB_STD_DIR}/lib
|
||||
} else: contains(CONFIG, link_from_build) {
|
||||
LIB_LIB_PWD = $${APP_BUILD_ROOT}/$${LIB_STD_DIR}/$${LIB_DST_DIR}
|
||||
}
|
||||
|
||||
#这里不仅仅目标为windows的时候,才会转换,
|
||||
#开发Host为Windows的时候,都要转换。
|
||||
#contains(QSYS_PRIVATE, WIN32||WIN64) {
|
||||
@ -336,11 +330,12 @@ defineTest(add_sdk){
|
||||
LIB_DST_DIR~=s,/,\\,g
|
||||
LIB_BUILD_PWD~=s,/,\\,g
|
||||
LIB_SDK_PWD~=s,/,\\,g
|
||||
LIB_LIB_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
command += $$get_add_sdk_private()
|
||||
message($$command)
|
||||
#message($$command)
|
||||
|
||||
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP
|
||||
QMAKE_POST_LINK += $$command
|
||||
|
||||
export(QMAKE_POST_LINK)
|
||||
|
@ -40,8 +40,8 @@ include ($${PWD}/add_version.pri)
|
||||
#注意,此处强制发布App 不需要用户手动调用。
|
||||
#注意,此处强制依赖LibQQt,不需要用户手动发布LibQQt。
|
||||
add_deploy()
|
||||
add_deploy_lib(QQt)
|
||||
#如果用户依赖了其他的lib,便可以用add_deploy_lib进行拷贝依赖到app发布区域。
|
||||
add_deploy_library(QQt)
|
||||
#如果用户依赖了其他的lib,便可以用add_deploy_library进行拷贝依赖到app发布区域。
|
||||
#并且这个工作,后续持续收到add_deploy配置开关的控制。
|
||||
#note: add_deploy 一个配置开关 一个函数 两个都有效使用
|
||||
#注意,用户必须先发布lib 再发布app
|
||||
|
@ -167,7 +167,7 @@ contains(CONFIG, continued_build){
|
||||
#################################################################
|
||||
#包含lib的header.pri用于公开给用户头文件。
|
||||
#
|
||||
include (lib_header.pri)
|
||||
include (qqt_header.pri)
|
||||
|
||||
#设置版本 必要
|
||||
add_version(2,4,0,0)
|
||||
|
@ -35,6 +35,6 @@ FORMS += \
|
||||
|
||||
system(touch main.cpp)
|
||||
include (../../multi-link/add_base_manager.pri)
|
||||
add_deploy_lib(QQt)
|
||||
add_deploy_library(QQt)
|
||||
add_deploy()
|
||||
message($$QMAKE_POST_LINK)
|
||||
|
Loading…
x
Reference in New Issue
Block a user