From fe9958184c0a36a2f6be5e81c804b6e8886b1056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Thu, 26 Mar 2020 14:17:49 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@990 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- cmake/DeployMacros.cmake | 4 +-- utils/deploy_tool/main.cpp | 71 +++++++++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 22 deletions(-) diff --git a/cmake/DeployMacros.cmake b/cmake/DeployMacros.cmake index 405a9faf..d8dd6feb 100644 --- a/cmake/DeployMacros.cmake +++ b/cmake/DeployMacros.cmake @@ -544,7 +544,7 @@ macro(deploy_target _T) # gather dir ${_CMD_COPY} - COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -P windows -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin;${MINGW_BIN};${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS} + COMMAND deploy_tool ${_VERB} ${_OPTIONS} -W "\"${CMAKE_OBJDUMP}\"" -P windows,minimal -S windows -q "\"${Qt5_ROOT}\"" -s "\"${CMAKE_PREFIX_PATH}/bin;${MINGW_BIN};${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD} -p ${_AGD} "\"${_AGD}${_T}.exe\"" ${_ADD_DEPS} # zip COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\"" COMMENT "Generating ${_TV}.zip" @@ -589,7 +589,7 @@ macro(deploy_target _T) ${_CMD_COPY} #COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources #COMMAND cp -r ${_DEPLOY_DIR}/lang ${_AGD}/Contents/Resources - COMMAND deploy_tool ${_VERB} ${_OPTIONS} -M "${CMAKE_OTOOL}" -P cocoa -S mac -q ${Qt5_ROOT} -s "\"${CMAKE_PREFIX_PATH}/lib;${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD}/Contents/Frameworks -p ${_AGD}/Contents/PlugIns ${_AGD}/Contents/MacOS/${_T} ${_ADD_DEPS} + COMMAND deploy_tool ${_VERB} ${_OPTIONS} -M "${CMAKE_OTOOL}" -P cocoa,minimal -S mac -q ${Qt5_ROOT} -s "\"${CMAKE_PREFIX_PATH}/lib;${DEPLOY_ADD_LIBPATH}${_DEP_LIBPATH}\"" -o ${_AGD}/Contents/Frameworks -p ${_AGD}/Contents/PlugIns ${_AGD}/Contents/MacOS/${_T} ${_ADD_DEPS} # prepare dmg dir COMMAND rm -rf ${_DMG} COMMAND mkdir ${_VERB} -p ${_DMG} diff --git a/utils/deploy_tool/main.cpp b/utils/deploy_tool/main.cpp index 90a4d90d..878eb3fc 100644 --- a/utils/deploy_tool/main.cpp +++ b/utils/deploy_tool/main.cpp @@ -33,18 +33,24 @@ void usage() { piCout << "You can specify any file or directory as ."; piCout << "In case of directory it will be scan recursively."; piCout << ""; - piCout << "If QtCore dependency found, copy all basic Qt plugins,"; - piCout << " and "; + piCout << "If some Qt dependency found, copy corresponding Qt plugins."; + piCout << "Styles and platforms selected by -S and -P flags,"; + piCout << "any other plugins described by --qt-plugins flag in next format:"; + piCout << "\"[*=;]=,;=,\", e.g."; + piCout << "\"sqldrivers=lite,mysql;geoservices=;position=nmea\"."; + piCout << "If no regexp specified for plugins, nothing will be copied."; + piCout << "Default regexp set by \"*=\"."; + piCout << "\"*=\" disable optional plugins."; piCout << ""; piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] [--dependencies [--prefix ]] " "[-p ] [-s ] [-S ] [-l ] " "[-D ] [-L | -W | -M ] " "[-d ] [-q ] [-a ] [-S ] " - "[-P ] [--sql ] -o [ ...]\"" << NewLine; + "[-P ] [--qt-plugins ] -o [ ...]\"" << NewLine; piCout << Green << Bold << "Details:"; piCout << Bold << "Debug control"; - piCout << "-h " << Green << "- display this message and exit"; - piCout << "-v " << Green << "- be verbose"; + piCout << "-h, --help " << Green << "- display this message and exit"; + piCout << "-v, --verbose " << Green << "- be verbose"; piCout << ""; piCout << Bold << "Processing control"; piCout << "-f, --fake " << Green << "- don`t copy, only print"; @@ -55,21 +61,23 @@ void usage() { piCout << "-M " << Green << "- \"otool\" path, overrides \"ldd\""; piCout << "-D " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\""; piCout << "-d " << Green << "- maximum dependepcies depth, default 5"; - piCout << "-q " << Green << "- path where Qt root dir, default takes from \"qmake -v\""; - piCout << "-C, --Conf " << Green << "- make \"qt.conf\""; //piCout << "-Q, --Qt-force " << Green << "- force add Qt root dir, default takes from \"qmake -v\""; piCout << ""; + piCout << Bold << "Qt control"; + piCout << "-q " << Green << "- path where Qt root dir, default takes from \"qmake -v\""; + //piCout << "-C, --Conf " << Green << "- make \"qt.conf\""; + piCout << "-S " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\""; + piCout << "-P " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system"; + piCout << "--qt-plugins " << Green << "- set Qt plugins description"; + piCout << ""; piCout << Bold << "Output control"; piCout << "-o " << Green << "- path for libraries copy to"; - piCout << "-p " << Green << "- path for Qt plugins, default \"/plugins\""; + piCout << "-p " << Green << "- path for Qt plugins, default \"/plugins\""; piCout << "--dependencies " << Green << "- search dependencies by , print them and copy missing libraries"; piCout << "--prefix " << Green << "- print before dependencies"; piCout << ""; piCout << Bold << "Input control"; piCout << " ... " << Green << "- executable to process"; - piCout << "-S " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\""; - piCout << "-P " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system"; - piCout << "--sql " << Green << "- set Qt sql drivers (e.g. \"sqlite\"), default \"*\""; piCout << "-a " << Green << "- additional libs, separated by \";\". Libraries will be searched in "; } @@ -100,6 +108,7 @@ bool fake = false, is_ldd = true, is_deps = false, need_qt = false; PIString ldd, readelf, objdump, otool, dpkg, out_dir, qt_dir, out_plugins_dir; PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers; PISet all_libs, miss_libs, all_deps, frameworks, miss_frameworks, qt_plugins; +PIMap qt_filters; PIString findLib(const PIString & l) { @@ -298,10 +307,10 @@ void procQt() { qdir += "/plugins/"; #endif piForeachC (PIString & plugin, pdirs) { - PIStringList filters("*"); - if (plugin == "platforms") filters = platforms; + PIStringList filters = qt_filters[plugin]; + /*if (plugin == "platforms") filters = platforms; if (plugin == "styles") filters = styles; - if (plugin == "sqldrivers") filters = sqldrivers; + if (plugin == "sqldrivers") filters = sqldrivers;*/ piForeachC (PIString & f, filters) { copyWildcard(qdir + plugin + "/" + f, out_plugins_dir + plugin); PIVector copied = PIDir(out_plugins_dir + plugin).entries(); @@ -346,7 +355,7 @@ int main(int argc, char * argv[]) { cli.addArgument("search_path", true); cli.addArgument("Styles", true); cli.addArgument("Platforms", true); - cli.addArgument("sql", PIChar('\0'), true); + cli.addArgument("qt-plugins", PIChar('\0'), true); cli.addArgument("ldd", true); cli.addArgument("Lreadelf", true); cli.addArgument("Wobjdump", true); @@ -398,17 +407,39 @@ int main(int argc, char * argv[]) { if (!out_dir.endsWith("/")) out_dir += "/"; if (ldd.isEmpty()) ldd = "/usr/bin/ldd"; + for (int i = 0; ; ++i) { + if (qt_deps[i].lib.isEmpty()) break; + qt_deps[i].plugins.forEach([&](const PIString & p){qt_filters[p] = PIStringList("*");}); + } if (!cli.argumentValue("Platforms").isEmpty()) qplatforms = cli.argumentValue("Platforms"); platforms = qplatforms.split(","); styles = cli.argumentValue("Styles").split(","); if (styles.isEmpty()) styles << ""; - sqldrivers = cli.argumentValue("sql").split(","); - if (sqldrivers.isEmpty()) sqldrivers << ""; + PIStringList qpd = cli.argumentValue("qt-plugins").toLowerCase().split(";"); + piForeachC (PIString & qp, qpd) { + int _i = qp.indexOf("="); + if (_i < 0) continue; + PIString pname = qp.left(_i).trim(); + PIString pfilt = qp.mid(_i + 1).trim(); + if (pname == "*") { + for (int i = 0; ; ++i) { + if (qt_deps[i].lib.isEmpty()) break; + qt_deps[i].plugins.forEach([&](const PIString & p){qt_filters[p] = pfilt.split(",");}); + } + } else + qt_filters[pname] = pfilt.split(","); + } + qt_filters["platforms"] = platforms; + qt_filters["styles" ] = styles ; - platforms .forEachInplace([](PIString i)->PIString{if (!i.startsWith("*")) i.prepend("*"); if (!i.endsWith("*")) i.append("*"); return i;}); - styles .forEachInplace([](PIString i)->PIString{if (!i.startsWith("*")) i.prepend("*"); if (!i.endsWith("*")) i.append("*"); return i;}); - sqldrivers.forEachInplace([](PIString i)->PIString{if (!i.startsWith("*")) i.prepend("*"); if (!i.endsWith("*")) i.append("*"); return i;}); + for (PIMap::iterator it = qt_filters.begin(); it != qt_filters.end(); ++it) + it.value().forEachInplace([](PIString i)->PIString{ + if (!i.startsWith("*")) i.prepend("*"); + if (!i.endsWith("*")) i.append("*"); + return i; + }); + //PICout(PICoutManipulators::DefaultControls) << qt_filters; if (!fake) PIDir(out_dir).make();