1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

update add deploy config

This commit is contained in:
tianduanrui 2018-05-26 11:03:48 +08:00
parent 77430d82bc
commit 7d84ab983f
6 changed files with 65 additions and 47 deletions

View File

@ -195,7 +195,7 @@ defineTest(add_deploy) {
message(APP_DEPLOY_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri )
error(please check $$CONFIG_FILE under add_multi_link_technology.pri)
}
message(Deploy $${TARGET} to $$APP_DEPLOY_ROOT/$${TARGET}/$$QSYS_STD_DIR)
message($${TARGET} is deployed to $$APP_DEPLOY_ROOT/$${TARGET}/$$QSYS_STD_DIR)
#起始位置 编译位置 中间目标位置
APP_DEST_PWD=$${DESTDIR}
@ -216,13 +216,11 @@ defineTest(add_deploy) {
#不会走到
isEmpty(APP_DEPLOY_ROOT) {
message("$${TARGET} hasn't deployed any app files")
greaterThan(QT_MAJOR_VERSION, 5):return()
return(0)
}
##4.8 qmake arm32 return() 函数无效
!isEmpty(APP_DEPLOY_ROOT) {
#这里定义了一个配置开关,但是用户可以忽略
#CONFIG += add_deploy
message("$${TARGET} has deployed some app files")
}

View File

@ -1,15 +1,20 @@
#---------------------------------------------------------------------
#add_deploy_config.pri
#用于发布app的配置文件。只是app工程使用
#这个目录一般在源代码目录里
#add_deploy_config(<config_path>)
#---------------------------------------------------------------------
################################################################################
#内部用函数
################################################################################
defineReplace(add_deploy_config_on_mac) {
dirs = $$1
!isEmpty(2): error("add_deploy_config_on_mac(dirs) requires one argument")
isEmpty(1): error("add_deploy_config_on_mac(dirs) requires one argument")
isEmpty(1)|!isEmpty(2): error("add_deploy_config_on_mac(dirs) requires one argument")
command =
command += $$COPY_DIR $${dirs} $${APP_DEST_PWD}/$${TARGET}.app/Contents/MacOS/ $$CMD_SEP
command += $$COPY_DIR $${dirs} $${APP_BUILD_PWD}/$${TARGET}.app/Contents/MacOS/ $$CMD_SEP
command += $$COPY_DIR $${dirs} $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/
#message($$command)
return ($$command)
@ -19,39 +24,64 @@ defineReplace(add_deploy_config_on_mac) {
defineReplace(add_deploy_config_on_linux) {
#need QQT_BUILD_PWD
dirs = $$1
!isEmpty(2): error("add_deploy_config_on_linux(dirs) requires one argument")
isEmpty(1): error("add_deploy_config_on_linux(dirs) requires one argument")
isEmpty(1)|!isEmpty(2): 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_BUILD_PWD} $$CMD_SEP
command += $$COPY_DIR $${dirs} $${APP_DEPLOY_PWD}
#message($$command)
return ($$command)
}
################################################################################
#外部用函数
################################################################################
defineTest(add_deploy_config) {
APP_CONFIG_PWD = $$1
isEmpty(1)|!isEmpty(2): error("add_deploy_config(APP_CONFIG_PWD) requires one argument")
isEmpty(1)|!isEmpty(2): error("add_deploy_config(app_config_pwd) requires one argument")
#deploy root
isEmpty(APP_DEPLOY_ROOT){
message($${TARGET} $${CONFIG_FILE})
message(APP_DEPLOY_ROOT = /user/set/path is required, please modify .qmake/app_configure.pri )
error(please check $$CONFIG_FILE under add_multi_link_technology.pri)
}
message($${TARGET} deployes config 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.
#lib project会发布配置文件吗
APP_DEPLOY_PWD = $${APP_DEPLOY_ROOT}/$${TARGET}/$${QSYS_STD_DIR}
#不仅仅发布目标为Windows的时候才需要改变路径
#开发机为Windows就必须改变。
#contains(QKIT_PRIVATE, WIN32||WIN64) {
equals(QMAKE_HOST.os, Windows) {
APP_DEPLOY_PWD~=s,/,\\,g
}
#如果 TARGET 没有配置 APP_CONFIG_PWD 那么返回,不拷贝任何配置
#qmake 或逻辑为 | 或者 ||
isEmpty(APP_CONFIG_PWD)|isEmpty(APP_DEPLOY_PWD) {
message("$${TARGET} hasn't deployed any config files")
greaterThan(QT_MAJOR_VERSION, 5):return()
return(0)
}
##4.8 qmake arm32 return() 函数无效
##qmake 与逻辑为 :
!isEmpty(APP_CONFIG_PWD):!isEmpty(APP_DEPLOY_PWD) {
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 += $$add_deploy_config_on_linux("$${APP_CONFIG_PWD}\\*")
} else: contains(QSYS_PRIVATE, macOS) {
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP
contains(QSYS_PRIVATE, macOS) {
QMAKE_POST_LINK += $$add_deploy_config_on_mac("$${APP_CONFIG_PWD}/*")
} else: contains(QSYS_PRIVATE, Win32||Win64) {
QMAKE_POST_LINK += $$add_deploy_config_on_linux("$${APP_CONFIG_PWD}\\*")
} else: contains(QSYS_PRIVATE, Android||AndroidX86) {
#分为Host为Windows和类Unix两种情况。
#Android下使用qrc无法发布配置文件。
@ -62,14 +92,7 @@ defineTest(add_deploy_config) {
QMAKE_POST_LINK += $$add_deploy_config_on_linux("$${APP_CONFIG_PWD}/*")
}
export(QMAKE_POST_LINK)
return (1)
}
################################################################################
##work flow
################################################################################
APP_DEST_DIR=$${DESTDIR}
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
#这个需要用户手动调用.这个目录一般在源代码目录里
#add_deploy_config(<config_path>)

View File

@ -39,8 +39,9 @@ contains(QMAKE_HOST.os,Windows) {
RM_DIR = rm -rf
#PATH_SEP=/
}
################################################
##get command string
##get command string 这些函数一般内部使用
################################################
defineReplace(get_mkdir) {
filepath = $$1
@ -186,7 +187,7 @@ defineReplace(get_user_config_path) {
#}
################################################
##custom functions
##custom functions 用户喜欢这些函数
################################################
# system is default a replace and test function, can be used in condition, but
# system execute succ return 1 fail return 0 it is not follow command error code.

View File

@ -2,6 +2,10 @@
#应用程序语言翻译qmake文件。通过qmake与编译调用。
#如果需要增加某国语言add_language(...)即可。
#---------------------------------------------------------------------
#$$APP_SOURCE_PWD on mac TRANSLATIONS error, why?
#APP_SOURCE_PWD=$${PWD}
#用户在macOS下下使用PWD符号
##############################################################################
#内部函数
##############################################################################
@ -107,9 +111,10 @@ defineTest(add_zh_CN_en_US){
return (1)
}
##########################
############################################################################################################################################################
#以下翻译过程qmake的时候执行
##########################
#以下函数设计思路正常但是qmake执行堵死请勿使用无奈。
############################################################################################################################################################
#输入pro的完整路径
defineTest(qmake_lupdate_language){
#pro file
@ -164,7 +169,3 @@ defineTest(add_qmake_zh_CN_en_US){
return (1)
}
#$$APP_SOURCE_PWD on mac TRANSLATIONS error, why?
#APP_SOURCE_PWD=$${PWD}
#用户在macOS下下使用PWD符号

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWindow</name>
<message>
<location filename="../../mainwindow.ui" line="13"/>
<source>MainWindow</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View File

@ -52,7 +52,14 @@ add_deploy_library(QQt)
#对于这个先后顺序macOS下要求比较严格
#必须先发布App
#添加语言 de_DE
add_language($${PWD}/$${TARGET}.pro, $${PWD}/AppRoot/lang, de_DE)
#添加语言 zh_CN en_US
add_zh_CN_en_US($${PWD}/$${TARGET}.pro, $${PWD}/AppRoot/lang)
#发布配置文件 把AppRoot里的配置项目拷贝到运行目录和发布目录
add_deploy_config($${PWD}/AppRoot)
message($$QMAKE_PRE_LINK)
message($$QMAKE_POST_LINK)