get rid of piForeach
apply some code analyzer recommendations ICU flag now check if libicu exists prepare for more accurate growth of containers (limited PoT, then constantly increase size)
This commit is contained in:
@@ -152,7 +152,7 @@ PIMap<PIString, PIStringList> qt_filters;
|
||||
|
||||
PIString findLib(const PIString & l) {
|
||||
if (PIFile::isExists(l)) return l;
|
||||
piForeachC(PIString & s, lib_dirs) {
|
||||
for (const auto & s: lib_dirs) {
|
||||
if (PIFile::isExists(s + l)) return s + l;
|
||||
if (win_target || l.toLowerCase().endsWith("dll")) {
|
||||
PIFile::FileInfo info(l);
|
||||
@@ -308,13 +308,13 @@ void procLdd(PIString file, bool ext_lib = false, int cur_depth = 0) {
|
||||
}
|
||||
if (!otool.isEmpty()) {
|
||||
lines = filter(execute(otool + " -L \"" + file + "\""), "(");
|
||||
piForeach(PIString & l, lines) {
|
||||
for (auto & l: lines) {
|
||||
l = l.left(l.find('('));
|
||||
l.trim(); //.append('.').prepend('.');
|
||||
}
|
||||
}
|
||||
}
|
||||
piForeachC(PIString & sl, lines) {
|
||||
for (const auto & sl: lines) {
|
||||
PIString l = sl.trimmed();
|
||||
if (!otool.isEmpty()) {
|
||||
PIString fname = frameworkName(l);
|
||||
@@ -367,7 +367,7 @@ void procLdd(PIString file, bool ext_lib = false, int cur_depth = 0) {
|
||||
}
|
||||
PIVector<PIString> clibs = cur_libs.toVector();
|
||||
if (!clibs.isEmpty()) piCout << " new dependencies:\n -" << PIStringList(clibs).join("\n - ");
|
||||
piForeachC(PIString & l, clibs) {
|
||||
for (const auto & l: clibs) {
|
||||
procLdd(l, false, cur_depth);
|
||||
}
|
||||
}
|
||||
@@ -402,7 +402,7 @@ void procQt() {
|
||||
PIDir(qt_plugins_dir).make(true);
|
||||
PIDir(qt_qml_dir).make(true);
|
||||
}
|
||||
piForeach(PIString l, vsl) {
|
||||
for (auto l: vsl) {
|
||||
if (l.trim().contains("Qt version")) {
|
||||
l.cutLeft(l.find("Qt version") + 10).trim();
|
||||
PIString qv = l.takeWord();
|
||||
@@ -411,7 +411,7 @@ void procQt() {
|
||||
piCout << "Qt" << qv << "in" << qloc;
|
||||
PIString qdir;
|
||||
PIStringList suffixes({".", "..", "qt5", "../qt5", "qt6", "../qt6"});
|
||||
piForeachC(PIString s, suffixes) {
|
||||
for (const auto & s: suffixes) {
|
||||
PIString qd = qloc + "/" + s + "/plugins/";
|
||||
if (piDebug) PICout(AddSpaces) << "Qt plugins root try" << qd << "...";
|
||||
if (PIDir::isExists(qd + "platforms")) {
|
||||
@@ -422,14 +422,14 @@ void procQt() {
|
||||
piCout << " no";
|
||||
}
|
||||
if (qdir.isEmpty()) break;
|
||||
piForeachC(PIString & plugin, pdirs) {
|
||||
for (const auto & plugin: pdirs) {
|
||||
PIStringList filters = qt_filters[plugin];
|
||||
piCout << "PLUG" << plugin << filters;
|
||||
piForeachC(PIString & f, filters) {
|
||||
for (const auto & f: filters) {
|
||||
if (f.isEmpty()) continue;
|
||||
copyWildcard(qdir + "plugins/" + plugin + "/" + f, qt_plugins_dir + plugin);
|
||||
PIVector<PIFile::FileInfo> copied = PIDir(qt_plugins_dir + plugin).entries();
|
||||
piForeachC(PIFile::FileInfo & fi, copied) {
|
||||
for (const auto & fi: copied) {
|
||||
if (fi.isFile()) {
|
||||
procLdd(fi.path);
|
||||
plugin_libs << fi.path;
|
||||
@@ -441,7 +441,7 @@ void procQt() {
|
||||
if (q.isEmpty()) continue;
|
||||
copyWildcard(qdir + "qml/" + q + "/*", qt_qml_dir + q);
|
||||
PIVector<PIFile::FileInfo> copied = PIDir(qt_qml_dir + q).allEntries();
|
||||
piForeachC(PIFile::FileInfo & fi, copied) {
|
||||
for (const auto & fi: copied) {
|
||||
if (fi.isFile()) {
|
||||
procLdd(fi.path);
|
||||
plugin_libs << fi.path;
|
||||
@@ -481,11 +481,11 @@ void patchNameTool() {
|
||||
PIFile::FileInfo fi;
|
||||
patch_list = input_files;
|
||||
patch_list << plugin_libs;
|
||||
piForeach(PIString l, clibs) {
|
||||
for (const auto & l: clibs) {
|
||||
fi.path = l;
|
||||
patch_list << (out_dir + fi.name());
|
||||
}
|
||||
piForeach(PIString local_lib, patch_list) {
|
||||
for (const auto & local_lib: patch_list) {
|
||||
execute("chmod +w \"" + local_lib + "\"");
|
||||
fi.path = local_lib;
|
||||
cmd = nametool + " -id \"@executable_path/../Frameworks/" + fi.name() + "\"";
|
||||
@@ -493,15 +493,15 @@ void patchNameTool() {
|
||||
// piCout << " " << cmd;
|
||||
execute(cmd);
|
||||
}
|
||||
piForeach(PIString f, flibs) {
|
||||
for (const auto & f: flibs) {
|
||||
PIString fl = findLib(frameworkName(f));
|
||||
if (fl.isEmpty()) continue;
|
||||
patch_list << (out_dir + frameworkName(f) + "/" + frameworkInternalPath(f));
|
||||
// PICout(DefaultControls) << "map" << f << "->" << (out_dir + frameworkName(f) + "/" + frameworkInternalPath(f));
|
||||
}
|
||||
piForeach(PIString local_lib, patch_list) {
|
||||
for (const auto & local_lib: patch_list) {
|
||||
dlibs = filter(execute(otool + " -L \"" + local_lib + "\""), "(");
|
||||
piForeach(PIString & l, dlibs) {
|
||||
for (auto & l: dlibs) {
|
||||
l = l.left(l.find('('));
|
||||
l.trim();
|
||||
}
|
||||
@@ -509,7 +509,7 @@ void patchNameTool() {
|
||||
execute("chmod +w \"" + local_lib + "\"");
|
||||
}
|
||||
piCout << "patch" << local_lib;
|
||||
piForeach(PIString sys_lib, dlibs) {
|
||||
for (auto sys_lib: dlibs) {
|
||||
sys_lib.cutRight(1).trim();
|
||||
fi.path = sys_lib;
|
||||
libname = fi.name();
|
||||
@@ -536,7 +536,7 @@ void patchNameTool() {
|
||||
}
|
||||
}
|
||||
}
|
||||
piForeach(PIString bin, input_files) {
|
||||
for (const auto & bin: input_files) {
|
||||
cmd = nametool + " -add_rpath \"@executable_path/../Frameworks\"";
|
||||
cmd += " \"" + bin + "\"" + ign_err_suffix;
|
||||
execute(cmd);
|
||||
@@ -559,9 +559,9 @@ void patchRPathFile(const PIFile::FileInfo & file) {
|
||||
void patchRPath() {
|
||||
PIStringList dirs({out_dir, target_dir, qt_plugins_dir, qt_qml_dir});
|
||||
dirs.removeDuplicates().removeStrings(PIString());
|
||||
piForeachC(PIString & d, dirs) {
|
||||
for (const auto & d: dirs) {
|
||||
PIVector<PIFile::FileInfo> files = PIDir(d).allEntries();
|
||||
piForeachC(PIFile::FileInfo & f, files) {
|
||||
for (const auto & f: files) {
|
||||
if (f.isDir()) continue;
|
||||
patchRPathFile(f.path);
|
||||
}
|
||||
@@ -649,7 +649,7 @@ int main(int argc, char * argv[]) {
|
||||
if (!qroot.endsWith("/")) qroot.append("/");
|
||||
lib_dirs << (qroot + "bin") << (qroot + "lib") << (qroot + "Frameworks");
|
||||
}
|
||||
piForeach(PIString & s, lib_dirs) {
|
||||
for (auto & s: lib_dirs) {
|
||||
s.trim();
|
||||
if (!s.endsWith("/")) s += "/";
|
||||
}
|
||||
@@ -669,7 +669,7 @@ int main(int argc, char * argv[]) {
|
||||
styles = cli.argumentValue("Styles").split(",");
|
||||
if (styles.isEmpty()) styles << "";
|
||||
PIStringList qpd = cli.argumentValue("qt-plugins").toLowerCase().split(DELIM).removeAll("");
|
||||
piForeachC(PIString & qp, qpd) {
|
||||
for (const auto & qp: qpd) {
|
||||
int _i = qp.find('=');
|
||||
if (_i < 0) continue;
|
||||
PIString pname = qp.left(_i).trim();
|
||||
@@ -739,7 +739,7 @@ int main(int argc, char * argv[]) {
|
||||
checkQtLib(f);
|
||||
});
|
||||
}
|
||||
piForeach(PIString & s, add_libs) {
|
||||
for (auto & s: add_libs) {
|
||||
if (s.isEmpty()) continue;
|
||||
PIString alib = findLib(s);
|
||||
if (alib.isEmpty()) continue;
|
||||
@@ -752,7 +752,7 @@ int main(int argc, char * argv[]) {
|
||||
if (is_deps) { // if Qt in system, then no plugins copy
|
||||
PIVector<PIString> qlibs = qt_libs.toVector();
|
||||
piCout << "check for installed Qt" << qlibs;
|
||||
piForeach(PIString l, qlibs) {
|
||||
for (const auto & l: qlibs) {
|
||||
if (procDpkg(l)) {
|
||||
piCout << "system Qt found!";
|
||||
need_qt_plugins = false;
|
||||
@@ -783,7 +783,7 @@ int main(int argc, char * argv[]) {
|
||||
out_dir.replaceAll("/", "\\");
|
||||
#endif
|
||||
PIVector<PIString> clibs = all_libs.toVector();
|
||||
piForeach(PIString l, clibs) {
|
||||
for (auto l: clibs) {
|
||||
PIFile::FileInfo fi;
|
||||
fi.path = l;
|
||||
#ifdef WINDOWS
|
||||
@@ -803,7 +803,7 @@ int main(int argc, char * argv[]) {
|
||||
}
|
||||
}
|
||||
PIVector<PIString> fwdirs = frameworks.toVector();
|
||||
piForeachC(PIString & f, fwdirs) {
|
||||
for (const auto & f: fwdirs) {
|
||||
PIString fd = findLib(f);
|
||||
if (!fd.isEmpty()) {
|
||||
piCout << "copy framework" << f;
|
||||
|
||||
Reference in New Issue
Block a user