mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
add multi link
This commit is contained in:
parent
048b87c13b
commit
ea916fc8d2
7
multi-link/app_base_manager.pri
Normal file
7
multi-link/app_base_manager.pri
Normal file
@ -0,0 +1,7 @@
|
||||
#---------------------------------------------------------------------------------
|
||||
#app_base_manager.pri
|
||||
#应用程序和Library的基础管理器,统一使用这个管理器。
|
||||
#
|
||||
#---------------------------------------------------------------------------------
|
||||
|
||||
include($${PWD}/multi_link_technology.pri)
|
9
multi-link/app_custom_manager.pri
Normal file
9
multi-link/app_custom_manager.pri
Normal file
@ -0,0 +1,9 @@
|
||||
#----------------------------------------------------------------
|
||||
#app_custom_manager.pri
|
||||
#这个文件用于给用户自定义管理内容,随意添加自己所需要的library、defines、config等等。
|
||||
#拷贝到用户app工程目录里使用用
|
||||
#----------------------------------------------------------------
|
||||
################################################################
|
||||
##link Other library
|
||||
################################################################
|
||||
#LIBS +=
|
177
multi-link/app_deploy.pri
Normal file
177
multi-link/app_deploy.pri
Normal file
@ -0,0 +1,177 @@
|
||||
#-------------------------------------------------------------
|
||||
#app_deploy.pri
|
||||
#提供app发布函数,只是app工程使用
|
||||
#-------------------------------------------------------------
|
||||
#Multi-link技术 app_deploy部分只能应用于Qt5,Qt4没有windeployqt程序,如果用户为Qt4编译了windeployqt那么也可以用于Qt4。
|
||||
|
||||
################################################################################
|
||||
#内部用函数
|
||||
#获取命令
|
||||
################################################################################
|
||||
|
||||
#在build path修复app (macOS专有)
|
||||
#copy lib
|
||||
#fix bundle路径链接
|
||||
defineReplace(app_deploy_with_lib_on_mac) {
|
||||
#need QQT_BUILD_PWD
|
||||
deploy_path = $$1
|
||||
isEmpty(1): error("app_deploy_with_lib_on_mac(deploy_path) requires one argument")
|
||||
create_command = $$create_mac_sdk()
|
||||
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 $${APP_DEST_DIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
|
||||
#拷贝QQt.framework到app bundle里。其实,是直接在app里执行的。这个会移动走。
|
||||
command += mkdir -p $${APP_DEST_DIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
|
||||
command += cd $${APP_DEST_DIR}/$${TARGET}.app/Contents/Frameworks/QQt.framework &&
|
||||
#修复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 \
|
||||
# $${APP_DEST_DIR}/$${TARGET}.app/Contents/Frameworks &&
|
||||
#更改app bundle链接QQt的位置。
|
||||
command += install_name_tool -change QQt.framework/Versions/$${QQT_MAJOR_VERSION}/QQt \
|
||||
@rpath/QQt.framework/Versions/$${QQT_MAJOR_VERSION}/QQt \
|
||||
$${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 $${APP_DEST_DIR}/$${TARGET}.app/Contents/MacOS/$${TARGET}
|
||||
}
|
||||
#message($$command)
|
||||
return ($${command})
|
||||
}
|
||||
|
||||
defineReplace(fix_app_bundle_with_qqt_in_building_path_on_mac) {
|
||||
#need QQT_BUILD_PWD
|
||||
APP_DEST_DIR=$${DESTDIR}
|
||||
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
|
||||
command = $$deploy_qqt_to_app_deploy_path_on_mac($${APP_DEST_DIR})
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(app_deploy_on_mac) {
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$RM_DIR $${APP_DEPLOY_PWD}/$${TARGET}.app $$CMD_SEP
|
||||
command += $$COPY_DIR $${APP_DEST_DIR}/$${TARGET}.app $${APP_DEPLOY_PWD}/$${TARGET}.app
|
||||
#message($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(app_deploy_on_win) {
|
||||
#need QQT_BUILD_PWD
|
||||
command =
|
||||
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
|
||||
msvc:command += $$COPY_DIR $${QQT_BUILD_PWD}\\QQt.* $${APP_DEST_DIR} $$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
|
||||
msvc{
|
||||
command += windeployqt $${APP_DEPLOY_PWD}\\$${TARGET}.exe --debug -verbose=1
|
||||
} else {
|
||||
command += windeployqt $${APP_DEPLOY_PWD}\\$${TARGET}.exe --release -verbose=1
|
||||
}
|
||||
} else: equals(BUILD, Release) {
|
||||
#command += windeployqt $${APP_DEPLOY_PWD}\\$${TARGET}.exe --release -verbose=1
|
||||
command += windeployqt $${APP_DEPLOY_PWD}\\$${TARGET}.exe --release -verbose=1
|
||||
}
|
||||
#message($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(app_deploy_on_linux) {
|
||||
#need QQT_BUILD_PWD
|
||||
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$RM $${APP_DEPLOY_PWD}/libQQt.so* $$CMD_SEP
|
||||
command += $$COPY_DIR $${QQT_BUILD_PWD}/libQQt.so.$${QQT_VERSION3} $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$COPY_DIR $${QQT_BUILD_PWD}/libQQt.so.$${QQT_VERSION2} $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$COPY_DIR $${QQT_BUILD_PWD}/libQQt.so.$${QQT_VERSION1} $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$COPY_DIR $${QQT_BUILD_PWD}/libQQt.so $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$RM $${APP_DEPLOY_PWD}/$${TARGET} $$CMD_SEP
|
||||
command += $$COPY $${APP_DEST_DIR}/$${TARGET} $${APP_DEPLOY_PWD}/$${TARGET}
|
||||
#message($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(app_deploy_on_android) {
|
||||
#need QQT_BUILD_PWD
|
||||
|
||||
command =
|
||||
command += $$MK_DIR $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$RM $${APP_DEPLOY_PWD}/libQQt.so* $$CMD_SEP
|
||||
command += $$COPY_DIR $${QQT_BUILD_PWD}/libQQt.so $${APP_DEPLOY_PWD} $$CMD_SEP
|
||||
command += $$RM $${APP_DEPLOY_PWD}/$${TARGET} $$CMD_SEP
|
||||
command += $$COPY $${APP_DEST_DIR}/$${TARGET} $${APP_DEPLOY_PWD}/$${TARGET}
|
||||
#message($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
##-------------------------------------------------
|
||||
##work flow
|
||||
##-------------------------------------------------
|
||||
#set app deploy pwd
|
||||
#APP_DEPLOY_PWD is here.
|
||||
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
|
||||
}
|
||||
|
||||
APP_DEST_DIR=$${DESTDIR}
|
||||
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
|
||||
|
||||
#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 app_multi_link_technology.pri)
|
||||
}
|
||||
message(Deploy $${TARGET} to $$APP_DEPLOY_ROOT/$${TARGET}/$$QKIT_STD_DIR)
|
||||
|
||||
#如果 配置文件里 没有配置 APP_DEPLOY_ROOT 那么返回,不拷贝发布任何应用
|
||||
#不会走到
|
||||
isEmpty(APP_DEPLOY_ROOT) {
|
||||
message("$${TARGET} hasn't deploied any app files")
|
||||
greaterThan(QT_MAJOR_VERSION, 5):return()
|
||||
}
|
||||
|
||||
##4.8 qmake arm32 return() 函数无效
|
||||
!isEmpty(APP_DEPLOY_ROOT) {
|
||||
CONFIG += app_deploy
|
||||
message("$${TARGET} has deploied some app files")
|
||||
}
|
||||
|
||||
|
||||
contains(CONFIG, app_deploy) {
|
||||
contains(QKIT_PRIVATE, WIN32||WIN64) {
|
||||
#发布windows版本
|
||||
QMAKE_POST_LINK += $$app_deploy_on_win()
|
||||
} else: contains(QKIT_PRIVATE, macOS) {
|
||||
#发布苹果版本,iOS版本也是这个?
|
||||
QMAKE_POST_LINK += $$CMD_SEP $$app_deploy_on_mac()
|
||||
} else: contains(QKIT_PRIVATE, ANDROID||ANDROIDX86) {
|
||||
#发布Android版本,这个分为开发Host为windows和类Unix两种情况。
|
||||
#Android下Qt Creator自动使用androidDeployQt,无法发布应用。
|
||||
equals(QMAKE_HOST.os, Windows){
|
||||
#
|
||||
} else { }
|
||||
#QMAKE_POST_LINK += $$app_deploy_on_android()
|
||||
} else {
|
||||
#发布linux、e-linux,这个是一样的。
|
||||
QMAKE_POST_LINK += $$app_deploy_on_linux()
|
||||
}
|
||||
}
|
76
multi-link/app_deploy_config.pri
Normal file
76
multi-link/app_deploy_config.pri
Normal file
@ -0,0 +1,76 @@
|
||||
#---------------------------------------------------------------------
|
||||
#app_deploy_config.pri
|
||||
#用于发布app的配置文件。
|
||||
#
|
||||
#应用程序配置文件拷贝qmake文件。通过qmake与编译调用。
|
||||
#如果需要修改拷贝到发布目录里的配置文件,修改配置PWD下的文件,即可引起编译PWD和发布PWD配置文件的改变。
|
||||
#这个pri会拷贝配置PWD下的所有文件、文件夹到编译PWD和发布PWD下。
|
||||
#依赖 APP_CONFIG_PWD(in app pro) APP_DEPLOY_PWD(in app deploy)
|
||||
#---------------------------------------------------------------------
|
||||
#example(in app's pro file)
|
||||
#APP_CONFIG_PWD = $${PWD}/../AppRoot
|
||||
#equals(QMAKE_HOST.os, Windows) {
|
||||
# APP_CONFIG_PWD ~=s,/,\\,g
|
||||
#}
|
||||
|
||||
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 += $$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 += $$COPY_DIR $${dirs} $${APP_DEST_DIR} $$CMD_SEP
|
||||
command += $$COPY_DIR $${dirs} $${APP_DEPLOY_PWD}
|
||||
#message($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
##-------------------------------------------------
|
||||
##work flow
|
||||
##-------------------------------------------------
|
||||
#如果 TARGET 没有配置 APP_CONFIG_PWD 那么返回,不拷贝任何配置
|
||||
#qmake 或逻辑为 | 或者 ||
|
||||
isEmpty(APP_CONFIG_PWD)|isEmpty(APP_DEPLOY_PWD) {
|
||||
message("$${TARGET} hasn't deploied any config files")
|
||||
greaterThan(QT_MAJOR_VERSION, 5):return()
|
||||
}
|
||||
|
||||
##4.8 qmake arm32 return() 函数无效
|
||||
##qmake 与逻辑为 :
|
||||
!isEmpty(APP_CONFIG_PWD):!isEmpty(APP_DEPLOY_PWD) {
|
||||
CONFIG += app_copy_config
|
||||
message("$${TARGET} has deploied some config files")
|
||||
}
|
||||
|
||||
contains(CONFIG, app_copy_config) {
|
||||
APP_DEST_DIR=$${DESTDIR}
|
||||
isEmpty(APP_DEST_DIR):APP_DEST_DIR=.
|
||||
contains(QKIT_PRIVATE, WIN32||WIN64) {
|
||||
QMAKE_POST_LINK += $$CMD_SEP $$copy_config("$${APP_CONFIG_PWD}\\*")
|
||||
} else: contains(QKIT_PRIVATE, macOS) {
|
||||
QMAKE_POST_LINK += $$CMD_SEP $$copy_config_on_mac("$${APP_CONFIG_PWD}/*")
|
||||
} else: contains(QKIT_PRIVATE, ANDROID||ANDROIDX86) {
|
||||
#分为Host为Windows和类Unix两种情况。
|
||||
#Android下使用qrc,无法发布配置文件。
|
||||
equals(QMAKE_HOST.os, Windows){
|
||||
} else {
|
||||
}
|
||||
#QMAKE_POST_LINK += $$deploy_app_on_android()
|
||||
} else {
|
||||
QMAKE_POST_LINK += $$CMD_SEP $$copy_config("$${APP_CONFIG_PWD}/*")
|
||||
}
|
||||
}
|
30
multi-link/app_language.pri
Normal file
30
multi-link/app_language.pri
Normal file
@ -0,0 +1,30 @@
|
||||
#---------------------------------------------------------------------
|
||||
#应用程序语言翻译qmake文件。通过qmake与编译调用。
|
||||
#如果需要增加某国语言,修改这个文件即可。
|
||||
#拷贝到用户app工程目录里使用用
|
||||
#---------------------------------------------------------------------
|
||||
#$$APP_SOURCE_PWD on mac TRANSLATIONS error, why?
|
||||
APP_SOURCE_PWD=$${PWD}
|
||||
|
||||
TRANSLATIONS = $${PWD}/AppRoot/lang/zh_CN.ts $${PWD}/AppRoot/lang/en_US.ts
|
||||
|
||||
defineReplace(lupdate_language){
|
||||
command =
|
||||
#only pro path
|
||||
command += $$get_lupdate_language($${PWD}/$${TARGET}.pro)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(lrelease_language){
|
||||
command =
|
||||
#only pro path
|
||||
command += $$get_lrelease_language($${PWD}/../AppRoot/lang, zh_CN) $$CMD_SEP
|
||||
command += $$get_lrelease_language($${PWD}/../AppRoot/lang, en_US)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
##########################################################################################
|
||||
##Work flow
|
||||
##########################################################################################
|
||||
QMAKE_PRE_LINK += $$CMD_SEP $$lupdate_language()
|
||||
QMAKE_PRE_LINK += $$CMD_SEP $$lrelease_language()
|
99
multi-link/app_link.pri
Normal file
99
multi-link/app_link.pri
Normal file
@ -0,0 +1,99 @@
|
||||
#-------------------------------------------------------------
|
||||
#app_link.pri
|
||||
#提供app链接函数,app lib工程通用
|
||||
#-------------------------------------------------------------
|
||||
|
||||
################################################################################
|
||||
#内部用函数
|
||||
#获取命令
|
||||
################################################################################
|
||||
defineReplace(get_add_link) {
|
||||
libname = $$1
|
||||
librealname = $$2
|
||||
isEmpty(1): error("get_add_link(libname, librealname) requires at last one argument")
|
||||
!isEmpty(3): error("get_add_link(libname, librealname) requires at most two argument")
|
||||
isEmpty(2): librealname = $${libname}
|
||||
|
||||
CUR_LIB_PWD = $${LIB_SDK_ROOT}/$${libname}/$${QSYS_STD_DIR}/lib
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
CUR_LIB_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
LINK =
|
||||
contains(DEFINES, __DARWIN__) {
|
||||
LINK += -F$${CUR_LIB_PWD}
|
||||
LINK += -framework $${librealname}
|
||||
} else {
|
||||
LINK += -L$${CUR_LIB_PWD}
|
||||
#win can't with the blank! error: -l QQt
|
||||
LINK += -l$${librealname}
|
||||
}
|
||||
return ($${LINK})
|
||||
}
|
||||
|
||||
defineReplace(get_add_include) {
|
||||
incname = $$1
|
||||
increalname = $$2
|
||||
isEmpty(1): error("get_add_include(incname, increalname) requires at last one argument")
|
||||
!isEmpty(3): error("get_add_include(incname, increalname) requires at most two argument")
|
||||
|
||||
INCLUDE =
|
||||
contains(DEFINES, __DARWIN__) {
|
||||
CUR_INC_PWD = $${LIB_SDK_ROOT}/$${incname}/$${QSYS_STD_DIR}/$${incname}.framework/Headers
|
||||
!isEmpty(2):CUR_INC_PWD=$${CUR_INC_PWD}/$${increalname}
|
||||
INCLUDE += $${CUR_INC_PWD}
|
||||
} else {
|
||||
CUR_INC_PWD = $${LIB_SDK_ROOT}/$${incname}/$${QSYS_STD_DIR}/include
|
||||
!isEmpty(2):CUR_INC_PWD=$${CUR_INC_PWD}/$${increalname}
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
CUR_INC_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
INCLUDE += $${CUR_INC_PWD}
|
||||
}
|
||||
|
||||
return ($${INCLUDE})
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
#公开给外部用函数
|
||||
#执行命令
|
||||
################################################################################
|
||||
#从LIB_SDK_ROOT按照标准路径QSYS_STD_DIR链接
|
||||
#[libname/5.9.2/macOS/Debug/lib/librealname.framework]
|
||||
#[libname/5.9.2/macOS/Debug/lib/librealname.dll]
|
||||
#[libname/5.9.2/macOS/Debug/lib/lib<librealname>.so.*]
|
||||
#librealname可以为空
|
||||
defineTest(add_link) {
|
||||
libname = $$1
|
||||
librealname = $$2
|
||||
isEmpty(1): error("add_link(libname, librealname) requires at last one argument")
|
||||
!isEmpty(3): error("add_link(libname, librealname) requires at most two argument")
|
||||
isEmpty(2): librealname = $${libname}
|
||||
|
||||
command = $$get_add_link($${libname}, $${librealname})
|
||||
#message ($$command)
|
||||
LIBS += $${command}
|
||||
|
||||
return (1)
|
||||
}
|
||||
|
||||
|
||||
#从LIB_SDK_ROOT按照标准路径QSYS_STD_DIR包含
|
||||
#[incname/5.9.2/macOS/Debug/lib/incname.framework/Headers/increalname]
|
||||
#[incname/5.9.2/macOS/Debug/include/increalname]
|
||||
#increalname可以为空
|
||||
defineTest(add_include) {
|
||||
incname = $$1
|
||||
increalname = $$2
|
||||
isEmpty(1): error("add_include(incname, increalname) requires at last one argument")
|
||||
!isEmpty(3): error("add_include(incname, increalname) requires at most two argument")
|
||||
|
||||
command = $$get_add_include($${incname}, $${increalname})
|
||||
#message ($$command)
|
||||
INCLUDEPATH += $${command}
|
||||
|
||||
return (1)
|
||||
}
|
||||
|
115
multi-link/app_link_qqt_library.pri
Normal file
115
multi-link/app_link_qqt_library.pri
Normal file
@ -0,0 +1,115 @@
|
||||
################################################################
|
||||
##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.
|
||||
|
||||
#this link need Qt Creator set default build directory, replace
|
||||
#%{JS: Util.asciify("/your/local/path/to/build/root/%{CurrentProject:Name}/%{Qt:Version}/%{CurrentKit:FileSystemName}/%{CurrentBuild:Name}")}
|
||||
|
||||
#auto link QQt when build source
|
||||
#auto copy QQt when deploy app
|
||||
|
||||
#第一 拷贝Library为SDK到SDKROOT
|
||||
#第二 从SDK ROOT 链接 QQt Library
|
||||
#-------------------------------------------------------------
|
||||
#user computer path settings
|
||||
#-------------------------------------------------------------
|
||||
#same app project, same relative path.
|
||||
#qqt source root, QQt's root pro path. subdir and
|
||||
#private using
|
||||
QQT_SOURCE_ROOT = $${PWD}/../src
|
||||
|
||||
#-------------------------------------------------------------
|
||||
#include qqt's pri
|
||||
#-------------------------------------------------------------
|
||||
#qqt qkit
|
||||
#all cross platform setting is from here.
|
||||
include($${QQT_SOURCE_ROOT}/qqt_qkit.pri)
|
||||
|
||||
isEmpty(QKIT_PRIVATE) {
|
||||
message(env variable QKIT is required!)
|
||||
message(pleace check qqt_qkit.pri)
|
||||
error("error occured, please check build output panel.")
|
||||
}
|
||||
|
||||
#qqt function
|
||||
include($${QQT_SOURCE_ROOT}/qqt_function.pri)
|
||||
|
||||
#qqt version
|
||||
include($${QQT_SOURCE_ROOT}/qqt_version.pri)
|
||||
|
||||
#qqt header
|
||||
include($${QQT_SOURCE_ROOT}/qqt_header.pri)
|
||||
|
||||
#-------------------------------------------------------------
|
||||
#link qqt settings: use source or link library?
|
||||
#-------------------------------------------------------------
|
||||
#if you want to build qqt source open this annotation
|
||||
#CONFIG += QQT_SOURCE_BUILDIN
|
||||
contains (CONFIG, QQT_SOURCE_BUILDIN) {
|
||||
#notice: msvc, DLL_IMPORT macro is no problem to use in app + lib source? 静态成员的定义无法编译通过,dllimport在app里不允许实现静态成员变量。
|
||||
#so, here ,force static, QQt的静态编译,dllexport一律定义为空,引用的时候也是空,所以肯定能过。
|
||||
#ignore
|
||||
#nouse. 报告找不到import的符号,几个静态过来的重复定义。如果定义这个宏,必须所有源文件都被覆盖。现在忽略这个功能。
|
||||
DEFINES += QQT_STATIC_LIBRARY
|
||||
system("touch $${QQT_SOURCE_ROOT}/frame/qqtapplication.cpp")
|
||||
#if you want to build src but not link QQt lib in your project
|
||||
#if you don't want to modify Qt Creator's default build directory, this maybe a choice.
|
||||
#include($${QQT_SOURCE_ROOT}/qqt_source.pri)
|
||||
} else {
|
||||
#if you want to link QQt library
|
||||
#qqt will install sdk to sdk path you set, then link it, or link from build station
|
||||
#qqt also can install sdk to qt library path, then to do that.
|
||||
#need QQT_BUILD_ROOT
|
||||
#need QKIT_PRIVATE from qqt_qkit.pri
|
||||
|
||||
#you can open one or more macro to make sdk or link from build.
|
||||
#link from sdk is default setting
|
||||
CONFIG += link_from_sdk
|
||||
#CONFIG += link_from_build
|
||||
#CONFIG += link_from_qt_lib_path
|
||||
|
||||
#especially some occations need some sure macro.
|
||||
contains(QKIT_PRIVATE, iOS|iOSSimulator) {
|
||||
#mac ios .framework .a 里面的快捷方式必须使用里面的相对路径,不能使用绝对路径
|
||||
#但是qtcreator生成framework的时候用了绝对路径,所以导致拷贝后链接失败,库不可用。
|
||||
#qqt_install.pri 里面解决了framework的拷贝问题,但是对于ios里.a的没做,而.a被拷贝了竟然也不能用!
|
||||
#在build的地方link就可以了
|
||||
CONFIG += link_from_build
|
||||
}
|
||||
contains(CONFIG, link_from_build) {
|
||||
#include from source header, default is this, and set in header pri
|
||||
#...
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------
|
||||
#install qqt to sdk or qt library path
|
||||
#include qqt_install.pri using these function to install qqt
|
||||
#install to Qt library
|
||||
#install to SDK path
|
||||
#in this section, I use QMAKE_PRE_LINK QMAKE_POST_LINK, it won't work until project source changed
|
||||
#on windows, I use touch.exe, you need download it and put it in system dir.
|
||||
#-------------------------------------------------------------
|
||||
#QMAKE_POST_LINK won't work until source changed
|
||||
#qmake pro pri prf change won't effect to QMAKE_POST_LINK
|
||||
#but I need it before I complete this pri.
|
||||
|
||||
#debug.
|
||||
#move to app link pri
|
||||
#link_from_sdk do move qqt to sdk path at app pre link command not lib build time
|
||||
#mod qqt source to start post link is not needed here.
|
||||
#need mod app souce after every pri mod.
|
||||
#起初,qmake步骤被安置在QQt里,所以只有更改源代码才能启动POSTLINK.现在放置在App里了,这里的touch修改源代码不需要了.
|
||||
#App修改源代码,Creator会自动qmake,启动qmake步骤PRILINK+POSTLINK
|
||||
#App修改pro,必须手动qmake,Creator才会qmake,启动qmake步骤PRILINK+POSTLINK
|
||||
#App必须注意,此处不再持续编译QQt.
|
||||
include ($${QQT_SOURCE_ROOT}/qqt_install.pri)
|
||||
|
||||
#in this pri use QQT_SDK_ROOT QQT_SDK_PWD QQT_LIB_PWD
|
||||
#need qqt_install.pri
|
||||
include($${QQT_SOURCE_ROOT}/qqt_library.pri)
|
||||
}
|
||||
|
||||
|
148
multi-link/app_multi_link_function.pri
Normal file
148
multi-link/app_multi_link_function.pri
Normal file
@ -0,0 +1,148 @@
|
||||
#------------------------------------------------------------------------------------
|
||||
#app_multi_link_function.pri
|
||||
#App多链接技术函数库
|
||||
#用户app从这里调用关于app link的函数
|
||||
#------------------------------------------------------------------------------------
|
||||
################################################################################
|
||||
#app获取功能命令函数
|
||||
#一般不会拿出去用,除非你懂得LIBS+= INCLUDEPATH+= 语法
|
||||
################################################################################
|
||||
defineReplace(get_app_link) {
|
||||
libname = $$1
|
||||
isEmpty(1): error("get_app_link(libname) requires one argument")
|
||||
!isEmpty(2): error("get_app_link(libname) requires one argument")
|
||||
|
||||
CUR_LIB_PWD = $${QQT_SDK_ROOT}/$${libname}/$${QKIT_STD_DIR}/lib
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
CUR_LIB_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
contains(DEFINES, __DARWIN__) {
|
||||
LINK += -F$${CUR_LIB_PWD}
|
||||
LINK += -framework $${libname}
|
||||
} else {
|
||||
LINK += -L$${CUR_LIB_PWD}
|
||||
#win can't with the blank! error: -l QQt
|
||||
LINK += -l$${libname}
|
||||
}
|
||||
return ($${LINK})
|
||||
}
|
||||
|
||||
defineReplace(get_app_include) {
|
||||
libname = $$1
|
||||
isEmpty(1): error("get_app_include(libname) requires one argument")
|
||||
!isEmpty(2): error("get_app_include(libname) requires one argument")
|
||||
|
||||
INCLUDE =
|
||||
contains(DEFINES, __DARWIN__) {
|
||||
CUR_INC_PWD = $${QQT_SDK_ROOT}/$${libname}/$${QKIT_STD_DIR}/$${libname}.framework/Headers
|
||||
INCLUDE += $${CUR_INC_PWD}
|
||||
} else {
|
||||
CUR_INC_PWD = $${QQT_SDK_ROOT}/$${libname}/$${QKIT_STD_DIR}/include
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
CUR_INC_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
INCLUDE += $${CUR_INC_PWD}
|
||||
}
|
||||
|
||||
return ($${INCLUDE})
|
||||
}
|
||||
|
||||
defineReplace(get_app_add_link) {
|
||||
libname = $$1
|
||||
lib_real_name = $$2
|
||||
isEmpty(2): error("get_app_add_link(libname, lib_real_name) requires two argument")
|
||||
!isEmpty(3): error("get_app_add_link(libname, lib_real_name) requires two argument")
|
||||
|
||||
CUR_LIB_PWD = $${QQT_SDK_ROOT}/$${libname}/$${QKIT_STD_DIR}/lib
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
CUR_LIB_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
contains(DEFINES, __DARWIN__) {
|
||||
LINK += -F$${CUR_LIB_PWD}
|
||||
LINK += -framework $${lib_real_name}
|
||||
} else {
|
||||
LINK += -L$${CUR_LIB_PWD}
|
||||
#win can't with the blank! error: -l QQt
|
||||
LINK += -l$${lib_real_name}
|
||||
}
|
||||
return ($${LINK})
|
||||
}
|
||||
|
||||
defineReplace(get_app_add_include) {
|
||||
libname = $$1
|
||||
lib_inc_name = $$2
|
||||
isEmpty(2): error("get_app_add_link(libname, lib_inc_name) requires two argument")
|
||||
!isEmpty(3): error("get_app_add_link(libname, lib_inc_name) requires two argument")
|
||||
|
||||
INCLUDE =
|
||||
contains(DEFINES, __DARWIN__) {
|
||||
CUR_INC_PWD = $${QQT_SDK_ROOT}/$${libname}/$${QKIT_STD_DIR}/$${lib_inc_name}.framework/Headers
|
||||
INCLUDE += $${CUR_INC_PWD}
|
||||
} else {
|
||||
CUR_INC_PWD = $${QQT_SDK_ROOT}/$${libname}/$${QKIT_STD_DIR}/include/$${lib_inc_name}
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
CUR_INC_PWD~=s,/,\\,g
|
||||
}
|
||||
|
||||
INCLUDE += $${CUR_INC_PWD}
|
||||
}
|
||||
|
||||
return ($${INCLUDE})
|
||||
}
|
||||
|
||||
################################################################################
|
||||
#app link 功能函数
|
||||
#app通过调用这些函数实现从SDK标准路径加载各种lib
|
||||
################################################################################
|
||||
#从QQT_SDK_ROOT按照标准路径QKIT_STD_DIR链接 [libname/5.9.2/macOS/Debug/lib/libname.framework]
|
||||
defineTest(app_link) {
|
||||
libname = $$1
|
||||
isEmpty(1): error("app_link(libname) requires one argument")
|
||||
!isEmpty(2): error("app_link(libname) requires one argument")
|
||||
command = $$get_app_link($${libname})
|
||||
#message ($$command)
|
||||
LIBS += $${command}
|
||||
return (1)
|
||||
}
|
||||
|
||||
|
||||
#从QQT_SDK_ROOT按照标准路径QKIT_STD_DIR包含 [libname/5.9.2/macOS/Debug/lib/libname.framework/Headers]
|
||||
defineTest(app_include) {
|
||||
libname = $$1
|
||||
isEmpty(1): error("app_include(libname) requires one argument")
|
||||
!isEmpty(2): error("app_include(libname) requires one argument")
|
||||
command = $$get_app_include($${libname})
|
||||
#message ($$command)
|
||||
INCLUDEPATH += $${command}
|
||||
return (1)
|
||||
}
|
||||
|
||||
#从QQT_SDK_ROOT按照Lib标准路径QKIT_STD_DIR链接Lib2 [libname/5.9.2/macOS/Debug/lib/librealname.framework]
|
||||
defineTest(app_add_link) {
|
||||
libname = $$1
|
||||
lib_real_name = $$1
|
||||
isEmpty(2): error("app_add_link(libname) requires two argument")
|
||||
!isEmpty(3): error("app_add_link(libname) requires two argument")
|
||||
|
||||
command = $$get_app_add_link($${libname}, $${lib_real_name})
|
||||
#message ($$command)
|
||||
LIBS += $${command}
|
||||
return (1)
|
||||
}
|
||||
|
||||
|
||||
#从QQT_SDK_ROOT按照Lib标准路径QKIT_STD_DIR包含sub_inc [libname/5.9.2/macOS/Debug/lib/libincname.framework/Headers]
|
||||
defineTest(app_add_include) {
|
||||
libname = $$1
|
||||
lib_inc_name = $$2
|
||||
isEmpty(2): error("app_add_include(libname, lib_inc_name) requires two argument")
|
||||
!isEmpty(3): error("app_add_include(libname, lib_inc_name) requires two argument")
|
||||
|
||||
command = $$get_app_add_include($${libname}, $${lib_inc_name})
|
||||
#message ($$command)
|
||||
INCLUDEPATH += $${command}
|
||||
return (1)
|
||||
}
|
15
multi-link/app_version.pri
Normal file
15
multi-link/app_version.pri
Normal file
@ -0,0 +1,15 @@
|
||||
#################################################################
|
||||
##project $${TARGET} version pri
|
||||
#################################################################
|
||||
#拷贝到用户app工程目录里使用用
|
||||
|
||||
APP_MAJOR_VERSION = 0
|
||||
APP_MINOR_VERSION = 0
|
||||
APP_PATCH_VERSION = 0
|
||||
APP_BUILD_VERSION = 0
|
||||
|
||||
APP_VERSION = $${APP_MAJOR_VERSION}.$${APP_MINOR_VERSION}.$${APP_PATCH_VERSION}
|
||||
APP_VERSION4 = $${APP_MAJOR_VERSION}.$${APP_MINOR_VERSION}.$${APP_PATCH_VERSION}.$${APP_BUILD_VERSION}
|
||||
DEFINES += APP_VERSION=$${APP_VERSION}
|
||||
message (Build $${TARGET} version: $$APP_VERSION4)
|
||||
unix:VERSION = $${APP_VERSION}
|
376
multi-link/base_function.pri
Normal file
376
multi-link/base_function.pri
Normal file
@ -0,0 +1,376 @@
|
||||
#------------------------------------------------------------------
|
||||
#base_function.pri
|
||||
#please dont modify this pri
|
||||
#2017年12月01日14:05:43
|
||||
#------------------------------------------------------------------
|
||||
contains(QMAKE_HOST.os,Windows) {
|
||||
SCRIPT_SUFFIX=bat
|
||||
CMD_SEP = &
|
||||
MOVE = move /y
|
||||
COPY = copy /y
|
||||
COPY_DIR = xcopy /s /q /y /i /r /h
|
||||
MK_DIR = mkdir
|
||||
RM = del
|
||||
CD = cd /d
|
||||
RM_DIR = rd /s /q
|
||||
#PATH_SEP=\\
|
||||
} else:contains(QMAKE_HOST.os, Darwin) {
|
||||
SCRIPT_SUFFIX=sh
|
||||
CMD_SEP = &&
|
||||
MOVE = mv
|
||||
COPY = cp -f
|
||||
COPY_DIR = cp -fa
|
||||
MK_DIR = mkdir -p
|
||||
RM = rm -f
|
||||
CD = cd
|
||||
LN = ln -sf
|
||||
RM_DIR = rm -rf
|
||||
#PATH_SEP=/
|
||||
} else {
|
||||
SCRIPT_SUFFIX=sh
|
||||
CMD_SEP = &&
|
||||
MOVE = mv
|
||||
COPY = cp -f
|
||||
COPY_DIR = cp -rf
|
||||
MK_DIR = mkdir -p
|
||||
RM = rm -f
|
||||
CD = cd
|
||||
LN = ln -sf
|
||||
RM_DIR = rm -rf
|
||||
#PATH_SEP=/
|
||||
}
|
||||
################################################
|
||||
##get command string
|
||||
################################################
|
||||
defineReplace(get_mkdir) {
|
||||
filepath = $$1
|
||||
isEmpty(1): error("get_mkdir(filepath) requires one argument")
|
||||
command = $${MK_DIR} $${filepath}
|
||||
#message($${command})
|
||||
return ($${command})
|
||||
}
|
||||
defineReplace(get_errcode) {
|
||||
cmd_exec = $$1
|
||||
isEmpty(1): error("get_errcode(command) requires one argument")
|
||||
contains(QMAKE_HOST.os,Windows) {
|
||||
command = $${cmd_exec} >nul & echo %errorlevel%
|
||||
} else {
|
||||
command = "$${cmd_exec}" 2>/dev/null; echo $?
|
||||
}
|
||||
#message($$command)
|
||||
return ($$command)
|
||||
}
|
||||
defineReplace(get_empty_file) {
|
||||
filename = $$1
|
||||
isEmpty(1): error("get_empty_file(filename) requires one argument")
|
||||
command =
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
command = echo . 2> $${filename}
|
||||
} else {
|
||||
command = echo 2> $${filename}
|
||||
}
|
||||
return ($$command)
|
||||
}
|
||||
defineReplace(get_write_file) {
|
||||
filename = $$1
|
||||
variable = $$2
|
||||
!isEmpty(3): error("get_write_file(name, content) requires two arguments.")
|
||||
isEmpty(2): error("get_write_file(name, content) requires two arguments.")
|
||||
command = echo $${variable} >> $${filename}
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
LINUX_CP_FILES = $${PWD}/linux_cp_files.sh
|
||||
defineReplace(get_copy_dir_and_file) {
|
||||
source = $$1
|
||||
pattern = $$2
|
||||
target = $$3
|
||||
!isEmpty(4): error("get_copy_dir_and_file(source, pattern, target) requires three arguments.")
|
||||
isEmpty(3) : error("get_copy_dir_and_file(source, pattern, target) requires three arguments.")
|
||||
command =
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
command = $${COPY_DIR} $${source}\\$${pattern} $${target}
|
||||
} else {
|
||||
command = chmod +x $${LINUX_CP_FILES} $${CMD_SEP}
|
||||
command += $${LINUX_CP_FILES} $${source} $${pattern} $${target}
|
||||
}
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
WIN_READ_INI = $${PWD}/win_read_ini.bat
|
||||
LINUX_READ_INI = $${PWD}/linux_read_ini.sh
|
||||
defineReplace(get_read_ini_command) {
|
||||
file_name = $$1
|
||||
sect_name = $$2
|
||||
key_name = $$3
|
||||
!isEmpty(4): error("get_read_ini_command(file, section, key) requires three arguments.")
|
||||
isEmpty(3) : error("get_read_ini_command(file, section, key) requires three arguments.")
|
||||
command =
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
#if use $${PWD}/...directoly this PWD is the refrence pri file path
|
||||
command = $${WIN_READ_INI} %file_name% %sect_name% %key_name%
|
||||
} else {
|
||||
command = chmod +x $${LINUX_READ_INI} $$CMD_SEP
|
||||
command += $${LINUX_READ_INI} $${file_name} $${sect_name} $${key_name}
|
||||
}
|
||||
#message ($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
WIN_WRITE_INI = $${PWD}/win_write_ini.bat
|
||||
LINUX_WRITE_INI = $${PWD}/linux_write_ini.sh
|
||||
defineReplace(get_write_ini_command) {
|
||||
file_name = $$1
|
||||
sect_name = $$2
|
||||
key_name = $$3
|
||||
new_value = $4
|
||||
!isEmpty(5): error("get_write_ini_command(file, section, key, value) requires four arguments.")
|
||||
isEmpty(4) : error("get_write_ini_command(file, section, key, value) requires four arguments.")
|
||||
command =
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
#if use $${PWD}/...directoly this PWD is the refrence pri file path
|
||||
command = $${WIN_WRITE_INI} %file_name% %sect_name% %key_name% %new_value%
|
||||
} else {
|
||||
command = chmod +x $${LINUX_WRITE_INI} $$CMD_SEP
|
||||
command += $${LINUX_WRITE_INI} $${file_name} $${sect_name} $${key_name} $${new_value}
|
||||
}
|
||||
#message ($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_lupdate_language){
|
||||
#pro file
|
||||
filepath = $$1
|
||||
!isEmpty(2): error("get_lupdate_language(filepath) requires one argument")
|
||||
isEmpty(1): error("get_lupdate_language(filepath) requires one argument")
|
||||
command =
|
||||
command = lupdate $${filepath}
|
||||
#message($${command})
|
||||
return ($${command})
|
||||
}
|
||||
|
||||
defineReplace(get_lrelease_language){
|
||||
filepath = $$1
|
||||
filename = $$2
|
||||
!isEmpty(3): error("get_lrelease_language(filepath, filename) requires two argument")
|
||||
isEmpty(2): error("get_lrelease_language(filepath, filename) requires two argument")
|
||||
command =
|
||||
command = lrelease $${filepath}/$${filename}.ts -qm $${filepath}/$${filename}.qm
|
||||
#message($${command})
|
||||
return ($${command})
|
||||
}
|
||||
|
||||
defineReplace(get_md5_command) {
|
||||
filename = $$1
|
||||
isEmpty(1): error("get_md5_command(filename) requires one argument")
|
||||
!isEmpty(2): error("get_md5_command(filename) requires one argument")
|
||||
command =
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
command = md5 -n $${filename}
|
||||
} else:mac* {
|
||||
command = md5 -q $${filename}
|
||||
} else {
|
||||
command = md5sum -b $${filename} | cut -d \' \' -f1
|
||||
}
|
||||
return ($$command)
|
||||
}
|
||||
defineReplace(get_user_home) {
|
||||
command =
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
command = echo %HOMEDRIVE%%HOMEPATH%
|
||||
} else {
|
||||
command = echo $HOME
|
||||
}
|
||||
#message ($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
defineReplace(get_user_config_path) {
|
||||
command =
|
||||
#windows下编译android工程,qmake CONFIG里面不包含win32而是android、linux、unix。
|
||||
#win32 只有在目标是win32的时候才会在CONFIG里面出现。开发平台用QMAKE_HOST.os
|
||||
#注意:qmake在windows平台下,无论目标,明令行一律按照windows控制台风格。不以目标区分,Attention!。
|
||||
#win32 {
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
command = echo %APPDATA%
|
||||
} else {
|
||||
command = echo $HOME
|
||||
}
|
||||
#message ($$command)
|
||||
return ($$command)
|
||||
}
|
||||
|
||||
#将路径里的[反]斜杠转换为开发机上的格式。
|
||||
#注意:不是按照目标进行转换的,所以仅仅用于命令行操作的FLOW。
|
||||
#defineReplace(get_path) {
|
||||
# command =
|
||||
# return ($$command)
|
||||
#}
|
||||
|
||||
################################################
|
||||
##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.
|
||||
# define test used in condition my impletement
|
||||
# system_error return command errcode and it is a test function not a replace function
|
||||
# 如果自定义的这个函数和系统函数重名,会调用系统函数。
|
||||
defineTest(system_errcode) {
|
||||
command = $$1
|
||||
isEmpty(1): error("system_errcode(command) requires one argument")
|
||||
#special process
|
||||
command = $$get_errcode($$command)
|
||||
#the command is only return ret(0,1) wrappered by get_errcode
|
||||
ret = $$system("$${command}")
|
||||
#message($$command)
|
||||
#message($$ret)
|
||||
#if eval configed ...
|
||||
#error: if(ret) : return (false)
|
||||
#erro : eval(ret = 0): return (false)
|
||||
#succ:
|
||||
#equals(ret, 0):return (false)
|
||||
#succ:but msvc creator auto qmake....
|
||||
return ($${ret})
|
||||
}
|
||||
|
||||
#can be used in condition
|
||||
#test function and replace function can be same name
|
||||
defineTest(mkdir) {
|
||||
filename = $$1
|
||||
isEmpty(1): error("mkdir(name) requires one argument")
|
||||
command = $$get_mkdir($${filename})
|
||||
#message ($$command)
|
||||
system_errcode($${command}): return (true)
|
||||
return (false)
|
||||
}
|
||||
|
||||
#can be used in values
|
||||
#must $$ !
|
||||
#return values. true is 'true', false is 'false', xx0, xx1 is list
|
||||
defineReplace(mkdir) {
|
||||
filename = $$1
|
||||
isEmpty(1): error("mkdir(name) requires one argument")
|
||||
command = $$get_mkdir($${filename})
|
||||
result = $$system("$${command}")
|
||||
return ($${result})
|
||||
}
|
||||
|
||||
|
||||
#only use in condition! return true is 1, false is 0
|
||||
#refuse $$ !
|
||||
#return only true(1) or false(0)
|
||||
defineTest(empty_file) {
|
||||
filename = $$1
|
||||
isEmpty(1): error("empty_file(filename) requires one argument")
|
||||
command = $$get_empty_file($$filename)
|
||||
#message($$command)
|
||||
system_errcode($${command}): return (true)
|
||||
return(false)
|
||||
}
|
||||
|
||||
## but system write_file where ?
|
||||
## bug: but qt4 write twice... when file exist, if empty_file first, write once....
|
||||
## bug: this is a test function, but it wont exec, because + 2>/dev/null.
|
||||
defineTest(write_line) {
|
||||
filename = $$1
|
||||
variable = $$2
|
||||
!isEmpty(3): error("write_line(name, content) requires two arguments.")
|
||||
isEmpty(2): error("write_line(name, content) requires two arguments.")
|
||||
command = $$get_write_file($${filename}, $${variable})
|
||||
#message($$command)
|
||||
system_errcode($${command}): return(true)
|
||||
return (false)
|
||||
}
|
||||
|
||||
defineTest(copy_dir_and_file) {
|
||||
source = $$1
|
||||
pattern = $$2
|
||||
target = $$3
|
||||
!isEmpty(4): error("copy_dir_and_file(source, pattern, target) requires three arguments.")
|
||||
isEmpty(3) : error("copy_dir_and_file(source, pattern, target) requires three arguments.")
|
||||
|
||||
command = $$get_copy_dir_and_file($$filename)
|
||||
system_errcode($${command}): return (true)
|
||||
return (false)
|
||||
}
|
||||
|
||||
defineTest(lupdate_language){
|
||||
#pro file
|
||||
filepath = $$1
|
||||
!isEmpty(2): error("get_lupdate_language(filepath) requires one argument")
|
||||
isEmpty(1): error("get_lupdate_language(filepath) requires one argument")
|
||||
command = $$get_lupdate_language($${filepath})
|
||||
system_errcode($${command}): return (true)
|
||||
return (false)
|
||||
}
|
||||
|
||||
defineTest(lrelease_language){
|
||||
filepath = $$1
|
||||
filename = $$2
|
||||
!isEmpty(3): error("lrelease_language(filepath, filename) requires two argument")
|
||||
isEmpty(2): error("lrelease_language(filepath, filename) requires two argument")
|
||||
command = $$get_lrelease_language($${filepath}, $${filename})
|
||||
system_errcode($${command}): return (true)
|
||||
return (false)
|
||||
}
|
||||
|
||||
|
||||
defineTest(is_same_file) {
|
||||
filename1 = $$1
|
||||
filename2 = $$2
|
||||
isEmpty(2): error("is_same_file(filename1, filename2) requires two argument")
|
||||
!isEmpty(3): error("is_same_file(filename1, filename2) requires two argument")
|
||||
|
||||
command1 = $$get_md5_command($${filename1})
|
||||
command2 = $$get_md5_command($${filename2})
|
||||
result1 = $$system($${command1})
|
||||
result2 = $$system($${command2})
|
||||
|
||||
#message($$filename1 $$result1)
|
||||
#message($$filename2 $$result2)
|
||||
equals(result1, $${result2}) : return(true)
|
||||
return (false)
|
||||
}
|
||||
|
||||
defineReplace(read_ini) {
|
||||
file_name = $$1
|
||||
sect_name = $$2
|
||||
key_name = $$3
|
||||
!isEmpty(4): error("read_ini(file, section, key) requires three arguments.")
|
||||
isEmpty(3) : error("read_ini(file, section, key) requires three arguments.")
|
||||
command = $$get_read_ini_command($${file_name}, $${sect_name}, $${key_name})
|
||||
echo = $$system("$${command}")
|
||||
#message($$command)
|
||||
#message($$echo)
|
||||
return ($${echo})
|
||||
}
|
||||
|
||||
defineReplace(write_ini) {
|
||||
file_name = $$1
|
||||
sect_name = $$2
|
||||
key_name = $$3
|
||||
new_value = $$4
|
||||
!isEmpty(5): error("write_ini_command(file, section, key, value) requires four arguments.")
|
||||
isEmpty(4) : error("write_ini_command(file, section, key, value) requires four arguments.")
|
||||
command = $$get_write_ini_command($${file_name}, $${sect_name}, $${key_name}, $${new_value})
|
||||
echo = $$system("$${command}")
|
||||
#message($$command)
|
||||
#message($$echo)
|
||||
return ($${echo})
|
||||
}
|
||||
|
||||
defineReplace(user_home) {
|
||||
command = $$get_user_home()
|
||||
echo = $$system("$${command}")
|
||||
#message($$command)
|
||||
#message($$echo)
|
||||
return ($${echo})
|
||||
}
|
||||
|
||||
defineReplace(user_config_path) {
|
||||
command = $$get_user_config_path()
|
||||
echo = $$system("$${command}")
|
||||
#message($$command)
|
||||
#message($$echo)
|
||||
return ($${echo})
|
||||
}
|
56
multi-link/base_platform.pri
Normal file
56
multi-link/base_platform.pri
Normal file
@ -0,0 +1,56 @@
|
||||
#-----------------------------------------------------------------------------
|
||||
#base_platform.pri
|
||||
#这个pri决定编译目标平台
|
||||
#-----------------------------------------------------------------------------
|
||||
#从环境变量读取QSYS保存为qmake变量QSYS_PRIVATE
|
||||
QSYS_PRIVATE = $$(QSYS)
|
||||
contains(QSYS_PRIVATE, Embedded) {
|
||||
#embedded common macro
|
||||
DEFINES += __EMBEDDED_LINUX__
|
||||
} else:contains(QSYS_PRIVATE, Arm32) {
|
||||
DEFINES += __EMBEDDED_LINUX__
|
||||
#arm32 private
|
||||
DEFINES += __ARM_LINUX__
|
||||
} else:contains(QSYS_PRIVATE, Mips32) {
|
||||
DEFINES += __EMBEDDED_LINUX__
|
||||
#mips32 private
|
||||
DEFINES += __MIPS_LINUX__
|
||||
} else:contains(QSYS_PRIVATE, Linux) {
|
||||
DEFINES += __LINUX__
|
||||
} else:contains(QSYS_PRIVATE, Linux64) {
|
||||
DEFINES += __LINUX64__
|
||||
} else:contains(QSYS_PRIVATE, Win32|Windows) {
|
||||
DEFINES += __WIN32__
|
||||
} else:contains(QSYS_PRIVATE, Win64) {
|
||||
DEFINES += __WIN64__
|
||||
} else:contains(QSYS_PRIVATE, macOS) {
|
||||
DEFINES += __DARWIN__
|
||||
} else:contains(QSYS_PRIVATE, iOS) {
|
||||
DEFINES += __IOS__
|
||||
} else:contains(QSYS_PRIVATE, iOS-Simulator) {
|
||||
DEFINES += __IOS__
|
||||
#TODO:no qcustomplot word printer process
|
||||
} else:contains(QSYS_PRIVATE, Android) {
|
||||
DEFINES += __ANDROID__
|
||||
} else:contains(QSYS_PRIVATE, Android_x86) {
|
||||
DEFINES += __ANDROID__
|
||||
DEFINES += __ANDROIDX86__ #可能废弃
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|profile|release):BUILD=Debug
|
||||
CONFIG(profile, debug|profile|release):BUILD=Profile
|
||||
CONFIG(release, debug|profile|release):BUILD=Release
|
||||
|
||||
QSYS_STD_DIR = $${QT_VERSION}/$${QSYS_PRIVATE}/$${BUILD}
|
||||
|
||||
message(base_platform.pri)
|
||||
message(Build $${TARGET} to $${QSYS_PRIVATE} \(QSYS=$${QSYS_PRIVATE} is configed in project build page.\) )
|
||||
message(Build $${TARGET} at $${QSYS_STD_DIR} \(Qt Kit page FileSystem Name=$${QSYS_PRIVATE}\) )
|
||||
message(Build $${TARGET} on $${QMAKE_HOST.os} \(Operating System=$${QMAKE_HOST.os}\) )
|
||||
isEmpty(QSYS_PRIVATE) : message(Build $${TARGET} Qt Kit page FileSystem Name is decided by env variable QSYS. Please set it. )
|
||||
|
||||
isEmpty(QSYS_PRIVATE) {
|
||||
message(env variable QSYS is required!)
|
||||
message(pleace check base_platform.pri)
|
||||
error("error occured, please check build output panel.")
|
||||
}
|
2
multi-link/linux_cd_path.sh
Executable file
2
multi-link/linux_cd_path.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
cd $curpath
|
4
multi-link/linux_cp_files.sh
Executable file
4
multi-link/linux_cp_files.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
initpath=$(pwd)
|
||||
(cd $1; tar -cf - $(find . -name "$2") ) | (cd $3; tar -xf -)
|
||||
cd $initpath
|
3
multi-link/linux_cur_path.sh
Executable file
3
multi-link/linux_cur_path.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
#qmake syntax error, so do this
|
||||
curpath=$(pwd)
|
12
multi-link/linux_read_ini.sh
Normal file
12
multi-link/linux_read_ini.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
ReadINIfile()
|
||||
{
|
||||
Configfile=$1
|
||||
Section=$2
|
||||
Key=$3
|
||||
ReadINI=`awk -F '=' '/\['$Section'\]/{a=1}a==1&&$1~/'$Key'/{print $2;exit}' $Configfile`
|
||||
echo "$ReadINI"
|
||||
}
|
||||
|
||||
ReadINIfile $1 $2 $3
|
70
multi-link/linux_write_ini.sh
Normal file
70
multi-link/linux_write_ini.sh
Normal file
@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
|
||||
function WriteINIfile()
|
||||
{
|
||||
Configfile=$1
|
||||
Section=$2
|
||||
Key=$3
|
||||
NewValue=$4
|
||||
|
||||
WriteINI=`sed -i "/^$Section/,/^/ {/^\[$Section/b;/^\[/b;s/^$Key*=.*/$Key=$NewValue/g;}" $Configfile`
|
||||
echo $WriteINI
|
||||
}
|
||||
|
||||
#WriteINIfile $1 $2 $3 $4
|
||||
|
||||
# 解析INI
|
||||
rini()
|
||||
{
|
||||
# 判断参数数量
|
||||
if [ $# -lt 2 ];then
|
||||
echo 'Usage:ini <filename> <[section]> [<key>] [<newvalue>]'
|
||||
_exit
|
||||
fi
|
||||
|
||||
# 讲ini文件读取到变量
|
||||
_old=`cat $1`
|
||||
|
||||
# 判断变量3是否为空 如果为空 显示该[]下的所有字段
|
||||
if [ "$3" = "" ];then
|
||||
sed -n "/\[$2\]/,/\[.*\]/{
|
||||
/^\[.*\]/d
|
||||
/^[ ]*$/d
|
||||
s/;.*$//
|
||||
p
|
||||
}" $1
|
||||
# 判断变量4是否为空 如果为空 显示该字段的值
|
||||
elif [ "$4" = "" ];then
|
||||
sed -n "/\[$2\]/,/\[.*\]/{
|
||||
/^\[.*\]/d
|
||||
/^[ ]*$/d
|
||||
s/;.*$//
|
||||
s/^[ | ]*$3[| ]*=[ | ]*\(.*\)[ | ]*/\1/p
|
||||
}" $1
|
||||
else
|
||||
# 判断变量4是否为字符'#' 如果为'#' 删除改行
|
||||
if [ "$4" = "#" ];then
|
||||
sed -i "/\[$2\]/,/\[.*\]/{
|
||||
s/^[ | ]*$3[ | ]*=.*/ /
|
||||
}" $1
|
||||
else
|
||||
# 如果变量4不为空和'#' 修改该变量 有备注使用改语句修改
|
||||
sed -i "/\[$2\]/,/\[.*\]/{
|
||||
s/^[ | ]*$3[ | ]*=.*[ | |.*]/$3=$4 /
|
||||
#s/^[ | ]*$3[ | ]*=[a-zA-Z0-9]*.[0-9]*.[0-9]*.[0-9]*/$3=$4/
|
||||
}" $1
|
||||
# 重新读取新文件
|
||||
_new=`cat $1`
|
||||
# 判断是否更改
|
||||
if [ "$_new" = "$_old" ];then
|
||||
# 修改没成功 使用以下语句更改
|
||||
sed -i "/\[$2\]/,/\[.*\]/{
|
||||
s/^[ | ]*$3[ | ]*=.*/$3=$4/
|
||||
#s/^[ | ]*$3[ | ]*=[a-zA-Z0-9]*.[0-9]*.[0-9]*.[0-9]*/$3=$4/
|
||||
}" $1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
rini $1 $2 $3 $4
|
9
multi-link/mac_deploy_qt4.sh
Normal file
9
multi-link/mac_deploy_qt4.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
appname=$1
|
||||
qtmodule=Qt3Support\ QtCore\ QtDBus\ QtDeclarative\ QtDesigner\ QtDesignerComponents\ QtGui\ QtHelp\ QtMultimedia\ QtNetwork\ QtOpenGL\ QtScript\ QtScriptTools\ QtSql\ QtSvg\ QtTest\ QtWebKit\ QtXml\ QtXmlPatterns\ phonon
|
||||
for recur in $qtmodule
|
||||
do
|
||||
install_name_tool -change ${recur}.framework/Versions/4/${recur} @rpath/${recur}.framework/Versions/4/${recur} ${appname}
|
||||
install_name_tool -change @executable_path/../Frameworks/${recur}.framework/Versions/4/${recur} @rpath/${recur}.framework/Versions/4/${recur} ${appname}
|
||||
done
|
||||
install_name_tool -add_rpath @executable_path/../Frameworks ${appname}
|
63
multi-link/multi_link_technology.pri
Normal file
63
multi-link/multi_link_technology.pri
Normal file
@ -0,0 +1,63 @@
|
||||
#--------------------------------------------------------------------------------
|
||||
#multi_link_technology.pri
|
||||
#提供所有multi link技术的功能函数
|
||||
#包括设定必需目录的要求
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
################################################################################
|
||||
#包含这个pri依赖的pri
|
||||
################################################################################
|
||||
include ($${PWD}/base_platform.pri)
|
||||
include ($${PWD}/base_function.pri)
|
||||
|
||||
################################################################################
|
||||
#多链接技术的路径依赖
|
||||
################################################################################
|
||||
CONFIG_PATH =
|
||||
CONFIG_FILE =
|
||||
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
#>=v2.4
|
||||
CONFIG_PATH = $$user_home()\\.qmake
|
||||
#CONFIG_PATH = $$user_config_path()\\qmake
|
||||
CONFIG_FILE = $${CONFIG_PATH}\\app_configure.pri
|
||||
} else {
|
||||
CONFIG_PATH = $$user_config_path()/.qmake
|
||||
CONFIG_FILE = $${CONFIG_PATH}/app_configure.pri
|
||||
}
|
||||
|
||||
!exists($${CONFIG_FILE}) {
|
||||
mkdir("$${CONFIG_PATH}")
|
||||
empty_file($${CONFIG_FILE})
|
||||
ret = $$system(echo APP_BUILD_ROOT = >> $${CONFIG_FILE})
|
||||
ret = $$system(echo APP_DEPLOY_ROOT = >> $${CONFIG_FILE})
|
||||
ret = $$system(echo LIB_SDK_ROOT = > $${CONFIG_FILE})
|
||||
}
|
||||
|
||||
#your must config this file! following readme!
|
||||
include ($${CONFIG_FILE})
|
||||
|
||||
#qqt build root, build station root
|
||||
#link_from_build will need this path.
|
||||
isEmpty(APP_BUILD_ROOT)|isEmpty(LIB_SDK_ROOT) {
|
||||
message($${TARGET} multiple linking config file: $${CONFIG_FILE})
|
||||
message("APP_BUILD_ROOT = is required, please modify $${CONFIG_FILE}")
|
||||
message("APP_DEPLOY_ROOT = is required [optional]")
|
||||
message("LIB_SDK_ROOT = is required")
|
||||
message("[linux platform, ]this pri is under multi_link_technology.pri")
|
||||
error("please check $$CONFIG_FILE")
|
||||
}
|
||||
|
||||
message($${TARGET} build root: $$APP_BUILD_ROOT)
|
||||
message($${TARGET} deploy root: $$APP_DEPLOY_ROOT)
|
||||
equals(TEMPLATE, app):message($${TARGET} use sdk root: $$LIB_SDK_ROOT)
|
||||
else:message($${TARGET} deploy sdk root: $$LIB_SDK_ROOT)
|
||||
|
||||
################################################################################
|
||||
#这里的pri提供multi link的全部函数
|
||||
################################################################################
|
||||
#app发布所需要的函数
|
||||
include ($${PWD}/app_deploy.pri)
|
||||
|
||||
#app链接所需要的函数
|
||||
include ($${PWD}/app_link.pri)
|
3
multi-link/win_read_ini.bat
Normal file
3
multi-link/win_read_ini.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
rem for /f "skip=1 tokens=1,2 delims==" %%a IN (%1) Do if %2==%%a set %3=%%b & @echo readconfig get %%a, value is %%b
|
||||
for /f "skip=1 tokens=1,2 delims==" %%a IN (%1) Do if %2==%%a @echo %%b
|
7
multi-link/多Link配置模板.pri
Normal file
7
multi-link/多Link配置模板.pri
Normal file
@ -0,0 +1,7 @@
|
||||
#Library SDK 发布中心
|
||||
QQT_SDK_ROOT = /home/abel/Develop/b1-product
|
||||
#应用编译中心
|
||||
QQT_BUILD_ROOT = /home/abel/Develop/c0-buildstation
|
||||
#应用程序发布中心
|
||||
APP_DEPLOY_ROOT = /home/abel/Develop/b1-product/App
|
||||
|
@ -39,7 +39,4 @@ equals(QMAKE_HOST.os, Windows) {
|
||||
}
|
||||
|
||||
system(touch main.cpp)
|
||||
include (../../app/app_base_manager.pri)
|
||||
include (app_custom_manager.pri)
|
||||
include (app_version.pri)
|
||||
include (app_language.pri)
|
||||
include (../../multi-link/app_base_manager.pri)
|
||||
|
Loading…
x
Reference in New Issue
Block a user