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

update multi link technology

This commit is contained in:
tianduanrui 2018-01-09 00:23:23 +08:00
parent 924bd66e84
commit 34a7996e52
34 changed files with 137 additions and 59 deletions

View File

@ -41,7 +41,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
include(../../src/app_deploy.pri)
#-------------------------------------------------

View File

@ -45,7 +45,7 @@ UI_DIR = obj/ui.h
RCC_DIR = qrc
DESTDIR = bin
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#install app

View File

@ -51,7 +51,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -28,7 +28,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -43,11 +43,11 @@ MOC_DIR = obj/moc.cpp
UI_DIR = obj/ui.h
RCC_DIR = qrc
#user can change this dir
DESTDIR = bin
#DESTDIR = bin
equals(QKIT_PRIVATE, macOS) {
QMAKE_PRE_LINK += echo hello
QMAKE_PRE_LINK += rm -rf $${DESTDIR}/$${TARGET}.app
#QMAKE_PRE_LINK += rm -rf $${DESTDIR}/$${TARGET}.app
}
#-------------------------------------------------
@ -55,7 +55,7 @@ equals(QKIT_PRIVATE, macOS) {
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
include(../../src/app_deploy.pri)
#-------------------------------------------------

View File

@ -44,7 +44,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -25,7 +25,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -28,5 +28,5 @@ FORMS += \
system(touch main.cpp)
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
include(../../src/app_deploy.pri)

View File

@ -51,7 +51,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
contains (DEFINES, __BLUETOOTH__){
SOURCES += \

View File

@ -43,7 +43,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -44,7 +44,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -1,10 +1,3 @@
################################################################
##config defination
################################################################
equals(QKIT_PRIVATE, macOS) {
CONFIG += app_bundle
}
################################################################
##build cache
################################################################
@ -17,18 +10,18 @@ DESTDIR = bin
################################################################
##link QQt
################################################################
include($${PWD}/link_qqt_library.pri)
include($${PWD}/app_link_qqt_library.pri)
################################################################
##link Other library
################################################################
################################################################
##deploy app for install update deploy
##config defination
################################################################
#optional
#if you have this request, include this pri in your app pro
#include($${PWD}/app_deploy.pri)
equals(QKIT_PRIVATE, macOS) {
CONFIG += app_bundle
}
#-------------------------------------------------
#install app
@ -52,3 +45,5 @@ can_install: unix {
#default
message ($${TARGET} config $${CONFIG})
message ($${TARGET} define $${DEFINES})

View File

@ -15,12 +15,15 @@ contains(QKIT_PRIVATE, WIN32||WIN64) {
APP_DEPLOY_PWD~=s,/,\\,g
}
APP_DEST_DIR=$${DESTDIR}
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
defineReplace(deploy_app_on_mac) {
#need QQT_BUILD_PWD
command = &&
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
command += $$RM_DIR $${APP_DEPLOY_PWD}/$${TARGET}.app &&
command += $$COPY_DIR $${DESTDIR}/$${TARGET}.app $${APP_DEPLOY_PWD}/$${TARGET}.app
command += $$COPY_DIR $${APP_DEST_DIR}/$${TARGET}.app $${APP_DEPLOY_PWD}/$${TARGET}.app
#message($$command)
return ($$command)
}
@ -31,7 +34,7 @@ defineReplace(deploy_app_on_win) {
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
command += $$RM $${APP_DEPLOY_PWD}\\$${TARGET}.exe $$CMD_SEP
command += $$COPY $${QQT_BUILD_PWD}\\QQt.dll $${APP_DEPLOY_PWD}\\QQt.dll $$CMD_SEP
command += $$COPY $${DESTDIR}\\$${TARGET}.exe $${APP_DEPLOY_PWD}\\$${TARGET}.exe $$CMD_SEP
command += $$COPY $${APP_DEST_DIR}\\$${TARGET}.exe $${APP_DEPLOY_PWD}\\$${TARGET}.exe $$CMD_SEP
#all windows need deploy release version?
equals(BUILD, Debug) {
#command += windeployqt $${APP_DEPLOY_PWD}\\$${TARGET}.exe --debug -verbose=1
@ -54,7 +57,7 @@ defineReplace(deploy_app_on_linux) {
command += $$COPY_DIR $${QQT_BUILD_PWD}/libQQt.so.$${QQT_VERSION1} $${APP_DEPLOY_PWD} &&
command += $$COPY_DIR $${QQT_BUILD_PWD}/libQQt.so $${APP_DEPLOY_PWD} &&
command += $$RM $${APP_DEPLOY_PWD}/$${TARGET} &&
command += $$COPY $${DESTDIR}/$${TARGET} $${APP_DEPLOY_PWD}/$${TARGET}
command += $$COPY $${APP_DEST_DIR}/$${TARGET} $${APP_DEPLOY_PWD}/$${TARGET}
#message($$command)
return ($$command)
}
@ -67,7 +70,7 @@ defineReplace(deploy_app_for_android) {
command += $$RM $${APP_DEPLOY_PWD}/libQQt.so* &&
command += $$COPY_DIR $${QQT_BUILD_PWD}/libQQt.so $${APP_DEPLOY_PWD} &&
command += $$RM $${APP_DEPLOY_PWD}/$${TARGET} &&
command += $$COPY $${DESTDIR}/$${TARGET} $${APP_DEPLOY_PWD}/$${TARGET}
command += $$COPY $${APP_DEST_DIR}/$${TARGET} $${APP_DEPLOY_PWD}/$${TARGET}
#message($$command)
return ($$command)
}

60
src/app_deploy_config.pri Normal file
View File

@ -0,0 +1,60 @@
#---------------------------------------------------------------------
#应用程序配置文件拷贝qmake文件。通过qmake与编译调用。
#如果需要修改拷贝到发布目录里的配置文件修改配置PWD下的文件即可引起编译PWD和发布PWD配置文件的改变。
#这个pri会拷贝配置PWD下的所有文件、文件夹到编译PWD和发布PWD下。
#---------------------------------------------------------------------
#依赖 APP_CONFIG_PWD APP_DEPLOY_PWD(in app deploy)
#examplein app's pro file
#APP_CONFIG_PWD = $${PWD}/../SysRoot
#win32 {
# APP_CONFIG_PWD ~=s,/,\\,g
#}
#如果 TARGET 没有配置 APP_CONFIG_PWD 那么返回,不拷贝任何配置
isEmpty(APP_CONFIG_PWD)||isEmpty(APP_DEPLOY_PWD) {
message("$${TARGET} hasn't deploy any cofig file")
return()
}
APP_DEST_DIR=$${DESTDIR}
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
defineReplace(copy_config_on_mac) {
#need QQT_BUILD_PWD
dirs = $$1
!isEmpty(2): error("copy_config_on_mac(dirs) requires one argument")
isEmpty(1): error("copy_config_on_mac(dirs) requires one argument")
command =
command += $$CMD_SEP
command += $$COPY_DIR $${dirs} $${APP_DEST_DIR}/$${TARGET}.app/Contents/MacOS/ $$CMD_SEP
command += $$COPY_DIR $${dirs} $${APP_DEPLOY_PWD}/$${TARGET}.app/Contents/MacOS/
#message($$command)
return ($$command)
}
defineReplace(copy_config) {
#need QQT_BUILD_PWD
dirs = $$1
!isEmpty(2): error("copy_config(dirs) requires one argument")
isEmpty(1): error("copy_config(dirs) requires one argument")
command =
command += $$CMD_SEP
command += $$COPY_DIR $${dirs} $${APP_DEST_DIR} $$CMD_SEP
command += $$COPY_DIR $${dirs} $${APP_DEPLOY_PWD}
#message($$command)
return ($$command)
}
CONFIG += app_copy_config
contains(CONFIG, app_copy_config) {
contains(QKIT_PRIVATE, WIN32||WIN64) {
QMAKE_POST_LINK += $$copy_config("$${APP_CONFIG_PWD}\\*")
} else: contains(QKIT_PRIVATE, macOS) {
QMAKE_POST_LINK += $$copy_config_on_mac("$${APP_CONFIG_PWD}/*")
} else {
QMAKE_POST_LINK += $$copy_config("$${APP_CONFIG_PWD}/*")
}
}

View File

@ -1,3 +1,6 @@
################################################################
##link QQt
################################################################
#here is all your app common defination and configration
#you can modify this pri to link qqt_library
#only link QQt, this pri file.
@ -78,7 +81,7 @@ isEmpty(QQT_BUILD_ROOT)|isEmpty(QQT_SDK_ROOT) {
message($${CONFIG_FILE})
message("QQT_BUILD_ROOT = /user/set/path is required, please modify qmake/app_configure.pri")
message("QQT_SDK_ROOT = /user/set/path is required")
message("linux platform this pri is under qqt_library.pri")
message("linux platform this pri is under app_link_qqt_library.pri")
error(" please check $$CONFIG_FILE")
}
message(QQt build root: $$QQT_BUILD_ROOT)
@ -143,3 +146,5 @@ contains (CONFIG, QQT_SOURCE_BUILDIN) {
#need qqt_install.pri
include($${QQT_SOURCE_ROOT}/qqt_library.pri)
}

View File

@ -35,7 +35,7 @@ win32:DEFINES += _TTY_WIN_
win32:LIBS += -lsetupapi
DESTDIR = build
#DESTDIR = build
#DESTDIR = examples/enumerator/debug
#DESTDIR = examples/qespta/debug
#DESTDIR = examples/event/debug

View File

@ -94,6 +94,13 @@ build_pass:CONFIG(debug, debug|release) {
CLFLAGS = -Wno-unused-parameter -Wno-reorder -Wno-c++11-extensions -Wno-c++11-long-long -Wno-comment
QMAKE_CFLAGS += $${CLFLAGS}
QMAKE_CXXFLAGS += $${CLFLAGS}
#################################################################
##build cache
#################################################################
#LibQQt工程里这个值是不允许改变的但是再App工程里可以改变
DESTDIR = bin
#################################################################
##project Headers
#################################################################

View File

@ -67,12 +67,18 @@ contains(QKIT_PRIVATE, WIN32) {
}
################################################################
##build cache
##build cache (此处为中间目标,对用户并不重要)
##此处加以干涉,使目录清晰。
##此处关于DESTDIR的设置导致用户必须把这个文件的包含提前到最前边的位置才能进行App里的目录操作。
##删除干涉?
##用户注意首先include(app_link_qqt_library.pri)然后做app的工作和include其他pri包括LibQQt提供的其他pri保证这个顺序就不会出错了。
##对编译目标目录进行干涉管理,显得更加细腻。
################################################################
isEmpty(OBJECTS_DIR):OBJECTS_DIR = obj
isEmpty(MOC_DIR):MOC_DIR = obj/moc.cpp
isEmpty(UI_DIR):UI_DIR = obj/ui.h
isEmpty(RCC_DIR):RCC_DIR = qrc
#这样做保持了App工程和LibQQt工程目录的一致性但是并不必要。
isEmpty(DESTDIR):DESTDIR = bin
################################################################

View File

@ -23,35 +23,35 @@ defineReplace(link_qqt_library) {
#在Mac上运行前必须拷贝依赖是个deploy过程。
#Mac不用于其他操作系统对于bundle任何运行时刻都需要拷贝依赖包括build完成后。
defineReplace(deploy_qqt_on_mac) {
defineReplace(deploy_qqt_to_mac) {
#need QQT_BUILD_PWD
deploy_path = $$1
isEmpty(1): error("deploy_qqt_on_mac(deploy_path) requires one argument")
isEmpty(1): error("deploy_qqt_to_mac(deploy_path) requires one argument")
create_command = $$create_mac_sdk()
DEPLOY_DESTDIR=$${deploy_path}
isEmpty(DEPLOY_DESTDIR):DEPLOY_DESTDIR=.
APP_DEST_DIR=$${deploy_path}
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
command =
command += chmod +x $${PWD}/linux_cur_path.sh &&
command += . $${PWD}/linux_cur_path.sh &&
command += rm -rf $${DEPLOY_DESTDIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
command += mkdir -p $${DEPLOY_DESTDIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
command += cd $${DEPLOY_DESTDIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
command += rm -rf $${APP_DEST_DIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
command += mkdir -p $${APP_DEST_DIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
command += cd $${APP_DEST_DIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
command += $${create_command} &&
command += chmod +x $${PWD}/linux_cd_path.sh &&
command += . $${PWD}/linux_cd_path.sh &&
#Qt Creator create framework but use absolute path to make link
#QMAKE_POST_LINK += cp -rf $${QQT_LIB_PWD}/QQt.framework \
# $${DEPLOY_DESTDIR}/$${TARGET}.app/Contents/Frameworks &&
# $${APP_DEST_DIR}/$${TARGET}.app/Contents/Frameworks &&
command += install_name_tool -change QQt.framework/Versions/$${QQT_MAJOR_VERSION}/QQt \
@rpath/QQt.framework/Versions/$${QQT_MAJOR_VERSION}/QQt \
$${DEPLOY_DESTDIR}/$${TARGET}.app/Contents/MacOS/$${TARGET} &&
command += macdeployqt $${DEPLOY_DESTDIR}/$${TARGET}.app -verbose=1
$${APP_DEST_DIR}/$${TARGET}.app/Contents/MacOS/$${TARGET} &&
command += macdeployqt $${APP_DEST_DIR}/$${TARGET}.app -verbose=1
lessThan(QT_MAJOR_VERSION, 5){
command += &&
command += chmod +x $${PWD}/mac_deploy_qt4.sh &&
command += $${PWD}/mac_deploy_qt4.sh $${DEPLOY_DESTDIR}/$${TARGET}.app/Contents/MacOS/$${TARGET}
command += $${PWD}/mac_deploy_qt4.sh $${APP_DEST_DIR}/$${TARGET}.app/Contents/MacOS/$${TARGET}
}
#message($$command)
return ($$command)
@ -59,7 +59,9 @@ defineReplace(deploy_qqt_on_mac) {
defineReplace(copy_qqt_on_mac) {
#need QQT_BUILD_PWD
command = $$deploy_qqt_on_mac($${DESTDIR})
APP_DEST_DIR=$${DESTDIR}
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
command = $$deploy_qqt_to_mac($${APP_DEST_DIR})
return ($$command)
}

View File

@ -28,7 +28,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -41,7 +41,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -36,4 +36,4 @@ FORMS += \
CONFIG += mobility
MOBILITY =
include ($${PWD}/../../src/app_linking.pri)
include ($${PWD}/../../src/app_link_qqt_library.pri)

View File

@ -14,7 +14,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -40,7 +40,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -27,7 +27,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -47,7 +47,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -37,7 +37,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -3,7 +3,7 @@
# Project created by QtCreator 2016-06-17T10:03:52
#
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
QT += core gui

View File

@ -3,7 +3,7 @@
# Project created by QtCreator 2016-06-17T10:03:52
#
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
QT += core gui

View File

@ -28,7 +28,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -27,7 +27,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -38,7 +38,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -45,7 +45,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly

View File

@ -45,7 +45,7 @@ system("touch main.cpp")
#if you link a library to your app, on android you must select the running kit to the app, not LibQQt e.g.
#user can modify any infomation under this annotation
#-------------------------------------------------
include(../../src/app_linking.pri)
include(../../src/app_link_qqt_library.pri)
#-------------------------------------------------
#user app may use these these settings prefertly