From 6bd892de75fde4199f1cc74b116894318a9b3b00 Mon Sep 17 00:00:00 2001 From: tianduanrui <2407223896@qq.com> Date: Sat, 2 Dec 2017 18:31:08 +0800 Subject: [PATCH] update MLMA --- examples/qqtframe2/app_configure.pri | 5 +++ examples/qqtframe2/app_deploy.pri | 31 +++++++++++---- examples/qqtframe2/qqtframe2.pro | 3 +- src/app_configure.pri | 59 ++++++++++++++++++++++++++++ src/app_deploy.pri | 44 +++++++++++++++++++++ 5 files changed, 133 insertions(+), 9 deletions(-) create mode 100644 src/app_configure.pri create mode 100644 src/app_deploy.pri diff --git a/examples/qqtframe2/app_configure.pri b/examples/qqtframe2/app_configure.pri index 3adc25c3..7c045d25 100644 --- a/examples/qqtframe2/app_configure.pri +++ b/examples/qqtframe2/app_configure.pri @@ -46,6 +46,11 @@ include(../../src/link_qqt_library.pri) ##link Other library ################################################################ +################################################################ +##deploy app for install update deploy +################################################################ +include(app_deploy.pri) + #------------------------------------------------- ##project environ print #------------------------------------------------- diff --git a/examples/qqtframe2/app_deploy.pri b/examples/qqtframe2/app_deploy.pri index 664e1f73..91016578 100644 --- a/examples/qqtframe2/app_deploy.pri +++ b/examples/qqtframe2/app_deploy.pri @@ -2,19 +2,36 @@ #user computer path settings #------------------------------------------------------------- #deploy root -equals(QMAKE_HOST.os, Darwin) { - APP_DEPLOY_ROOT = $$PWD/../../../deployer -} else: equals(QMAKE_HOST.os, Linux) { - APP_DEPLOY_ROOT = $$PWD/../../../deployer -} else: equals(QMAKE_HOST.os, Windows) { - APP_DEPLOY_ROOT = $$PWD/../../../deployer +CONFIG_PATH = +CONFIG_FILE = + +win32 { + CONFIG_PATH = $$user_config_path()\\QQt + CONFIG_FILE = $${CONFIG_PATH}\\app.ini +} else { + CONFIG_PATH = $$user_config_path()/.QQt + CONFIG_FILE = $${CONFIG_PATH}/app.ini } +message($${TARGET} config path: $$CONFIG_PATH config file: $${CONFIG_FILE}) + +!exists($${CONFIG_FILE}) { + empty_file($${CONFIG_FILE}) + #qt4 need this ret, why? + ret = $$system(echo [$${TARGET}] >> $${CONFIG_FILE}) + ret = $$system(echo APP_DEPLOY_ROOT = >> $${CONFIG_FILE}) +} + +isEmpty(APP_DEPLOY_ROOT): APP_DEPLOY_ROOT = $$read_ini("$${CONFIG_FILE}", "$${TARGET}", "APP_DEPLOY_ROOT") +message($${TARGET} deploy root: $$APP_DEPLOY_ROOT) +isEmpty(APP_DEPLOY_ROOT):error(APP_DEPLOY_ROOT required please check app.ini at $$CONFIG_PATH) + + defineReplace(deploy_app_on_mac) { #need QQT_BUILD_PWD command = && command += rm -fr $${APP_DEPLOY_ROOT}/$${TARGET}.app && - command += cp -fa $${DESTDIR}/$${TARGET}.app $${APP_DEPLOY_ROOT} + command += cp -fa $${DESTDIR}/$${TARGET}.app $${APP_DEPLOY_ROOT}/ message($$command) return ($$command) } diff --git a/examples/qqtframe2/qqtframe2.pro b/examples/qqtframe2/qqtframe2.pro index f6394601..91e98f0a 100644 --- a/examples/qqtframe2/qqtframe2.pro +++ b/examples/qqtframe2/qqtframe2.pro @@ -28,5 +28,4 @@ FORMS += \ system(touch main.cpp) -include(../qqtframe2/app_configure.pri) -include(../qqtframe2/app_deploy.pri) +include(../../src/app_configure.pri) diff --git a/src/app_configure.pri b/src/app_configure.pri new file mode 100644 index 00000000..44823e12 --- /dev/null +++ b/src/app_configure.pri @@ -0,0 +1,59 @@ +#------------------------------------------------- +#install app +#------------------------------------------------- +#CONFIG += can_install +can_install:equals(QKIT_PRIVATE, EMBEDDED) { + target.path = /Application + INSTALLS += target +} else: unix { + equals(QKIT_PRIVATE, macOS) { + target.path = /Applications + INSTALLS += target + } +} + +############ +##config defination +############ +equals(QKIT_PRIVATE, macOS) { + CONFIG += app_bundle +} + +contains(QKIT_PRIVATE, ANDROID|ANDROIDX86) { + CONFIG += mobility + MOBILITY = + DISTFILES += \ + android/AndroidManifest.xml + + ANDROID_PACKAGE_SOURCE_DIR = $${PWD}/android +} + +################################################################ +##build cache +################################################################ +OBJECTS_DIR = obj +MOC_DIR = obj/moc.cpp +UI_DIR = obj/ui.h +RCC_DIR = qrc +DESTDIR = bin + +################################################################ +##link QQt +################################################################ +include($${PWD}/link_qqt_library.pri) + +################################################################ +##link Other library +################################################################ + +################################################################ +##deploy app for install update deploy +################################################################ +include($${PWD}/app_deploy.pri) + +#------------------------------------------------- +##project environ print +#------------------------------------------------- +#default +message ($${TARGET} config $${CONFIG}) +message ($${TARGET} define $${DEFINES}) diff --git a/src/app_deploy.pri b/src/app_deploy.pri new file mode 100644 index 00000000..91016578 --- /dev/null +++ b/src/app_deploy.pri @@ -0,0 +1,44 @@ +#------------------------------------------------------------- +#user computer path settings +#------------------------------------------------------------- +#deploy root +CONFIG_PATH = +CONFIG_FILE = + +win32 { + CONFIG_PATH = $$user_config_path()\\QQt + CONFIG_FILE = $${CONFIG_PATH}\\app.ini +} else { + CONFIG_PATH = $$user_config_path()/.QQt + CONFIG_FILE = $${CONFIG_PATH}/app.ini +} + +message($${TARGET} config path: $$CONFIG_PATH config file: $${CONFIG_FILE}) + +!exists($${CONFIG_FILE}) { + empty_file($${CONFIG_FILE}) + #qt4 need this ret, why? + ret = $$system(echo [$${TARGET}] >> $${CONFIG_FILE}) + ret = $$system(echo APP_DEPLOY_ROOT = >> $${CONFIG_FILE}) +} + +isEmpty(APP_DEPLOY_ROOT): APP_DEPLOY_ROOT = $$read_ini("$${CONFIG_FILE}", "$${TARGET}", "APP_DEPLOY_ROOT") +message($${TARGET} deploy root: $$APP_DEPLOY_ROOT) +isEmpty(APP_DEPLOY_ROOT):error(APP_DEPLOY_ROOT required please check app.ini at $$CONFIG_PATH) + + +defineReplace(deploy_app_on_mac) { + #need QQT_BUILD_PWD + command = && + command += rm -fr $${APP_DEPLOY_ROOT}/$${TARGET}.app && + command += cp -fa $${DESTDIR}/$${TARGET}.app $${APP_DEPLOY_ROOT}/ + message($$command) + return ($$command) +} + +CONFIG += deploy_app +contains(CONFIG, deploy_app) { + contains(QKIT_PRIVATE, macOS) { + QMAKE_POST_LINK += $$deploy_app_on_mac() + } +}