2018-05-21 07:54:48 +08:00
|
|
|
|
#---------------------------------------------------------------------
|
2018-05-24 21:06:03 +08:00
|
|
|
|
#add_deploy_config.pri
|
2018-05-25 20:03:31 +08:00
|
|
|
|
#用于发布app的配置文件。只是app工程使用
|
2018-05-21 07:54:48 +08:00
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
|
|
2018-05-24 21:06:03 +08:00
|
|
|
|
defineReplace(add_deploy_config_on_mac) {
|
2018-05-21 07:54:48 +08:00
|
|
|
|
dirs = $$1
|
2018-05-24 21:06:03 +08:00
|
|
|
|
!isEmpty(2): error("add_deploy_config_on_mac(dirs) requires one argument")
|
|
|
|
|
isEmpty(1): error("add_deploy_config_on_mac(dirs) requires one argument")
|
2018-05-21 07:54:48 +08:00
|
|
|
|
|
|
|
|
|
command =
|
2018-05-22 14:38:26 +08:00
|
|
|
|
command += $$COPY_DIR $${dirs} $${APP_DEST_PWD}/$${TARGET}.app/Contents/MacOS/ $$CMD_SEP
|
2018-05-21 07:54:48 +08:00
|
|
|
|
command += $$COPY_DIR $${dirs} $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/
|
|
|
|
|
#message($$command)
|
|
|
|
|
return ($$command)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-05-24 21:06:03 +08:00
|
|
|
|
defineReplace(add_deploy_config_on_linux) {
|
2018-05-21 07:54:48 +08:00
|
|
|
|
#need QQT_BUILD_PWD
|
|
|
|
|
dirs = $$1
|
2018-05-24 21:06:03 +08:00
|
|
|
|
!isEmpty(2): error("add_deploy_config_on_linux(dirs) requires one argument")
|
|
|
|
|
isEmpty(1): error("add_deploy_config_on_linux(dirs) requires one argument")
|
2018-05-21 07:54:48 +08:00
|
|
|
|
command =
|
2018-05-22 14:38:26 +08:00
|
|
|
|
command += $$COPY_DIR $${dirs} $${APP_DEST_PWD} $$CMD_SEP
|
2018-05-21 07:54:48 +08:00
|
|
|
|
command += $$COPY_DIR $${dirs} $${APP_DEPLOY_PWD}
|
|
|
|
|
#message($$command)
|
|
|
|
|
return ($$command)
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-24 21:06:03 +08:00
|
|
|
|
defineTest(add_deploy_config) {
|
2018-05-21 07:54:48 +08:00
|
|
|
|
|
2018-05-22 14:38:26 +08:00
|
|
|
|
APP_CONFIG_PWD = $$1
|
2018-05-24 21:06:03 +08:00
|
|
|
|
isEmpty(1)|!isEmpty(2): error("add_deploy_config(APP_CONFIG_PWD) requires one argument")
|
2018-05-22 14:38:26 +08:00
|
|
|
|
|
|
|
|
|
#如果 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()
|
|
|
|
|
}
|
2018-05-21 07:54:48 +08:00
|
|
|
|
|
2018-05-22 14:38:26 +08:00
|
|
|
|
##4.8 qmake arm32 return() 函数无效
|
|
|
|
|
##qmake 与逻辑为 :
|
|
|
|
|
!isEmpty(APP_CONFIG_PWD):!isEmpty(APP_DEPLOY_PWD) {
|
2018-05-24 21:06:03 +08:00
|
|
|
|
CONFIG += add_deploy_config
|
2018-05-22 14:38:26 +08:00
|
|
|
|
message("$${TARGET} has deploied some config files")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK += $$CMD_SEP
|
|
|
|
|
contains(QSYS_PRIVATE, Win32||Win64) {
|
2018-05-24 21:06:03 +08:00
|
|
|
|
QMAKE_POST_LINK += $$add_deploy_config_on_linux("$${APP_CONFIG_PWD}\\*")
|
2018-05-22 14:38:26 +08:00
|
|
|
|
} else: contains(QSYS_PRIVATE, macOS) {
|
2018-05-24 21:06:03 +08:00
|
|
|
|
QMAKE_POST_LINK += $$add_deploy_config_on_mac("$${APP_CONFIG_PWD}/*")
|
2018-05-22 14:38:26 +08:00
|
|
|
|
} else: contains(QSYS_PRIVATE, Android||AndroidX86) {
|
2018-05-21 07:54:48 +08:00
|
|
|
|
#分为Host为Windows和类Unix两种情况。
|
|
|
|
|
#Android下使用qrc,无法发布配置文件。
|
|
|
|
|
equals(QMAKE_HOST.os, Windows){
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2018-05-24 21:06:03 +08:00
|
|
|
|
QMAKE_POST_LINK += $$add_deploy_config_on_linux("$${APP_CONFIG_PWD}/*")
|
2018-05-21 07:54:48 +08:00
|
|
|
|
}
|
2018-05-22 14:38:26 +08:00
|
|
|
|
|
|
|
|
|
return (1)
|
2018-05-21 07:54:48 +08:00
|
|
|
|
}
|
2018-05-22 14:38:26 +08:00
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
##work flow
|
|
|
|
|
################################################################################
|
|
|
|
|
APP_DEST_DIR=$${DESTDIR}
|
|
|
|
|
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
|
|
|
|
|
|
|
|
|
|
#这个需要用户手动调用.这个目录一般在源代码目录里
|
2018-05-24 21:06:03 +08:00
|
|
|
|
#add_deploy_config(<config_path>)
|