git-svn-id: svn://db.shs.com.ru/pip@990 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2020-03-26 14:17:49 +00:00
parent 46f2351536
commit fe9958184c
2 changed files with 53 additions and 22 deletions

View File

@@ -544,7 +544,7 @@ macro(deploy_target _T)
# gather dir # gather dir
${_CMD_COPY} ${_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 # zip
COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\"" COMMAND cd "\"${_DEPLOY_DIR}\"" "&&" zip -q -r "\"${_DESTINATION}/${_TV}.zip\"" "\"${_TV}_win_${MY_ARCH}\""
COMMENT "Generating ${_TV}.zip" COMMENT "Generating ${_TV}.zip"
@@ -589,7 +589,7 @@ macro(deploy_target _T)
${_CMD_COPY} ${_CMD_COPY}
#COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources #COMMAND cp ${_ICON_FN} ${_AGD}/Contents/Resources
#COMMAND cp -r ${_DEPLOY_DIR}/lang ${_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 # prepare dmg dir
COMMAND rm -rf ${_DMG} COMMAND rm -rf ${_DMG}
COMMAND mkdir ${_VERB} -p ${_DMG} COMMAND mkdir ${_VERB} -p ${_DMG}

View File

@@ -33,18 +33,24 @@ void usage() {
piCout << "You can specify any file or directory as <file>."; piCout << "You can specify any file or directory as <file>.";
piCout << "In case of directory it will be scan recursively."; piCout << "In case of directory it will be scan recursively.";
piCout << ""; piCout << "";
piCout << "If QtCore dependency found, copy all basic Qt plugins,"; piCout << "If some Qt dependency found, copy corresponding Qt plugins.";
piCout << "<styles> and <platforms>"; piCout << "Styles and platforms selected by -S and -P flags,";
piCout << "any other plugins described by --qt-plugins flag in next format:";
piCout << "\"[*=;]<plugins>=<regexp>,<regexp>;<plugins>=<regexp>,<regexp>\", 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 \"*=<regexp>\".";
piCout << "\"*=\" disable optional plugins.";
piCout << ""; piCout << "";
piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] [--dependencies [--prefix <text>]] " piCout << Green << Bold << "Usage:" << Default << "\"deploy_tool [-hvfC] [--dependencies [--prefix <text>]] "
"[-p <qt_plugins>] [-s <search_path>] [-S <styles>] [-l <ldd>] " "[-p <qt_plugins>] [-s <search_path>] [-S <styles>] [-l <ldd>] "
"[-D <dpkg>] [-L <readelf> | -W <objdump> | -M <otool>] " "[-D <dpkg>] [-L <readelf> | -W <objdump> | -M <otool>] "
"[-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] " "[-d <depth>] [-q <qtdir>] [-a <add_libs>] [-S <styles>] "
"[-P <platforms>] [--sql <drivers>] -o <out_path> <file> [<file2> ...]\"" << NewLine; "[-P <platforms>] [--qt-plugins <d>] -o <out_path> <file> [<file2> ...]\"" << NewLine;
piCout << Green << Bold << "Details:"; piCout << Green << Bold << "Details:";
piCout << Bold << "Debug control"; piCout << Bold << "Debug control";
piCout << "-h " << Green << "- display this message and exit"; piCout << "-h, --help " << Green << "- display this message and exit";
piCout << "-v " << Green << "- be verbose"; piCout << "-v, --verbose " << Green << "- be verbose";
piCout << ""; piCout << "";
piCout << Bold << "Processing control"; piCout << Bold << "Processing control";
piCout << "-f, --fake " << Green << "- don`t copy, only print"; piCout << "-f, --fake " << Green << "- don`t copy, only print";
@@ -55,10 +61,15 @@ void usage() {
piCout << "-M <otool> " << Green << "- \"otool\" path, overrides \"ldd\""; piCout << "-M <otool> " << Green << "- \"otool\" path, overrides \"ldd\"";
piCout << "-D <dpkg> " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\""; piCout << "-D <dpkg> " << Green << "- \"dpkg\" path, default \"/usr/bin/dpkg\"";
piCout << "-d <depth> " << Green << "- maximum dependepcies depth, default 5"; piCout << "-d <depth> " << Green << "- maximum dependepcies depth, default 5";
piCout << "-q <qtdir> " << 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 << "-Q, --Qt-force " << Green << "- force add Qt root dir, default takes from \"qmake -v\"";
piCout << ""; piCout << "";
piCout << Bold << "Qt control";
piCout << "-q <qtdir> " << Green << "- path where Qt root dir, default takes from \"qmake -v\"";
//piCout << "-C, --Conf " << Green << "- make \"qt.conf\"";
piCout << "-S <styles> " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\"";
piCout << "-P <platforms> " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system";
piCout << "--qt-plugins <d> " << Green << "- set Qt plugins description";
piCout << "";
piCout << Bold << "Output control"; piCout << Bold << "Output control";
piCout << "-o <out_path> " << Green << "- path for libraries copy to"; piCout << "-o <out_path> " << Green << "- path for libraries copy to";
piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>/plugins\""; piCout << "-p <qt_plugins> " << Green << "- path for Qt plugins, default \"<out_path>/plugins\"";
@@ -67,9 +78,6 @@ void usage() {
piCout << ""; piCout << "";
piCout << Bold << "Input control"; piCout << Bold << "Input control";
piCout << "<file> ... " << Green << "- executable to process"; piCout << "<file> ... " << Green << "- executable to process";
piCout << "-S <styles> " << Green << "- set Qt styles (e.g. \"oxygen,breeze\"), default \"*\"";
piCout << "-P <platforms> " << Green << "- set Qt platforms (e.g. \"win,mini\"), default by host system";
piCout << "--sql <drivers> " << Green << "- set Qt sql drivers (e.g. \"sqlite\"), default \"*\"";
piCout << "-a <add_libs> " << Green << "- additional libs, separated by \";\". Libraries will be searched in <search_path>"; piCout << "-a <add_libs> " << Green << "- additional libs, separated by \";\". Libraries will be searched in <search_path>";
} }
@@ -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; PIString ldd, readelf, objdump, otool, dpkg, out_dir, qt_dir, out_plugins_dir;
PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers; PIStringList styles, lib_dirs, add_libs, platforms, sqldrivers;
PISet<PIString> all_libs, miss_libs, all_deps, frameworks, miss_frameworks, qt_plugins; PISet<PIString> all_libs, miss_libs, all_deps, frameworks, miss_frameworks, qt_plugins;
PIMap<PIString, PIStringList> qt_filters;
PIString findLib(const PIString & l) { PIString findLib(const PIString & l) {
@@ -298,10 +307,10 @@ void procQt() {
qdir += "/plugins/"; qdir += "/plugins/";
#endif #endif
piForeachC (PIString & plugin, pdirs) { piForeachC (PIString & plugin, pdirs) {
PIStringList filters("*"); PIStringList filters = qt_filters[plugin];
if (plugin == "platforms") filters = platforms; /*if (plugin == "platforms") filters = platforms;
if (plugin == "styles") filters = styles; if (plugin == "styles") filters = styles;
if (plugin == "sqldrivers") filters = sqldrivers; if (plugin == "sqldrivers") filters = sqldrivers;*/
piForeachC (PIString & f, filters) { piForeachC (PIString & f, filters) {
copyWildcard(qdir + plugin + "/" + f, out_plugins_dir + plugin); copyWildcard(qdir + plugin + "/" + f, out_plugins_dir + plugin);
PIVector<PIFile::FileInfo> copied = PIDir(out_plugins_dir + plugin).entries(); PIVector<PIFile::FileInfo> copied = PIDir(out_plugins_dir + plugin).entries();
@@ -346,7 +355,7 @@ int main(int argc, char * argv[]) {
cli.addArgument("search_path", true); cli.addArgument("search_path", true);
cli.addArgument("Styles", true); cli.addArgument("Styles", true);
cli.addArgument("Platforms", true); cli.addArgument("Platforms", true);
cli.addArgument("sql", PIChar('\0'), true); cli.addArgument("qt-plugins", PIChar('\0'), true);
cli.addArgument("ldd", true); cli.addArgument("ldd", true);
cli.addArgument("Lreadelf", true); cli.addArgument("Lreadelf", true);
cli.addArgument("Wobjdump", true); cli.addArgument("Wobjdump", true);
@@ -398,17 +407,39 @@ int main(int argc, char * argv[]) {
if (!out_dir.endsWith("/")) out_dir += "/"; if (!out_dir.endsWith("/")) out_dir += "/";
if (ldd.isEmpty()) ldd = "/usr/bin/ldd"; 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()) if (!cli.argumentValue("Platforms").isEmpty())
qplatforms = cli.argumentValue("Platforms"); qplatforms = cli.argumentValue("Platforms");
platforms = qplatforms.split(","); platforms = qplatforms.split(",");
styles = cli.argumentValue("Styles").split(","); styles = cli.argumentValue("Styles").split(",");
if (styles.isEmpty()) styles << ""; if (styles.isEmpty()) styles << "";
sqldrivers = cli.argumentValue("sql").split(","); PIStringList qpd = cli.argumentValue("qt-plugins").toLowerCase().split(";");
if (sqldrivers.isEmpty()) sqldrivers << ""; 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;}); for (PIMap<PIString, PIStringList>::iterator it = qt_filters.begin(); it != qt_filters.end(); ++it)
styles .forEachInplace([](PIString i)->PIString{if (!i.startsWith("*")) i.prepend("*"); if (!i.endsWith("*")) i.append("*"); return i;}); it.value().forEachInplace([](PIString i)->PIString{
sqldrivers.forEachInplace([](PIString i)->PIString{if (!i.startsWith("*")) i.prepend("*"); if (!i.endsWith("*")) i.append("*"); return i;}); if (!i.startsWith("*")) i.prepend("*");
if (!i.endsWith("*")) i.append("*");
return i;
});
//PICout(PICoutManipulators::DefaultControls) << qt_filters;
if (!fake) if (!fake)
PIDir(out_dir).make(); PIDir(out_dir).make();