2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#include "pbuilder_pbx.h"
|
|
|
|
#include "option.h"
|
|
|
|
#include "meta.h"
|
|
|
|
#include <qdir.h>
|
2020-04-03 15:11:36 +00:00
|
|
|
#include <qregularexpression.h>
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <qcryptographichash.h>
|
|
|
|
#include <qdebug.h>
|
2016-09-14 18:36:45 +00:00
|
|
|
#include <qsettings.h>
|
2012-11-13 14:26:17 +00:00
|
|
|
#include <qstring.h>
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
|
|
|
#ifdef Q_OS_UNIX
|
|
|
|
# include <sys/types.h>
|
|
|
|
# include <sys/stat.h>
|
|
|
|
#endif
|
|
|
|
#ifdef Q_OS_DARWIN
|
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
|
|
|
#include <private/qcore_mac_p.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
//#define GENERATE_AGGREGRATE_SUBDIR
|
|
|
|
|
|
|
|
// Note: this is fairly hacky, but it does the job...
|
|
|
|
|
2012-09-25 12:39:45 +00:00
|
|
|
using namespace QMakeInternal;
|
|
|
|
|
2013-08-13 20:38:45 +00:00
|
|
|
static QString qtSha1(const QByteArray &src)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2013-08-13 20:38:45 +00:00
|
|
|
QByteArray digest = QCryptographicHash::hash(src, QCryptographicHash::Sha1);
|
2011-04-27 10:05:43 +00:00
|
|
|
return QString::fromLatin1(digest.toHex());
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ProjectBuilderMakefileGenerator::writeMakefile(QTextStream &t)
|
|
|
|
{
|
|
|
|
writingUnixMakefileGenerator = false;
|
|
|
|
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
|
|
|
|
/* for now just dump, I need to generated an empty xml or something.. */
|
|
|
|
fprintf(stderr, "Project file not generated because all requirements not met:\n\t%s\n",
|
|
|
|
var("QMAKE_FAILED_REQUIREMENTS").toLatin1().constData());
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
project->values("MAKEFILE").clear();
|
|
|
|
project->values("MAKEFILE").append("Makefile");
|
|
|
|
if(project->first("TEMPLATE") == "app" || project->first("TEMPLATE") == "lib")
|
|
|
|
return writeMakeParts(t);
|
|
|
|
else if(project->first("TEMPLATE") == "subdirs")
|
|
|
|
return writeSubDirs(t);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ProjectBuilderSubDirs {
|
|
|
|
QMakeProject *project;
|
|
|
|
QString subdir;
|
|
|
|
bool autoDelete;
|
|
|
|
ProjectBuilderSubDirs(QMakeProject *p, QString s, bool a=true) : project(p), subdir(s), autoDelete(a) { }
|
|
|
|
~ProjectBuilderSubDirs() {
|
|
|
|
if(autoDelete)
|
|
|
|
delete project;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
bool
|
|
|
|
ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
|
|
|
|
{
|
|
|
|
//HEADER
|
|
|
|
const int pbVersion = pbuilderVersion();
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "// !$*UTF8*$!\n"
|
|
|
|
<< "{\n"
|
|
|
|
<< "\t" << writeSettings("archiveVersion", "1", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\tclasses = {\n\t};\n"
|
|
|
|
<< "\t" << writeSettings("objectVersion", QString::number(pbVersion), SettingsNoQuote) << ";\n"
|
|
|
|
<< "\tobjects = {\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
//SUBDIRS
|
|
|
|
QList<ProjectBuilderSubDirs*> pb_subdirs;
|
|
|
|
pb_subdirs.append(new ProjectBuilderSubDirs(project, QString(), false));
|
|
|
|
QString oldpwd = qmake_getpwd();
|
2013-02-27 18:12:02 +00:00
|
|
|
QString oldoutpwd = Option::output_dir;
|
2012-09-06 10:21:38 +00:00
|
|
|
QMap<QString, ProStringList> groups;
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int pb_subdir = 0; pb_subdir < pb_subdirs.size(); ++pb_subdir) {
|
|
|
|
ProjectBuilderSubDirs *pb = pb_subdirs[pb_subdir];
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &subdirs = pb->project->values("SUBDIRS");
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int subdir = 0; subdir < subdirs.size(); subdir++) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString tmpk = subdirs[subdir];
|
|
|
|
const ProKey fkey(tmpk + ".file");
|
|
|
|
if (!pb->project->isEmpty(fkey)) {
|
|
|
|
tmpk = pb->project->first(fkey);
|
|
|
|
} else {
|
|
|
|
const ProKey skey(tmpk + ".subdir");
|
|
|
|
if (!pb->project->isEmpty(skey))
|
|
|
|
tmpk = pb->project->first(skey);
|
|
|
|
}
|
|
|
|
QString tmp = tmpk.toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(fileInfo(tmp).isRelative() && !pb->subdir.isEmpty()) {
|
|
|
|
QString subdir = pb->subdir;
|
|
|
|
if(!subdir.endsWith(Option::dir_sep))
|
|
|
|
subdir += Option::dir_sep;
|
|
|
|
tmp = subdir + tmp;
|
|
|
|
}
|
2014-11-24 15:02:38 +00:00
|
|
|
QFileInfo fi(fileInfo(Option::normalizePath(tmp)));
|
2011-04-27 10:05:43 +00:00
|
|
|
if(fi.exists()) {
|
|
|
|
if(fi.isDir()) {
|
|
|
|
QString profile = tmp;
|
|
|
|
if(!profile.endsWith(Option::dir_sep))
|
|
|
|
profile += Option::dir_sep;
|
|
|
|
profile += fi.baseName() + Option::pro_ext;
|
|
|
|
fi = QFileInfo(profile);
|
|
|
|
}
|
|
|
|
QMakeProject tmp_proj;
|
|
|
|
QString dir = fi.path(), fn = fi.fileName();
|
|
|
|
if(!dir.isEmpty()) {
|
|
|
|
if(!qmake_setpwd(dir))
|
|
|
|
fprintf(stderr, "Cannot find directory: %s\n", dir.toLatin1().constData());
|
|
|
|
}
|
2018-07-02 16:41:26 +00:00
|
|
|
Option::output_dir = Option::globals->shadowedPath(qmake_getpwd());
|
2011-04-27 10:05:43 +00:00
|
|
|
if(tmp_proj.read(fn)) {
|
|
|
|
if(tmp_proj.first("TEMPLATE") == "subdirs") {
|
|
|
|
QMakeProject *pp = new QMakeProject(&tmp_proj);
|
|
|
|
pb_subdirs += new ProjectBuilderSubDirs(pp, dir);
|
|
|
|
} else if(tmp_proj.first("TEMPLATE") == "app" || tmp_proj.first("TEMPLATE") == "lib") {
|
2018-07-02 16:41:26 +00:00
|
|
|
QString pbxproj = Option::output_dir + Option::dir_sep + tmp_proj.first("TARGET") + projectSuffix();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!exists(pbxproj)) {
|
|
|
|
warn_msg(WarnLogic, "Ignored (not found) '%s'", pbxproj.toLatin1().constData());
|
|
|
|
goto nextfile; // # Dirty!
|
|
|
|
}
|
|
|
|
const QString project_key = keyFor(pbxproj + "_PROJECTREF");
|
|
|
|
project->values("QMAKE_PBX_SUBDIRS") += pbxproj;
|
|
|
|
//PROJECTREF
|
|
|
|
{
|
|
|
|
bool in_root = true;
|
|
|
|
QString name = qmake_getpwd();
|
|
|
|
if(project->isActiveConfig("flat")) {
|
2015-04-13 19:18:36 +00:00
|
|
|
QString flat_file = fileFixify(name, FileFixifyBackwards | FileFixifyRelative);
|
2011-04-27 10:05:43 +00:00
|
|
|
if(flat_file.indexOf(Option::dir_sep) != -1) {
|
|
|
|
QStringList dirs = flat_file.split(Option::dir_sep);
|
|
|
|
name = dirs.back();
|
|
|
|
}
|
|
|
|
} else {
|
2015-04-13 19:18:36 +00:00
|
|
|
QString flat_file = fileFixify(name, FileFixifyBackwards | FileFixifyRelative);
|
2011-04-27 10:05:43 +00:00
|
|
|
if(QDir::isRelativePath(flat_file) && flat_file.indexOf(Option::dir_sep) != -1) {
|
|
|
|
QString last_grp("QMAKE_SUBDIR_PBX_HEIR_GROUP");
|
|
|
|
QStringList dirs = flat_file.split(Option::dir_sep);
|
|
|
|
name = dirs.back();
|
|
|
|
for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
|
|
|
|
QString new_grp(last_grp + Option::dir_sep + (*dir_it)), new_grp_key(keyFor(new_grp));
|
|
|
|
if(dir_it == dirs.begin()) {
|
|
|
|
if(!groups.contains(new_grp))
|
|
|
|
project->values("QMAKE_SUBDIR_PBX_GROUPS").append(new_grp_key);
|
|
|
|
} else {
|
|
|
|
if(!groups[last_grp].contains(new_grp_key))
|
|
|
|
groups[last_grp] += new_grp_key;
|
|
|
|
}
|
|
|
|
last_grp = new_grp;
|
|
|
|
}
|
|
|
|
groups[last_grp] += project_key;
|
|
|
|
in_root = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(in_root)
|
|
|
|
project->values("QMAKE_SUBDIR_PBX_GROUPS") += project_key;
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << project_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("lastKnownFileType", "wrapper.pb-project") << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", tmp_proj.first("TARGET") + projectSuffix()) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t\t" << writeSettings("path", pbxproj) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<absolute>") << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
//WRAPPER
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor(pbxproj + "_WRAPPER") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXReferenceProxy", SettingsNoQuote) << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(tmp_proj.first("TEMPLATE") == "app") {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("fileType", "wrapper.application") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("path", tmp_proj.first("TARGET") + ".app") << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("fileType", "compiled.mach-o.dylib") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("path", tmp_proj.first("TARGET") + ".dylib") << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("remoteRef", keyFor(pbxproj + "_WRAPPERREF")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
t << "\t\t" << keyFor(pbxproj + "_WRAPPERREF") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("containerPortal", project_key) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXContainerItemProxy", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("proxyType", "2") << ";\n"
|
|
|
|
// << "\t\t\t" << writeSettings("remoteGlobalIDString", keyFor(pbxproj + "QMAKE_PBX_REFERENCE")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("remoteGlobalIDString", keyFor(pbxproj + "QMAKE_PBX_REFERENCE!!!")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("remoteInfo", tmp_proj.first("TARGET")) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
//PRODUCTGROUP
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor(pbxproj + "_PRODUCTGROUP") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("children", project->values(ProKey(pbxproj + "_WRAPPER")), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Products") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
#ifdef GENERATE_AGGREGRATE_SUBDIR
|
|
|
|
//TARGET (for aggregate)
|
|
|
|
{
|
|
|
|
//container
|
|
|
|
const QString container_proxy = keyFor(pbxproj + "_CONTAINERPROXY");
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << container_proxy << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("containerPortal", project_key) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXContainerItemProxy", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("proxyType", "1") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("remoteGlobalIDString", keyFor(pbxproj + "QMAKE_PBX_TARGET")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("remoteInfo", tmp_proj.first("TARGET")) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
//targetref
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor(pbxproj + "_TARGETREF") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXTargetDependency", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", fixForOutput(tmp_proj.first("TARGET") +" (from " + tmp_proj.first("TARGET") + projectSuffix() + ")")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("targetProxy", container_proxy) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nextfile:
|
|
|
|
qmake_setpwd(oldpwd);
|
2013-02-27 18:12:02 +00:00
|
|
|
Option::output_dir = oldoutpwd;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
qDeleteAll(pb_subdirs);
|
|
|
|
pb_subdirs.clear();
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
for (QMap<QString, ProStringList>::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor(grp_it.key()) << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("children", grp_it.value(), SettingsAsList, 4) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", grp_it.key().section(Option::dir_sep, -1)) << ";\n"
|
2016-04-19 22:52:42 +00:00
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER
|
2012-11-13 14:26:17 +00:00
|
|
|
//BUILDCONFIGURATIONS
|
|
|
|
QString defaultConfig;
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int as_release = 0; as_release < 2; as_release++)
|
|
|
|
{
|
2013-10-09 13:10:39 +00:00
|
|
|
QString configName = (as_release ? "Release" : "Debug");
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QMap<QString, QString> settings;
|
|
|
|
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
|
2012-09-06 10:21:38 +00:00
|
|
|
settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK").toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &l = project->values("QMAKE_MAC_XCODE_SETTINGS");
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; i < l.size(); ++i) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString name = l.at(i);
|
2013-10-09 13:10:39 +00:00
|
|
|
const ProKey buildKey(name + ".build");
|
|
|
|
if (!project->isEmpty(buildKey)) {
|
2014-11-27 13:49:16 +00:00
|
|
|
const QString build = project->first(buildKey).toQString();
|
2013-10-09 13:10:39 +00:00
|
|
|
if (build.toLower() != configName.toLower())
|
|
|
|
continue;
|
|
|
|
}
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProKey nkey(name + ".name");
|
|
|
|
if (!project->isEmpty(nkey))
|
|
|
|
name = project->first(nkey);
|
|
|
|
const QString value = project->values(ProKey(name + ".value")).join(QString(Option::field_sep));
|
|
|
|
settings.insert(name.toQString(), value);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-13 14:26:17 +00:00
|
|
|
if (project->isActiveConfig("debug") != (bool)as_release)
|
2013-10-09 13:10:39 +00:00
|
|
|
defaultConfig = configName;
|
|
|
|
QString key = keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_" + configName);
|
2012-06-01 23:49:18 +00:00
|
|
|
project->values("QMAKE_SUBDIR_PBX_BUILDCONFIGS").append(key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "XCBuildConfiguration", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\tbuildSettings = {\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
for (QMap<QString, QString>::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it)
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings(set_it.key(), set_it.value()) << ";\n";
|
|
|
|
t << "\t\t\t};\n"
|
2013-10-09 13:10:39 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", configName) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_LIST") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildConfigurations", project->values("QMAKE_SUBDIR_PBX_BUILDCONFIGS"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("defaultConfigurationName", defaultConfig, SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifdef GENERATE_AGGREGRATE_SUBDIR
|
|
|
|
//target
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_AGGREGATE_TARGET") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildPhases", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\tbuildSettings = {\n"
|
2014-11-27 13:49:16 +00:00
|
|
|
<< "\t\t\t\t" << writeSettings("PRODUCT_NAME", project->first("TARGET")) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList dependencies;
|
|
|
|
const ProStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS");
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; i < qmake_subdirs.count(); i++)
|
|
|
|
dependencies += keyFor(qmake_subdirs[i] + "_TARGETREF");
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("dependencies", dependencies, SettingsAsList, 4) << ";\n"
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("isa", "PBXAggregateTarget", SettingsNoQuote) << ";\n"
|
2014-11-27 13:49:16 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", project->first("TARGET")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("productName", project->first("TARGET")) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//ROOT_GROUP
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_ROOT_GROUP") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("children", project->values("QMAKE_SUBDIR_PBX_GROUPS"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
//ROOT
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor("QMAKE_SUBDIR_PBX_ROOT") << " = {\n"
|
|
|
|
<< "\t\t\tbuildSettings = {\n"
|
|
|
|
<< "\t\t\t};\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildStyles", project->values("QMAKE_SUBDIR_PBX_BUILDSTYLES"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXProject", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("mainGroup", keyFor("QMAKE_SUBDIR_PBX_ROOT_GROUP")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("projectDirPath", ProStringList()) << ";\n";
|
|
|
|
t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_LIST")) << ";\n";
|
|
|
|
t << "\t\t\tprojectReferences = (\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS");
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int i = 0; i < qmake_subdirs.size(); i++) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProString &subdir = qmake_subdirs[i];
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t{\n"
|
|
|
|
<< "\t\t\t\t\t" << writeSettings("ProductGroup", keyFor(subdir + "_PRODUCTGROUP")) << ";\n"
|
|
|
|
<< "\t\t\t\t\t" << writeSettings("ProjectRef", keyFor(subdir + "_PROJECTREF")) << ";\n"
|
|
|
|
<< "\t\t\t\t},\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t);\n"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< "\t\t\t" << writeSettings("targets",
|
|
|
|
#ifdef GENERATE_AGGREGRATE_SUBDIR
|
|
|
|
project->values("QMAKE_SUBDIR_AGGREGATE_TARGET"),
|
|
|
|
#else
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList(),
|
2011-04-27 10:05:43 +00:00
|
|
|
#endif
|
2013-07-04 09:25:16 +00:00
|
|
|
SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
//FOOTER
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t};\n"
|
|
|
|
<< "\t" << writeSettings("rootObject", keyFor("QMAKE_SUBDIR_PBX_ROOT")) << ";\n"
|
|
|
|
<< "}\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
class ProjectBuilderSources
|
|
|
|
{
|
|
|
|
bool buildable, object_output;
|
|
|
|
QString key, group, compiler;
|
|
|
|
public:
|
2014-06-26 14:29:23 +00:00
|
|
|
ProjectBuilderSources(const QString &key, bool buildable = false, const QString &compiler = QString(), bool producesObject = false);
|
2011-04-27 10:05:43 +00:00
|
|
|
QStringList files(QMakeProject *project) const;
|
|
|
|
inline bool isBuildable() const { return buildable; }
|
|
|
|
inline QString keyName() const { return key; }
|
|
|
|
inline QString groupName() const { return group; }
|
|
|
|
inline QString compilerName() const { return compiler; }
|
|
|
|
inline bool isObjectOutput(const QString &file) const {
|
Distinguish between Objective-C and Objective-C++ sources
Instead of lumping both Objective-C (.m) and Objective-C++ (.mm) sources
into the same pile, passing them on to the same compiler as for C++ (CXX),
with the C++ flags (CXXFLAGS), we follow Apple's lead and treat them as
variants of the C and C++ languages separately, so that Objective-C
sources are built with CC and with CFLAGS, and Objective-C++ sources
with CXX, and CXXFLAGS.
This lets us remove a lot of duplicated flags and definitions from the
QMAKE_OBJECTIVE_CFLAGS variable, which in 99% of the cases just matched
the C++ equivalent. The remaining Objective-C/C++ flags are added to
CFLAGS/CXXFLAGS, as the compiler will just ignore them when running in
C/C++ mode. This matches Xcode, which also doesn't have a separate build
setting for Objective-C/C++ flags.
The Makefile qmake generator has been rewritten to support Objective-C/C++
fully, by not assuming that we're just iterating over the C and C++
extensions when dealing with compilation rules, precompiled headers, etc.
There's some duplicated logic in this code, as inherent by qmake's already
duplicated code paths, but this can be cleaned up when C++11 support is
mandatory and we can use lambda functions.
Task-number: QTBUG-36575
Change-Id: I4f06576d5f49e939333a2e03d965da54119e5e31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-10-02 11:54:33 +00:00
|
|
|
if (object_output)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (file.endsWith(Option::objc_ext))
|
|
|
|
return true;
|
|
|
|
if (file.endsWith(Option::objcpp_ext))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
for (int i = 0; i < Option::c_ext.size(); ++i) {
|
|
|
|
if (file.endsWith(Option::c_ext.at(i)))
|
|
|
|
return true;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
Distinguish between Objective-C and Objective-C++ sources
Instead of lumping both Objective-C (.m) and Objective-C++ (.mm) sources
into the same pile, passing them on to the same compiler as for C++ (CXX),
with the C++ flags (CXXFLAGS), we follow Apple's lead and treat them as
variants of the C and C++ languages separately, so that Objective-C
sources are built with CC and with CFLAGS, and Objective-C++ sources
with CXX, and CXXFLAGS.
This lets us remove a lot of duplicated flags and definitions from the
QMAKE_OBJECTIVE_CFLAGS variable, which in 99% of the cases just matched
the C++ equivalent. The remaining Objective-C/C++ flags are added to
CFLAGS/CXXFLAGS, as the compiler will just ignore them when running in
C/C++ mode. This matches Xcode, which also doesn't have a separate build
setting for Objective-C/C++ flags.
The Makefile qmake generator has been rewritten to support Objective-C/C++
fully, by not assuming that we're just iterating over the C and C++
extensions when dealing with compilation rules, precompiled headers, etc.
There's some duplicated logic in this code, as inherent by qmake's already
duplicated code paths, but this can be cleaned up when C++11 support is
mandatory and we can use lambda functions.
Task-number: QTBUG-36575
Change-Id: I4f06576d5f49e939333a2e03d965da54119e5e31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-10-02 11:54:33 +00:00
|
|
|
for (int i = 0; i < Option::cpp_ext.size(); ++i) {
|
|
|
|
if (file.endsWith(Option::cpp_ext.at(i)))
|
|
|
|
return true;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
Distinguish between Objective-C and Objective-C++ sources
Instead of lumping both Objective-C (.m) and Objective-C++ (.mm) sources
into the same pile, passing them on to the same compiler as for C++ (CXX),
with the C++ flags (CXXFLAGS), we follow Apple's lead and treat them as
variants of the C and C++ languages separately, so that Objective-C
sources are built with CC and with CFLAGS, and Objective-C++ sources
with CXX, and CXXFLAGS.
This lets us remove a lot of duplicated flags and definitions from the
QMAKE_OBJECTIVE_CFLAGS variable, which in 99% of the cases just matched
the C++ equivalent. The remaining Objective-C/C++ flags are added to
CFLAGS/CXXFLAGS, as the compiler will just ignore them when running in
C/C++ mode. This matches Xcode, which also doesn't have a separate build
setting for Objective-C/C++ flags.
The Makefile qmake generator has been rewritten to support Objective-C/C++
fully, by not assuming that we're just iterating over the C and C++
extensions when dealing with compilation rules, precompiled headers, etc.
There's some duplicated logic in this code, as inherent by qmake's already
duplicated code paths, but this can be cleaned up when C++11 support is
mandatory and we can use lambda functions.
Task-number: QTBUG-36575
Change-Id: I4f06576d5f49e939333a2e03d965da54119e5e31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-10-02 11:54:33 +00:00
|
|
|
|
|
|
|
return false;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-06-26 14:29:23 +00:00
|
|
|
ProjectBuilderSources::ProjectBuilderSources(const QString &k, bool b, const QString &c, bool o) :
|
|
|
|
buildable(b), object_output(o), key(k), compiler(c)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-11-12 14:48:36 +00:00
|
|
|
// Override group name for a few common keys
|
|
|
|
if (k == "SOURCES" || k == "OBJECTIVE_SOURCES" || k == "HEADERS")
|
|
|
|
group = "Sources";
|
|
|
|
else if (k == "QMAKE_INTERNAL_INCLUDED_FILES")
|
|
|
|
group = "Supporting Files";
|
|
|
|
else if (k == "GENERATED_SOURCES" || k == "GENERATED_FILES")
|
|
|
|
group = "Generated Sources";
|
|
|
|
else if (k == "RESOURCES")
|
|
|
|
group = "Resources";
|
|
|
|
else if (group.isNull())
|
|
|
|
group = QString("Sources [") + c + "]";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QStringList
|
|
|
|
ProjectBuilderSources::files(QMakeProject *project) const
|
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
QStringList ret = project->values(ProKey(key)).toQStringList();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(key == "QMAKE_INTERNAL_INCLUDED_FILES") {
|
2014-11-28 18:47:55 +00:00
|
|
|
QString qtPrefix(project->propertyValue(ProKey("QT_INSTALL_PREFIX/get")).toQString() + '/');
|
|
|
|
QString qtSrcPrefix(project->propertyValue(ProKey("QT_INSTALL_PREFIX/src")).toQString() + '/');
|
2014-07-24 11:23:48 +00:00
|
|
|
|
2013-11-22 09:28:25 +00:00
|
|
|
QStringList newret;
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; i < ret.size(); ++i) {
|
2014-07-24 11:23:48 +00:00
|
|
|
// Don't show files "internal" to Qt in Xcode
|
|
|
|
if (ret.at(i).startsWith(qtPrefix) || ret.at(i).startsWith(qtSrcPrefix))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
newret.append(ret.at(i));
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-11-22 09:28:25 +00:00
|
|
|
ret = newret;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(key == "SOURCES" && project->first("TEMPLATE") == "app" && !project->isEmpty("ICON"))
|
2012-09-06 10:21:38 +00:00
|
|
|
ret.append(project->first("ICON").toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-11-13 14:26:17 +00:00
|
|
|
static QString xcodeFiletypeForFilename(const QString &filename)
|
|
|
|
{
|
2022-10-06 09:08:21 +00:00
|
|
|
for (const QString &ext : std::as_const(Option::cpp_ext)) {
|
2012-11-13 14:26:17 +00:00
|
|
|
if (filename.endsWith(ext))
|
|
|
|
return QStringLiteral("sourcecode.cpp.cpp");
|
|
|
|
}
|
|
|
|
|
2022-10-06 09:08:21 +00:00
|
|
|
for (const QString &ext : std::as_const(Option::c_ext)) {
|
2012-11-13 14:26:17 +00:00
|
|
|
if (filename.endsWith(ext))
|
|
|
|
return QStringLiteral("sourcecode.c.c");
|
|
|
|
}
|
|
|
|
|
2022-10-06 09:08:21 +00:00
|
|
|
for (const QString &ext : std::as_const(Option::h_ext)) {
|
2012-11-13 14:26:17 +00:00
|
|
|
if (filename.endsWith(ext))
|
|
|
|
return "sourcecode.c.h";
|
|
|
|
}
|
|
|
|
|
Distinguish between Objective-C and Objective-C++ sources
Instead of lumping both Objective-C (.m) and Objective-C++ (.mm) sources
into the same pile, passing them on to the same compiler as for C++ (CXX),
with the C++ flags (CXXFLAGS), we follow Apple's lead and treat them as
variants of the C and C++ languages separately, so that Objective-C
sources are built with CC and with CFLAGS, and Objective-C++ sources
with CXX, and CXXFLAGS.
This lets us remove a lot of duplicated flags and definitions from the
QMAKE_OBJECTIVE_CFLAGS variable, which in 99% of the cases just matched
the C++ equivalent. The remaining Objective-C/C++ flags are added to
CFLAGS/CXXFLAGS, as the compiler will just ignore them when running in
C/C++ mode. This matches Xcode, which also doesn't have a separate build
setting for Objective-C/C++ flags.
The Makefile qmake generator has been rewritten to support Objective-C/C++
fully, by not assuming that we're just iterating over the C and C++
extensions when dealing with compilation rules, precompiled headers, etc.
There's some duplicated logic in this code, as inherent by qmake's already
duplicated code paths, but this can be cleaned up when C++11 support is
mandatory and we can use lambda functions.
Task-number: QTBUG-36575
Change-Id: I4f06576d5f49e939333a2e03d965da54119e5e31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-10-02 11:54:33 +00:00
|
|
|
if (filename.endsWith(Option::objcpp_ext))
|
2012-11-13 14:26:17 +00:00
|
|
|
return QStringLiteral("sourcecode.cpp.objcpp");
|
Distinguish between Objective-C and Objective-C++ sources
Instead of lumping both Objective-C (.m) and Objective-C++ (.mm) sources
into the same pile, passing them on to the same compiler as for C++ (CXX),
with the C++ flags (CXXFLAGS), we follow Apple's lead and treat them as
variants of the C and C++ languages separately, so that Objective-C
sources are built with CC and with CFLAGS, and Objective-C++ sources
with CXX, and CXXFLAGS.
This lets us remove a lot of duplicated flags and definitions from the
QMAKE_OBJECTIVE_CFLAGS variable, which in 99% of the cases just matched
the C++ equivalent. The remaining Objective-C/C++ flags are added to
CFLAGS/CXXFLAGS, as the compiler will just ignore them when running in
C/C++ mode. This matches Xcode, which also doesn't have a separate build
setting for Objective-C/C++ flags.
The Makefile qmake generator has been rewritten to support Objective-C/C++
fully, by not assuming that we're just iterating over the C and C++
extensions when dealing with compilation rules, precompiled headers, etc.
There's some duplicated logic in this code, as inherent by qmake's already
duplicated code paths, but this can be cleaned up when C++11 support is
mandatory and we can use lambda functions.
Task-number: QTBUG-36575
Change-Id: I4f06576d5f49e939333a2e03d965da54119e5e31
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-10-02 11:54:33 +00:00
|
|
|
if (filename.endsWith(Option::objc_ext))
|
2012-11-13 14:26:17 +00:00
|
|
|
return QStringLiteral("sourcecode.c.objc");
|
2016-01-19 07:55:32 +00:00
|
|
|
if (filename.endsWith(QLatin1String(".framework")))
|
2012-11-13 14:26:17 +00:00
|
|
|
return QStringLiteral("wrapper.framework");
|
2016-01-19 07:55:32 +00:00
|
|
|
if (filename.endsWith(QLatin1String(".a")))
|
2012-11-13 14:26:17 +00:00
|
|
|
return QStringLiteral("archive.ar");
|
2016-01-19 07:55:32 +00:00
|
|
|
if (filename.endsWith(QLatin1String(".pro")) || filename.endsWith(QLatin1String(".qrc")))
|
2012-11-13 14:26:17 +00:00
|
|
|
return QStringLiteral("text");
|
|
|
|
|
|
|
|
return QString();
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2016-09-21 16:41:13 +00:00
|
|
|
static bool compareProvisioningTeams(const QVariantMap &a, const QVariantMap &b)
|
|
|
|
{
|
|
|
|
int aFree = a.value(QLatin1String("isFreeProvisioningTeam")).toBool() ? 1 : 0;
|
|
|
|
int bFree = b.value(QLatin1String("isFreeProvisioningTeam")).toBool() ? 1 : 0;
|
|
|
|
return aFree < bFree;
|
|
|
|
}
|
|
|
|
|
|
|
|
static QList<QVariantMap> provisioningTeams()
|
|
|
|
{
|
|
|
|
const QSettings xcodeSettings(
|
|
|
|
QDir::homePath() + QLatin1String("/Library/Preferences/com.apple.dt.Xcode.plist"),
|
|
|
|
QSettings::NativeFormat);
|
|
|
|
const QVariantMap teamMap = xcodeSettings.value(QLatin1String("IDEProvisioningTeams")).toMap();
|
|
|
|
QList<QVariantMap> flatTeams;
|
|
|
|
for (QVariantMap::const_iterator it = teamMap.begin(), end = teamMap.end(); it != end; ++it) {
|
|
|
|
const QString emailAddress = it.key();
|
2020-10-06 15:58:48 +00:00
|
|
|
const QVariantList emailTeams = it.value().toList();
|
|
|
|
|
|
|
|
for (QVariantList::const_iterator teamIt = emailTeams.begin(),
|
|
|
|
teamEnd = emailTeams.end(); teamIt != teamEnd; ++teamIt) {
|
|
|
|
QVariantMap team = teamIt->toMap();
|
|
|
|
team[QLatin1String("emailAddress")] = emailAddress;
|
|
|
|
flatTeams.append(team);
|
|
|
|
}
|
2016-09-21 16:41:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sort teams so that Free Provisioning teams come last
|
|
|
|
std::sort(flatTeams.begin(), flatTeams.end(), ::compareProvisioningTeams);
|
|
|
|
return flatTeams;
|
|
|
|
}
|
|
|
|
|
2019-08-26 13:21:03 +00:00
|
|
|
bool ProjectBuilderMakefileGenerator::replaceLibrarySuffix(const QString &lib_file,
|
|
|
|
const ProString &opt,
|
|
|
|
QString &name, QString &library)
|
|
|
|
{
|
|
|
|
/* This isn't real nice, but it is real useful. This looks in a prl
|
|
|
|
for what the library will ultimately be called so we can stick it
|
|
|
|
in the ProjectFile. If the prl format ever changes (not likely) then
|
|
|
|
this will not really work. However, more concerning is that it will
|
|
|
|
encode the version number in the Project file which might be a bad
|
|
|
|
things in days to come? --Sam
|
|
|
|
*/
|
|
|
|
if (lib_file.isEmpty())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QMakeMetaInfo libinfo;
|
|
|
|
if (!libinfo.readLib(lib_file) || libinfo.isEmpty("QMAKE_PRL_TARGET"))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const QString libDir = fileInfo(lib_file).absolutePath();
|
|
|
|
library = libDir + Option::dir_sep + libinfo.first("QMAKE_PRL_TARGET");
|
|
|
|
|
|
|
|
debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",
|
|
|
|
opt.toLatin1().constData(), lib_file.toLatin1().constData(), library.toLatin1().constData());
|
|
|
|
|
|
|
|
if (project->isActiveConfig("xcode_dynamic_library_suffix")) {
|
|
|
|
QString suffixSetting = project->first("QMAKE_XCODE_LIBRARY_SUFFIX_SETTING").toQString();
|
|
|
|
if (!suffixSetting.isEmpty()) {
|
|
|
|
QString librarySuffix = project->first("QMAKE_XCODE_LIBRARY_SUFFIX").toQString();
|
|
|
|
suffixSetting = "$(" + suffixSetting + ")";
|
|
|
|
if (!librarySuffix.isEmpty()) {
|
|
|
|
int pos = library.lastIndexOf(librarySuffix + '.');
|
|
|
|
if (pos == -1) {
|
|
|
|
warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.",
|
|
|
|
qPrintable(librarySuffix), qPrintable(library));
|
|
|
|
} else {
|
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-30 12:09:04 +00:00
|
|
|
library.replace(pos, librarySuffix.size(), suffixSetting);
|
2019-08-26 13:21:03 +00:00
|
|
|
if (name.endsWith(librarySuffix))
|
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-30 12:09:04 +00:00
|
|
|
name.chop(librarySuffix.size());
|
2019-08-26 13:21:03 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
int pos = library.lastIndexOf(name);
|
|
|
|
if (pos != -1)
|
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-30 12:09:04 +00:00
|
|
|
library.insert(pos + name.size(), suffixSetting);
|
2019-08-26 13:21:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
bool
|
|
|
|
ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList tmp;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
//HEADER
|
|
|
|
const int pbVersion = pbuilderVersion();
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList buildConfigGroups;
|
2013-07-15 16:15:40 +00:00
|
|
|
buildConfigGroups << "PROJECT" << "TARGET";
|
2012-01-26 21:36:42 +00:00
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "// !$*UTF8*$!\n"
|
|
|
|
<< "{\n"
|
|
|
|
<< "\t" << writeSettings("archiveVersion", "1", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\tclasses = {\n\t};\n"
|
|
|
|
<< "\t" << writeSettings("objectVersion", QString::number(pbVersion), SettingsNoQuote) << ";\n"
|
|
|
|
<< "\tobjects = {\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
//MAKE QMAKE equivelant
|
2012-08-28 08:12:36 +00:00
|
|
|
if (!project->isActiveConfig("no_autoqmake")) {
|
2011-04-27 10:05:43 +00:00
|
|
|
QString mkfile = pbx_dir + Option::dir_sep + "qt_makeqmake.mak";
|
|
|
|
QFile mkf(mkfile);
|
|
|
|
if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
|
|
writingUnixMakefileGenerator = true;
|
|
|
|
debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData());
|
|
|
|
QTextStream mkt(&mkf);
|
|
|
|
writeHeader(mkt);
|
2019-04-30 10:51:36 +00:00
|
|
|
mkt << "QMAKE = " << var("QMAKE_QMAKE") << Qt::endl;
|
2018-07-16 12:10:50 +00:00
|
|
|
project->values("QMAKE_MAKE_QMAKE_EXTRA_COMMANDS")
|
|
|
|
<< "@echo 'warning: Xcode project has been regenerated, custom settings have been lost. " \
|
|
|
|
"Use CONFIG+=no_autoqmake to prevent this behavior in the future, " \
|
|
|
|
"at the cost of requiring manual project change tracking.'";
|
2011-04-27 10:05:43 +00:00
|
|
|
writeMakeQmake(mkt);
|
|
|
|
mkt.flush();
|
|
|
|
mkf.close();
|
|
|
|
writingUnixMakefileGenerator = false;
|
|
|
|
}
|
|
|
|
QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE");
|
2015-04-13 19:02:29 +00:00
|
|
|
mkfile = fileFixify(mkfile);
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << phase_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Qt Qmake") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";\n"
|
2015-04-13 19:02:29 +00:00
|
|
|
<< "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(Option::output_dir)
|
|
|
|
+ " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";\n"
|
2015-03-02 17:22:49 +00:00
|
|
|
<< "\t\t\t" << writeSettings("showEnvVarsInLog", "0") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2012-12-11 15:46:55 +00:00
|
|
|
// FIXME: Move all file resolving logic out of ProjectBuilderSources::files(), as it
|
|
|
|
// doesn't have access to any of the information it needs to resolve relative paths.
|
2015-04-13 19:02:29 +00:00
|
|
|
project->values("QMAKE_INTERNAL_INCLUDED_FILES").prepend(project->projectFile());
|
2012-12-11 15:46:55 +00:00
|
|
|
|
2014-07-24 11:23:48 +00:00
|
|
|
// Since we can't fileFixify inside ProjectBuilderSources::files(), we resolve the absolute paths here
|
2015-04-13 19:02:29 +00:00
|
|
|
project->values("QMAKE_INTERNAL_INCLUDED_FILES") = ProStringList(
|
|
|
|
fileFixify(project->values("QMAKE_INTERNAL_INCLUDED_FILES").toQStringList(),
|
2015-04-13 19:18:36 +00:00
|
|
|
FileFixifyFromOutdir | FileFixifyAbsolute));
|
2014-07-24 11:23:48 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
//DUMP SOURCES
|
2017-06-19 21:27:11 +00:00
|
|
|
QSet<QString> processedSources;
|
2012-09-06 10:21:38 +00:00
|
|
|
QMap<QString, ProStringList> groups;
|
2011-04-27 10:05:43 +00:00
|
|
|
QList<ProjectBuilderSources> sources;
|
|
|
|
sources.append(ProjectBuilderSources("SOURCES", true));
|
|
|
|
sources.append(ProjectBuilderSources("GENERATED_SOURCES", true));
|
|
|
|
sources.append(ProjectBuilderSources("GENERATED_FILES"));
|
|
|
|
sources.append(ProjectBuilderSources("HEADERS"));
|
|
|
|
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
|
|
|
|
for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
|
|
|
|
if (project->isEmpty(ProKey(*it + ".output")))
|
2011-04-27 10:05:43 +00:00
|
|
|
continue;
|
2012-12-22 18:57:10 +00:00
|
|
|
ProStringList &inputs = project->values(ProKey(*it + ".input"));
|
|
|
|
int input = 0;
|
|
|
|
while (input < inputs.size()) {
|
|
|
|
if (project->isEmpty(inputs.at(input).toKey())) {
|
|
|
|
++input;
|
2011-04-27 10:05:43 +00:00
|
|
|
continue;
|
2012-12-22 18:57:10 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
bool duplicate = false;
|
2012-09-24 10:04:21 +00:00
|
|
|
bool isObj = project->values(ProKey(*it + ".CONFIG")).indexOf("no_link") == -1;
|
|
|
|
if (!isObj) {
|
|
|
|
for (int i = 0; i < sources.size(); ++i) {
|
2020-04-03 09:49:27 +00:00
|
|
|
if (sources.at(i).keyName() == inputs.at(input).toQStringView()) {
|
2012-09-24 10:04:21 +00:00
|
|
|
duplicate = true;
|
|
|
|
break;
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-24 10:04:21 +00:00
|
|
|
if (!duplicate) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &outputs = project->values(ProKey(*it + ".variable_out"));
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int output = 0; output < outputs.size(); ++output) {
|
|
|
|
if(outputs.at(output) != "OBJECT") {
|
|
|
|
isObj = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-09-06 10:21:38 +00:00
|
|
|
sources.append(ProjectBuilderSources(inputs.at(input).toQString(), true,
|
2014-06-26 14:29:23 +00:00
|
|
|
(*it).toQString(), isObj));
|
2012-12-22 18:57:10 +00:00
|
|
|
|
|
|
|
if (isObj) {
|
|
|
|
inputs.removeAt(input);
|
|
|
|
continue;
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2012-12-22 18:57:10 +00:00
|
|
|
|
|
|
|
++input;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-06-19 21:27:11 +00:00
|
|
|
sources.append(ProjectBuilderSources("QMAKE_INTERNAL_INCLUDED_FILES"));
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int source = 0; source < sources.size(); ++source) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &src_list = project->values(ProKey("QMAKE_PBX_" + sources.at(source).keyName()));
|
|
|
|
ProStringList &root_group_list = project->values("QMAKE_PBX_GROUPS");
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2015-04-13 19:02:29 +00:00
|
|
|
const QStringList &files = fileFixify(sources.at(source).files(project),
|
2015-04-13 19:18:36 +00:00
|
|
|
FileFixifyFromOutdir | FileFixifyAbsolute);
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int f = 0; f < files.size(); ++f) {
|
2011-04-27 10:05:43 +00:00
|
|
|
QString file = files[f];
|
|
|
|
if(!sources.at(source).compilerName().isNull() &&
|
|
|
|
!verifyExtraCompiler(sources.at(source).compilerName(), file))
|
|
|
|
continue;
|
|
|
|
if(file.endsWith(Option::prl_ext))
|
|
|
|
continue;
|
2017-06-19 21:27:11 +00:00
|
|
|
if (processedSources.contains(file))
|
|
|
|
continue;
|
|
|
|
processedSources.insert(file);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
bool in_root = true;
|
2013-11-26 16:05:00 +00:00
|
|
|
QString src_key = keyFor(file);
|
|
|
|
|
|
|
|
QString name = file.split(Option::dir_sep).back();
|
|
|
|
|
|
|
|
if (!project->isActiveConfig("flat")) {
|
|
|
|
// Build group hierarchy for file references that match the source our build dir
|
2015-04-13 19:18:36 +00:00
|
|
|
QString relativePath = fileFixify(file, FileFixifyToIndir | FileFixifyRelative);
|
2013-11-26 16:05:00 +00:00
|
|
|
if (QDir::isRelativePath(relativePath) && relativePath.startsWith(QLatin1String("../")))
|
|
|
|
relativePath = fileFixify(file, FileFixifyRelative); // Try build dir
|
|
|
|
|
|
|
|
if (QDir::isRelativePath(relativePath)
|
|
|
|
&& !relativePath.startsWith(QLatin1String("../"))
|
|
|
|
&& relativePath.indexOf(Option::dir_sep) != -1) {
|
2011-04-27 10:05:43 +00:00
|
|
|
QString last_grp("QMAKE_PBX_" + sources.at(source).groupName() + "_HEIR_GROUP");
|
2013-11-26 16:05:00 +00:00
|
|
|
QStringList dirs = relativePath.split(Option::dir_sep);
|
2011-04-27 10:05:43 +00:00
|
|
|
name = dirs.back();
|
|
|
|
dirs.pop_back(); //remove the file portion as it will be added via src_key
|
|
|
|
for(QStringList::Iterator dir_it = dirs.begin(); dir_it != dirs.end(); ++dir_it) {
|
|
|
|
QString new_grp(last_grp + Option::dir_sep + (*dir_it)), new_grp_key(keyFor(new_grp));
|
|
|
|
if(dir_it == dirs.begin()) {
|
|
|
|
if(!src_list.contains(new_grp_key))
|
|
|
|
src_list.append(new_grp_key);
|
|
|
|
} else {
|
|
|
|
if(!groups[last_grp].contains(new_grp_key))
|
|
|
|
groups[last_grp] += new_grp_key;
|
|
|
|
}
|
|
|
|
last_grp = new_grp;
|
|
|
|
}
|
2012-11-12 14:48:36 +00:00
|
|
|
if (groups[last_grp].contains(src_key))
|
|
|
|
continue;
|
2011-04-27 10:05:43 +00:00
|
|
|
groups[last_grp] += src_key;
|
|
|
|
in_root = false;
|
|
|
|
}
|
|
|
|
}
|
2012-11-12 14:48:36 +00:00
|
|
|
if (in_root) {
|
|
|
|
if (src_list.contains(src_key))
|
|
|
|
continue;
|
2011-04-27 10:05:43 +00:00
|
|
|
src_list.append(src_key);
|
2012-11-12 14:48:36 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
//source reference
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << src_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("path", file) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
if (name != file)
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t" << writeSettings("name", name) << ";\n";
|
2013-11-26 16:05:00 +00:00
|
|
|
t << "\t\t\t" << writeSettings("sourceTree", "<absolute>") << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
QString filetype = xcodeFiletypeForFilename(file);
|
2012-06-01 23:49:18 +00:00
|
|
|
if (!filetype.isNull())
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("lastKnownFileType", filetype) << ";\n";
|
|
|
|
t << "\t\t};\n";
|
2014-05-21 12:23:31 +00:00
|
|
|
if (sources.at(source).isBuildable()) { //build reference
|
2011-04-27 10:05:43 +00:00
|
|
|
QString build_key = keyFor(file + ".BUILDABLE");
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << build_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("fileRef", src_key) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\tsettings = {\n"
|
|
|
|
<< "\t\t\t\t" << writeSettings("ATTRIBUTES", ProStringList(), SettingsAsList, 5) << ";\n"
|
|
|
|
<< "\t\t\t};\n"
|
|
|
|
<< "\t\t};\n";
|
2014-05-21 12:23:31 +00:00
|
|
|
if (sources.at(source).isObjectOutput(file))
|
|
|
|
project->values("QMAKE_PBX_OBJ").append(build_key);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!src_list.isEmpty()) {
|
|
|
|
QString group_key = keyFor(sources.at(source).groupName());
|
|
|
|
if(root_group_list.indexOf(group_key) == -1)
|
|
|
|
root_group_list += group_key;
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &group = groups[sources.at(source).groupName()];
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int src = 0; src < src_list.size(); ++src) {
|
|
|
|
if(group.indexOf(src_list.at(src)) == -1)
|
|
|
|
group += src_list.at(src);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-09-06 10:21:38 +00:00
|
|
|
for (QMap<QString, ProStringList>::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor(grp_it.key()) << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("children", grp_it.value(), SettingsAsList, 4) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", grp_it.key().section(Option::dir_sep, -1)) << ";\n"
|
2016-04-19 22:52:42 +00:00
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//PREPROCESS BUILDPHASE (just a makefile)
|
|
|
|
{
|
|
|
|
QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak";
|
|
|
|
QFile mkf(mkfile);
|
2018-10-02 14:40:29 +00:00
|
|
|
ProStringList outputPaths;
|
2021-04-11 14:11:01 +00:00
|
|
|
ProStringList inputPaths;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
|
|
writingUnixMakefileGenerator = true;
|
|
|
|
debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData());
|
|
|
|
QTextStream mkt(&mkf);
|
|
|
|
writeHeader(mkt);
|
2019-04-30 10:51:36 +00:00
|
|
|
mkt << "MOC = " << var("QMAKE_MOC") << Qt::endl;
|
|
|
|
mkt << "UIC = " << var("QMAKE_UIC") << Qt::endl;
|
|
|
|
mkt << "LEX = " << var("QMAKE_LEX") << Qt::endl;
|
|
|
|
mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << Qt::endl;
|
|
|
|
mkt << "YACC = " << var("QMAKE_YACC") << Qt::endl;
|
|
|
|
mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
mkt << "DEFINES = "
|
|
|
|
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
|
2019-04-30 10:51:36 +00:00
|
|
|
<< varGlue("DEFINES","-D"," -D","") << Qt::endl;
|
2015-01-09 12:42:57 +00:00
|
|
|
mkt << "INCPATH =";
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &incs = project->values("INCLUDEPATH");
|
|
|
|
for (ProStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit)
|
2013-07-04 09:25:16 +00:00
|
|
|
mkt << " -I" << escapeFilePath((*incit));
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS"))
|
|
|
|
mkt << " " << var("QMAKE_FRAMEWORKPATH_FLAGS");
|
2019-04-30 10:51:36 +00:00
|
|
|
mkt << Qt::endl;
|
|
|
|
mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << Qt::endl;
|
|
|
|
mkt << "MOVE = " << var("QMAKE_MOVE") << Qt::endl << Qt::endl;
|
2014-11-13 14:54:50 +00:00
|
|
|
mkt << "preprocess: compilers\n";
|
|
|
|
mkt << "clean preprocess_clean: compiler_clean\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
writeExtraTargets(mkt);
|
|
|
|
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
|
|
|
|
mkt << "compilers:";
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &compilers = project->values("QMAKE_EXTRA_COMPILERS");
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int compiler = 0; compiler < compilers.size(); ++compiler) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &tmp_out = project->values(ProKey(compilers.at(compiler) + ".output"));
|
|
|
|
if (tmp_out.isEmpty())
|
2011-04-27 10:05:43 +00:00
|
|
|
continue;
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &inputs = project->values(ProKey(compilers.at(compiler) + ".input"));
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int input = 0; input < inputs.size(); ++input) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &files = project->values(inputs.at(input).toKey());
|
|
|
|
if (files.isEmpty())
|
2011-04-27 10:05:43 +00:00
|
|
|
continue;
|
|
|
|
for(int file = 0, added = 0; file < files.size(); ++file) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString fn = files.at(file).toQString();
|
|
|
|
if (!verifyExtraCompiler(compilers.at(compiler), fn))
|
2011-04-27 10:05:43 +00:00
|
|
|
continue;
|
|
|
|
if(added && !(added % 3))
|
|
|
|
mkt << "\\\n\t";
|
|
|
|
++added;
|
2015-04-13 19:18:36 +00:00
|
|
|
const QString file_name = fileFixify(fn, FileFixifyFromOutdir);
|
2018-03-09 13:25:54 +00:00
|
|
|
const QString tmpOut = fileFixify(tmp_out.first().toQString(), FileFixifyFromOutdir);
|
2018-10-02 14:40:29 +00:00
|
|
|
QString path = escapeDependencyPath(Option::fixPathToTargetOS(
|
2018-03-09 13:25:54 +00:00
|
|
|
replaceExtraCompilerVariables(tmpOut, file_name, QString(), NoShell)));
|
2018-10-02 14:40:29 +00:00
|
|
|
mkt << ' ' << path;
|
2021-04-11 14:11:01 +00:00
|
|
|
inputPaths << fn;
|
2018-10-02 14:40:29 +00:00
|
|
|
outputPaths << path;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-30 10:51:36 +00:00
|
|
|
mkt << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
writeExtraCompilerTargets(mkt);
|
|
|
|
writingUnixMakefileGenerator = false;
|
|
|
|
}
|
|
|
|
mkt.flush();
|
|
|
|
mkf.close();
|
|
|
|
}
|
2018-10-02 14:40:29 +00:00
|
|
|
// Remove duplicates from build steps with "combine"
|
|
|
|
outputPaths.removeDuplicates();
|
2021-04-11 14:11:01 +00:00
|
|
|
|
|
|
|
// Don't create cycles. We only have one qt_preprocess.mak which runs different compilers
|
|
|
|
// whose inputs may depend on the output of another. The "compilers" step will run all
|
|
|
|
// compilers anyway
|
|
|
|
inputPaths.removeEach(outputPaths);
|
|
|
|
|
2015-04-13 19:02:29 +00:00
|
|
|
mkfile = fileFixify(mkfile);
|
2011-04-27 10:05:43 +00:00
|
|
|
QString phase_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET");
|
|
|
|
// project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
|
|
|
|
project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << phase_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Qt Preprocessors") << ";\n"
|
2021-04-11 14:11:01 +00:00
|
|
|
<< "\t\t\t" << writeSettings("inputPaths", inputPaths, SettingsAsList, 4) << ";\n"
|
2018-10-02 14:40:29 +00:00
|
|
|
<< "\t\t\t" << writeSettings("outputPaths", outputPaths, SettingsAsList, 4) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";\n"
|
2015-04-13 19:02:29 +00:00
|
|
|
<< "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(Option::output_dir)
|
|
|
|
+ " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";\n"
|
2015-03-02 17:22:49 +00:00
|
|
|
<< "\t\t\t" << writeSettings("showEnvVarsInLog", "0") << ";\n"
|
2021-12-08 19:53:37 +00:00
|
|
|
<< "\t\t\t" << writeSettings("alwaysOutOfDate", "1") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//SOURCE BUILDPHASE
|
|
|
|
if(!project->isEmpty("QMAKE_PBX_OBJ")) {
|
2012-11-12 12:50:40 +00:00
|
|
|
QString grp = "Compile Sources", key = keyFor(grp);
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", fixListForOutput("QMAKE_PBX_OBJ"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXSourcesBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", grp) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES
|
2019-08-26 11:48:03 +00:00
|
|
|
const ProStringList defaultLibDirs = project->values("QMAKE_DEFAULT_LIBDIRS");
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"),
|
2011-04-27 10:05:43 +00:00
|
|
|
&frameworkdirs = project->values("QMAKE_FRAMEWORKPATH");
|
2018-10-08 16:24:14 +00:00
|
|
|
static const char * const libs[] = { "LIBS", "LIBS_PRIVATE",
|
|
|
|
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
2012-08-20 11:04:39 +00:00
|
|
|
for (int i = 0; libs[i]; i++) {
|
2011-04-27 10:05:43 +00:00
|
|
|
tmp = project->values(libs[i]);
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int x = 0; x < tmp.size();) {
|
2019-08-26 13:21:03 +00:00
|
|
|
bool libSuffixReplaced = false;
|
2011-04-27 10:05:43 +00:00
|
|
|
bool remove = false;
|
2012-09-06 10:21:38 +00:00
|
|
|
QString library, name;
|
2015-05-22 10:07:49 +00:00
|
|
|
ProString opt = tmp[x];
|
2011-04-27 10:05:43 +00:00
|
|
|
if(opt.startsWith("-L")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString r = opt.mid(2).toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
fixForOutput(r);
|
|
|
|
libdirs.append(r);
|
|
|
|
} else if(opt.startsWith("-l")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
name = opt.mid(2).toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
QString lib("lib" + name);
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) {
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isActiveConfig("link_prl")) {
|
2019-08-26 13:21:03 +00:00
|
|
|
const QString prlFilePath = QMakeMetaInfo::checkLib(
|
|
|
|
Option::normalizePath((*lit) + Option::dir_sep + lib
|
|
|
|
+ Option::prl_ext));
|
|
|
|
if (replaceLibrarySuffix(prlFilePath, opt, name, library))
|
|
|
|
remove = true;
|
|
|
|
libSuffixReplaced = true;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(!remove) {
|
|
|
|
QString extns[] = { ".dylib", ".so", ".a", QString() };
|
|
|
|
for(int n = 0; !remove && !extns[n].isNull(); n++) {
|
|
|
|
QString tmp = (*lit) + Option::dir_sep + lib + extns[n];
|
|
|
|
if(exists(tmp)) {
|
|
|
|
library = tmp;
|
|
|
|
debug_msg(1, "pbuilder: Found library (%s) via %s",
|
|
|
|
opt.toLatin1().constData(), library.toLatin1().constData());
|
|
|
|
remove = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if(opt.startsWith("-F")) {
|
|
|
|
QString r;
|
|
|
|
if(opt.size() > 2) {
|
2012-09-06 10:21:38 +00:00
|
|
|
r = opt.mid(2).toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
if(x == tmp.size()-1)
|
2011-04-27 10:05:43 +00:00
|
|
|
break;
|
2012-09-06 10:21:38 +00:00
|
|
|
r = tmp[++x].toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(!r.isEmpty()) {
|
|
|
|
fixForOutput(r);
|
|
|
|
frameworkdirs.append(r);
|
|
|
|
}
|
|
|
|
} else if(opt == "-framework") {
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
if(x == tmp.size()-1)
|
2011-04-27 10:05:43 +00:00
|
|
|
break;
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProString &framework = tmp[x+1];
|
|
|
|
ProStringList fdirs = frameworkdirs;
|
2011-04-27 10:05:43 +00:00
|
|
|
fdirs << "/System/Library/Frameworks/" << "/Library/Frameworks/";
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int fdir = 0; fdir < fdirs.size(); fdir++) {
|
2011-04-27 10:05:43 +00:00
|
|
|
if(exists(fdirs[fdir] + QDir::separator() + framework + ".framework")) {
|
|
|
|
remove = true;
|
|
|
|
library = fdirs[fdir] + Option::dir_sep + framework + ".framework";
|
2012-09-24 10:04:21 +00:00
|
|
|
tmp.removeAt(x);
|
2011-04-27 10:05:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-08-20 12:33:08 +00:00
|
|
|
} else if (!opt.startsWith('-')) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString fn = opt.toQString();
|
|
|
|
if (exists(fn)) {
|
2011-04-27 10:05:43 +00:00
|
|
|
remove = true;
|
2012-09-06 10:21:38 +00:00
|
|
|
library = fn;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!library.isEmpty()) {
|
2019-08-26 13:21:03 +00:00
|
|
|
if (!libSuffixReplaced) {
|
|
|
|
const QFileInfo fi = fileInfo(library);
|
|
|
|
const QString prlFilePath = QMakeMetaInfo::checkLib(
|
|
|
|
Option::normalizePath(fi.absolutePath() + '/' + fi.completeBaseName()
|
|
|
|
+ Option::prl_ext));
|
|
|
|
if (!prlFilePath.isEmpty()) {
|
|
|
|
name = fi.completeBaseName().mid(3);
|
|
|
|
replaceLibrarySuffix(prlFilePath, opt, name, library);
|
|
|
|
}
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
const int slsh = library.lastIndexOf(Option::dir_sep);
|
|
|
|
if(name.isEmpty()) {
|
|
|
|
if(slsh != -1)
|
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-30 12:09:04 +00:00
|
|
|
name = library.right(library.size() - slsh - 1);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(slsh != -1) {
|
|
|
|
const QString path = QFileInfo(library.left(slsh)).absoluteFilePath();
|
2019-08-26 11:48:03 +00:00
|
|
|
if (!path.isEmpty() && !libdirs.contains(path)
|
|
|
|
&& !defaultLibDirs.contains(path)) {
|
2011-04-27 10:05:43 +00:00
|
|
|
libdirs += path;
|
2019-08-26 11:48:03 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2015-06-01 15:46:58 +00:00
|
|
|
library = fileFixify(library, FileFixifyFromOutdir | FileFixifyAbsolute);
|
2011-04-27 10:05:43 +00:00
|
|
|
QString key = keyFor(library);
|
2013-02-26 12:12:25 +00:00
|
|
|
if (!project->values("QMAKE_PBX_LIBRARIES").contains(key)) {
|
2013-03-05 12:42:11 +00:00
|
|
|
bool is_frmwrk = (library.endsWith(".framework"));
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", name) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("path", library) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(library)), SettingsNoQuote) << ";\n"
|
2013-11-26 16:05:00 +00:00
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<absolute>") << ";\n";
|
2013-03-05 12:42:11 +00:00
|
|
|
if (is_frmwrk)
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("lastKnownFileType", "wrapper.framework") << ";\n";
|
|
|
|
t << "\t\t};\n";
|
2013-02-26 12:12:25 +00:00
|
|
|
project->values("QMAKE_PBX_LIBRARIES").append(key);
|
|
|
|
QString build_key = keyFor(library + ".BUILDABLE");
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << build_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("fileRef", key) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\tsettings = {\n"
|
|
|
|
<< "\t\t\t};\n"
|
|
|
|
<< "\t\t};\n";
|
2013-02-26 12:12:25 +00:00
|
|
|
project->values("QMAKE_PBX_BUILD_LIBRARIES").append(build_key);
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(remove)
|
|
|
|
tmp.removeAt(x);
|
|
|
|
else
|
|
|
|
x++;
|
|
|
|
}
|
|
|
|
project->values(libs[i]) = tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//SUBLIBS BUILDPHASE (just another makefile)
|
|
|
|
if(!project->isEmpty("SUBLIBS")) {
|
|
|
|
QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak";
|
|
|
|
QFile mkf(mkfile);
|
|
|
|
if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
|
|
writingUnixMakefileGenerator = true;
|
|
|
|
debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData());
|
|
|
|
QTextStream mkt(&mkf);
|
|
|
|
writeHeader(mkt);
|
|
|
|
mkt << "SUBLIBS= ";
|
2015-02-06 14:30:02 +00:00
|
|
|
// ### This is missing the parametrization found in unixmake2.cpp
|
2011-04-27 10:05:43 +00:00
|
|
|
tmp = project->values("SUBLIBS");
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int i = 0; i < tmp.size(); i++)
|
2015-02-06 14:30:02 +00:00
|
|
|
t << escapeFilePath("tmp/lib" + tmp[i] + ".a") << ' ';
|
2019-04-30 10:51:36 +00:00
|
|
|
t << Qt::endl << Qt::endl;
|
2013-07-04 09:25:16 +00:00
|
|
|
mkt << "sublibs: $(SUBLIBS)\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
tmp = project->values("SUBLIBS");
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int i = 0; i < tmp.size(); i++)
|
2015-02-06 14:30:02 +00:00
|
|
|
t << escapeFilePath("tmp/lib" + tmp[i] + ".a") + ":\n\t"
|
2019-04-30 10:51:36 +00:00
|
|
|
<< var(ProKey("MAKELIB" + tmp[i])) << Qt::endl << Qt::endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
mkt.flush();
|
|
|
|
mkf.close();
|
|
|
|
writingUnixMakefileGenerator = false;
|
|
|
|
}
|
|
|
|
QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE");
|
2015-04-13 19:02:29 +00:00
|
|
|
mkfile = fileFixify(mkfile);
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << phase_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Qt Sublibs") << ";\n"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< "\t\t\t" << writeSettings("shellPath", "/bin/sh") << "\n"
|
2015-04-13 19:02:29 +00:00
|
|
|
<< "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(Option::output_dir)
|
|
|
|
+ " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";\n"
|
2015-03-09 16:46:59 +00:00
|
|
|
<< "\t\t\t" << writeSettings("showEnvVarsInLog", "0") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-10-16 15:40:01 +00:00
|
|
|
|
|
|
|
if (!project->isEmpty("QMAKE_PRE_LINK")) {
|
|
|
|
QString phase_key = keyFor("QMAKE_PBX_PRELINK_BUILDPHASE");
|
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
|
2014-11-06 15:11:01 +00:00
|
|
|
|
|
|
|
ProStringList inputPaths;
|
|
|
|
ProStringList outputPaths;
|
|
|
|
const ProStringList &archs = project->values("QMAKE_XCODE_ARCHS");
|
|
|
|
if (!archs.isEmpty()) {
|
2016-02-01 08:49:22 +00:00
|
|
|
const int size = archs.size();
|
|
|
|
inputPaths.reserve(size);
|
|
|
|
outputPaths.reserve(size);
|
|
|
|
for (int i = 0; i < size; ++i) {
|
2014-11-06 15:11:01 +00:00
|
|
|
const ProString &arch = archs.at(i);
|
|
|
|
inputPaths << "$(OBJECT_FILE_DIR_$(CURRENT_VARIANT))/" + arch + "/";
|
|
|
|
outputPaths << "$(LINK_FILE_LIST_$(CURRENT_VARIANT)_" + arch + ")";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
inputPaths << "$(OBJECT_FILE_DIR_$(CURRENT_VARIANT))/$(CURRENT_ARCH)/";
|
|
|
|
outputPaths << "$(LINK_FILE_LIST_$(CURRENT_VARIANT)_$(CURRENT_ARCH))";
|
|
|
|
}
|
|
|
|
|
2013-10-16 15:40:01 +00:00
|
|
|
t << "\t\t" << phase_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
// The build phases are not executed in the order they are defined, but by their
|
|
|
|
// resolved dependenices, so we have to ensure that this phase is run after the
|
2014-07-22 13:35:12 +00:00
|
|
|
// compilation phase, and before the link phase. Making the phase depend on the
|
|
|
|
// object file directory, and "write" to the list of files to link achieves that.
|
2014-11-06 15:11:01 +00:00
|
|
|
<< "\t\t\t" << writeSettings("inputPaths", inputPaths, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("outputPaths", outputPaths, SettingsAsList, 4) << ";\n"
|
2013-10-16 15:40:01 +00:00
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Qt Prelink") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("shellScript", project->values("QMAKE_PRE_LINK")) << ";\n"
|
2015-03-09 16:46:59 +00:00
|
|
|
<< "\t\t\t" << writeSettings("showEnvVarsInLog", "0") << ";\n"
|
2013-10-16 15:40:01 +00:00
|
|
|
<< "\t\t};\n";
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
//LIBRARY BUILDPHASE
|
|
|
|
if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) {
|
|
|
|
tmp = project->values("QMAKE_PBX_LIBRARIES");
|
|
|
|
if(!tmp.isEmpty()) {
|
2012-11-12 12:50:40 +00:00
|
|
|
QString grp("Frameworks"), key = keyFor(grp);
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_PBX_GROUPS").append(key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_LIBRARIES"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", grp) << ";\n"
|
2016-04-19 22:52:42 +00:00
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
2012-11-12 12:50:40 +00:00
|
|
|
QString grp("Link Binary With Libraries"), key = keyFor(grp);
|
2011-04-27 10:05:43 +00:00
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", project->values("QMAKE_PBX_BUILD_LIBRARIES"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXFrameworksBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", grp) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-10-16 15:40:01 +00:00
|
|
|
|
|
|
|
if (!project->isEmpty("QMAKE_POST_LINK")) {
|
|
|
|
QString phase_key = keyFor("QMAKE_PBX_POSTLINK_BUILDPHASE");
|
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
|
|
|
|
t << "\t\t" << phase_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
// The build phases are not executed in the order they are defined, but by their
|
|
|
|
// resolved dependenices, so we have to ensure the phase is run after linking.
|
|
|
|
<< "\t\t\t" << writeSettings("inputPaths", ProStringList("$(TARGET_BUILD_DIR)/$(EXECUTABLE_PATH)"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Qt Postlink") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("shellScript", project->values("QMAKE_POST_LINK")) << ";\n"
|
2015-03-02 17:22:49 +00:00
|
|
|
<< "\t\t\t" << writeSettings("showEnvVarsInLog", "0") << ";\n"
|
2013-10-16 15:40:01 +00:00
|
|
|
<< "\t\t};\n";
|
|
|
|
}
|
|
|
|
|
2012-01-26 21:36:42 +00:00
|
|
|
if (!project->isEmpty("DESTDIR")) {
|
2011-04-27 10:05:43 +00:00
|
|
|
QString phase_key = keyFor("QMAKE_PBX_TARGET_COPY_PHASE");
|
2015-04-13 19:02:29 +00:00
|
|
|
QString destDir = fileFixify(project->first("DESTDIR").toQString(),
|
2015-04-13 19:18:36 +00:00
|
|
|
FileFixifyFromOutdir | FileFixifyAbsolute);
|
2012-01-26 21:36:42 +00:00
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "\t\t" << phase_key << " = {\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Project Copy") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("inputPaths", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("outputPaths", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("shellScript", fixForOutput("cp -r $BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME " + IoUtils::shellQuoteUnix(destDir))) << ";\n"
|
2015-03-02 17:22:49 +00:00
|
|
|
<< "\t\t\t" << writeSettings("showEnvVarsInLog", "0") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2014-10-22 15:37:02 +00:00
|
|
|
bool copyBundleResources = project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app";
|
|
|
|
ProStringList bundle_resources_files;
|
2016-05-28 09:13:57 +00:00
|
|
|
ProStringList embedded_frameworks;
|
|
|
|
QMap<ProString, ProStringList> embedded_plugins;
|
2013-12-02 12:58:00 +00:00
|
|
|
// Copy Bundle Data
|
2013-01-07 15:05:21 +00:00
|
|
|
if (!project->isEmpty("QMAKE_BUNDLE_DATA")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList bundle_file_refs;
|
2016-02-16 14:29:59 +00:00
|
|
|
bool osx = project->isActiveConfig("osx");
|
2013-01-07 15:05:21 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
//all bundle data
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int i = 0; i < bundle_data.size(); i++) {
|
2013-01-07 15:05:21 +00:00
|
|
|
ProStringList bundle_files;
|
|
|
|
ProString path = project->first(ProKey(bundle_data[i] + ".path"));
|
2016-05-28 09:13:57 +00:00
|
|
|
const bool isEmbeddedFramework = ((!osx && path == QLatin1String("Frameworks"))
|
|
|
|
|| (osx && path == QLatin1String("Contents/Frameworks")));
|
|
|
|
const ProString pluginsPrefix = ProString(osx ? QLatin1String("Contents/PlugIns") : QLatin1String("PlugIns"));
|
|
|
|
const bool isEmbeddedPlugin = (path == pluginsPrefix) || path.startsWith(pluginsPrefix + "/");
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
//all files
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int file = 0; file < files.size(); file++) {
|
2015-04-13 19:02:29 +00:00
|
|
|
QString fn = fileFixify(files[file].toQString(), FileFixifyAbsolute);
|
2013-11-26 16:05:00 +00:00
|
|
|
QString name = fn.split(Option::dir_sep).back();
|
2013-01-07 15:05:21 +00:00
|
|
|
QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE_REF." + bundle_data[i] + "-" + fn);
|
2011-04-27 10:05:43 +00:00
|
|
|
bundle_file_refs += file_ref_key;
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << file_ref_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("path", fn) << ";\n"
|
2013-11-26 16:05:00 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", name) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<absolute>") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2013-01-07 15:05:21 +00:00
|
|
|
QString file_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE." + bundle_data[i] + "-" + fn);
|
|
|
|
bundle_files += file_key;
|
|
|
|
t << "\t\t" << file_key << " = {\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t\t" << writeSettings("fileRef", file_ref_key) << ";\n"
|
2016-05-28 09:13:57 +00:00
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";\n";
|
|
|
|
if (isEmbeddedFramework || isEmbeddedPlugin || name.endsWith(".dylib") || name.endsWith(".framework"))
|
|
|
|
t << "\t\t\t" << writeSettings("settings", "{ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }", SettingsNoQuote) << ";\n";
|
|
|
|
t << "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-01-07 15:05:21 +00:00
|
|
|
|
2016-02-16 14:29:59 +00:00
|
|
|
if (copyBundleResources && ((!osx && path.isEmpty())
|
|
|
|
|| (osx && path == QLatin1String("Contents/Resources")))) {
|
2022-10-06 09:08:21 +00:00
|
|
|
for (const ProString &s : std::as_const(bundle_files))
|
2014-10-22 15:37:02 +00:00
|
|
|
bundle_resources_files << s;
|
2016-05-28 09:13:57 +00:00
|
|
|
} else if (copyBundleResources && isEmbeddedFramework) {
|
2022-10-06 09:08:21 +00:00
|
|
|
for (const ProString &s : std::as_const(bundle_files))
|
2016-05-28 09:13:57 +00:00
|
|
|
embedded_frameworks << s;
|
|
|
|
} else if (copyBundleResources && isEmbeddedPlugin) {
|
2022-10-06 09:08:21 +00:00
|
|
|
for (const ProString &s : std::as_const(bundle_files)) {
|
2016-05-28 09:13:57 +00:00
|
|
|
ProString subpath = (path == pluginsPrefix) ? ProString() : path.mid(pluginsPrefix.size() + 1);
|
|
|
|
embedded_plugins[subpath] << s;
|
|
|
|
}
|
2014-10-22 15:37:02 +00:00
|
|
|
} else {
|
|
|
|
QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]);
|
2016-02-16 06:29:01 +00:00
|
|
|
//if (!project->isActiveConfig("shallow_bundle")
|
|
|
|
// && !project->isEmpty(ProKey(bundle_data[i] + ".version"))) {
|
|
|
|
//}
|
2013-01-07 15:05:21 +00:00
|
|
|
|
2014-10-22 15:37:02 +00:00
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
|
|
|
|
t << "\t\t" << phase_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Copy '" + bundle_data[i] + "' Files to Bundle") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("dstPath", path) << ";\n"
|
2014-10-22 15:37:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", bundle_files, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-01-07 15:05:21 +00:00
|
|
|
|
|
|
|
QString bundle_data_key = keyFor("QMAKE_PBX_BUNDLE_DATA");
|
|
|
|
project->values("QMAKE_PBX_GROUPS").append(bundle_data_key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << bundle_data_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("children", bundle_file_refs, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
|
2013-12-02 12:58:00 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", "Bundle Data") << ";\n"
|
2016-04-19 22:52:42 +00:00
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2013-12-02 12:58:00 +00:00
|
|
|
// Copy bundle resources. Optimizes resources, and puts them into the Resources
|
|
|
|
// subdirectory on OSX, but doesn't support paths.
|
2014-10-22 15:37:02 +00:00
|
|
|
if (copyBundleResources) {
|
2013-12-02 12:58:00 +00:00
|
|
|
if (!project->isEmpty("ICON")) {
|
|
|
|
ProString icon = project->first("ICON");
|
|
|
|
bundle_resources_files += keyFor(icon + ".BUILDABLE");
|
|
|
|
}
|
|
|
|
|
2014-09-19 11:10:33 +00:00
|
|
|
// Always add "Copy Bundle Resources" phase, even when we have no bundle
|
|
|
|
// resources, since Xcode depends on it being there for e.g asset catalogs.
|
|
|
|
QString grp("Copy Bundle Resources"), key = keyFor(grp);
|
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(key);
|
|
|
|
t << "\t\t" << key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", bundle_resources_files, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", grp) << ";\n"
|
2014-09-19 11:10:33 +00:00
|
|
|
<< "\t\t};\n";
|
2016-05-28 09:13:57 +00:00
|
|
|
|
|
|
|
QString grp2("Embed Frameworks"), key2 = keyFor(grp2);
|
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(key2);
|
|
|
|
t << "\t\t" << key2 << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("dstPath", "") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("dstSubfolderSpec", "10", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", embedded_frameworks, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", grp2) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
2017-12-18 11:53:05 +00:00
|
|
|
for (auto it = embedded_plugins.cbegin(), end = embedded_plugins.cend(); it != end; ++it) {
|
2016-05-28 09:13:57 +00:00
|
|
|
QString suffix = !it.key().isEmpty() ? (" (" + it.key() + ")") : QString();
|
|
|
|
QString grp3("Embed PlugIns" + suffix), key3 = keyFor(grp3);
|
|
|
|
project->values("QMAKE_PBX_BUILDPHASES").append(key3);
|
|
|
|
t << "\t\t" << key3 << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("dstPath", it.key()) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("dstSubfolderSpec", "13", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", it.value(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", grp3) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
}
|
2013-12-02 12:58:00 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
//REFERENCE
|
|
|
|
project->values("QMAKE_PBX_PRODUCTS").append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE"));
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("includeInIndex", "0", SettingsNoQuote) << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->first("TEMPLATE") == "app") {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString targ = project->first("QMAKE_ORIG_TARGET");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isActiveConfig("bundle") && !project->isEmpty("QMAKE_BUNDLE_EXTENSION")) {
|
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE_NAME"))
|
|
|
|
targ = project->first("QMAKE_BUNDLE_NAME");
|
|
|
|
targ += project->first("QMAKE_BUNDLE_EXTENSION");
|
|
|
|
if(!project->isEmpty("QMAKE_PBX_BUNDLE_TYPE"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("explicitFileType", project->first("QMAKE_PBX_BUNDLE_TYPE")) + ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else if(project->isActiveConfig("app_bundle")) {
|
|
|
|
if(!project->isEmpty("QMAKE_APPLICATION_BUNDLE_NAME"))
|
|
|
|
targ = project->first("QMAKE_APPLICATION_BUNDLE_NAME");
|
|
|
|
targ += ".app";
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.application") << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("explicitFileType", "compiled.mach-o.executable") << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t" << writeSettings("path", targ) << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString lib = project->first("QMAKE_ORIG_TARGET");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isActiveConfig("staticlib")) {
|
|
|
|
lib = project->first("TARGET");
|
|
|
|
} else if(!project->isActiveConfig("lib_bundle")) {
|
|
|
|
if(project->isActiveConfig("plugin"))
|
|
|
|
lib = project->first("TARGET");
|
|
|
|
else
|
|
|
|
lib = project->first("TARGET_");
|
|
|
|
}
|
|
|
|
int slsh = lib.lastIndexOf(Option::dir_sep);
|
|
|
|
if(slsh != -1)
|
|
|
|
lib = lib.right(lib.length() - slsh - 1);
|
|
|
|
if(project->isActiveConfig("bundle") && !project->isEmpty("QMAKE_BUNDLE_EXTENSION")) {
|
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE_NAME"))
|
|
|
|
lib = project->first("QMAKE_BUNDLE_NAME");
|
|
|
|
lib += project->first("QMAKE_BUNDLE_EXTENSION");
|
|
|
|
if(!project->isEmpty("QMAKE_PBX_BUNDLE_TYPE"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("explicitFileType", project->first("QMAKE_PBX_BUNDLE_TYPE")) << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else if(!project->isActiveConfig("staticlib") && project->isActiveConfig("lib_bundle")) {
|
|
|
|
if(!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
|
|
|
|
lib = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
|
|
|
|
lib += ".framework";
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.framework") << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("explicitFileType", "compiled.mach-o.dylib") << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t" << writeSettings("path", lib) << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
{ //Products group
|
|
|
|
QString grp("Products"), key = keyFor(grp);
|
|
|
|
project->values("QMAKE_PBX_GROUPS").append(key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_PRODUCTS"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Products") << ";\n"
|
2016-04-19 22:52:42 +00:00
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2012-11-13 14:26:17 +00:00
|
|
|
|
|
|
|
//DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER
|
|
|
|
//ROOT_GROUP
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor("QMAKE_PBX_ROOT_GROUP") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_GROUPS"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", project->first("QMAKE_ORIG_TARGET")) << ";\n"
|
2016-04-19 22:52:42 +00:00
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<group>") << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
|
2013-10-24 12:47:26 +00:00
|
|
|
{
|
|
|
|
QString aggregate_target_key = keyFor(pbx_dir + "QMAKE_PBX_AGGREGATE_TARGET");
|
|
|
|
project->values("QMAKE_PBX_TARGETS").append(aggregate_target_key);
|
|
|
|
t << "\t\t" << aggregate_target_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("dependencies", ProStringList(), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST_TARGET"), SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXAggregateTarget", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("productName", "Qt Preprocess") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Qt Preprocess") << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
QString aggregate_target_dep_key = keyFor(pbx_dir + "QMAKE_PBX_AGGREGATE_TARGET_DEP");
|
|
|
|
t << "\t\t" << aggregate_target_dep_key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXTargetDependency", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("target", aggregate_target_key) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
project->values("QMAKE_PBX_TARGET_DEPENDS").append(aggregate_target_dep_key);
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
//TARGET
|
|
|
|
QString target_key = keyFor(pbx_dir + "QMAKE_PBX_TARGET");
|
2013-10-24 12:47:26 +00:00
|
|
|
project->values("QMAKE_PBX_TARGETS").prepend(target_key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << target_key << " = {\n"
|
2013-10-24 12:47:26 +00:00
|
|
|
<< "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_BUILDPHASES"),
|
2013-07-04 09:25:16 +00:00
|
|
|
SettingsAsList, 4) << ";\n";
|
|
|
|
t << "\t\t\t" << writeSettings("dependencies", project->values("QMAKE_PBX_TARGET_DEPENDS"), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("productReference", keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")) << ";\n";
|
|
|
|
t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST_TARGET"), SettingsNoQuote) << ";\n";
|
|
|
|
t << "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";\n";
|
|
|
|
t << "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList) << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->first("TEMPLATE") == "app") {
|
2012-11-13 14:26:17 +00:00
|
|
|
if (!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2012-11-13 14:26:17 +00:00
|
|
|
if (project->isActiveConfig("app_bundle"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.application") << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
else
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.tool") << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t" << writeSettings("name", project->first("QMAKE_ORIG_TARGET")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("productName", project->first("QMAKE_ORIG_TARGET")) << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString lib = project->first("QMAKE_ORIG_TARGET");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isActiveConfig("lib_bundle") && !project->isActiveConfig("staticlib"))
|
|
|
|
lib.prepend("lib");
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t" << writeSettings("name", lib) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("productName", lib) << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
if (!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
else if (project->isActiveConfig("staticlib"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.library.static") << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
else if (project->isActiveConfig("lib_bundle"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.framework") << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
else
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.library.dynamic") << ";\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(!project->isEmpty("DESTDIR"))
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t" << writeSettings("productInstallPath", project->first("DESTDIR")) << ";\n";
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t};\n";
|
2015-02-11 12:59:46 +00:00
|
|
|
|
|
|
|
// Test target for running Qt unit tests under XCTest
|
|
|
|
if (project->isActiveConfig("testcase") && project->isActiveConfig("app_bundle")) {
|
|
|
|
QString devNullFileReferenceKey = keyFor(pbx_dir + "QMAKE_PBX_DEV_NULL_FILE_REFERENCE");
|
|
|
|
t << "\t\t" << devNullFileReferenceKey << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "/dev/null") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("path", "/dev/null") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("lastKnownFileType", "sourcecode.c.c") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "<absolute>") << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
QString devNullBuildFileKey = keyFor(pbx_dir + "QMAKE_PBX_DEV_NULL_BUILD_FILE");
|
|
|
|
t << "\t\t" << devNullBuildFileKey << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("fileRef", devNullFileReferenceKey) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
QString dummySourceBuildPhaseKey = keyFor(pbx_dir + "QMAKE_PBX_DUMMY_SOURCE_BUILD_PHASE");
|
|
|
|
t << "\t\t" << dummySourceBuildPhaseKey << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("files", devNullBuildFileKey, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXSourcesBuildPhase", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
ProStringList testBundleBuildConfigs;
|
|
|
|
|
|
|
|
ProString targetName = project->first("QMAKE_ORIG_TARGET");
|
|
|
|
ProString testHost = "$(BUILT_PRODUCTS_DIR)/" + targetName + ".app/";
|
2016-02-16 14:29:59 +00:00
|
|
|
if (project->isActiveConfig("osx"))
|
2015-02-11 12:59:46 +00:00
|
|
|
testHost.append("Contents/MacOS/");
|
|
|
|
testHost.append(targetName);
|
|
|
|
|
2018-08-02 22:22:24 +00:00
|
|
|
static const char * const configs[] = { "Debug", "Release", nullptr };
|
2015-02-11 12:59:46 +00:00
|
|
|
for (int i = 0; configs[i]; i++) {
|
|
|
|
QString testBundleBuildConfig = keyFor(pbx_dir + "QMAKE_PBX_TEST_BUNDLE_BUILDCONFIG_" + configs[i]);
|
|
|
|
t << "\t\t" << testBundleBuildConfig << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "XCBuildConfiguration", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\tbuildSettings = {\n"
|
|
|
|
<< "\t\t\t\t" << writeSettings("INFOPLIST_FILE", project->first("QMAKE_XCODE_SPECDIR") + "/QtTest.plist") << ";\n"
|
|
|
|
<< "\t\t\t\t" << writeSettings("OTHER_LDFLAGS", "") << ";\n"
|
|
|
|
<< "\t\t\t\t" << writeSettings("TEST_HOST", testHost) << ";\n"
|
|
|
|
<< "\t\t\t\t" << writeSettings("DEBUG_INFORMATION_FORMAT", "dwarf-with-dsym") << ";\n"
|
|
|
|
<< "\t\t\t};\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", configs[i], SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
testBundleBuildConfigs.append(testBundleBuildConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString testBundleBuildConfigurationListKey = keyFor(pbx_dir + "QMAKE_PBX_TEST_BUNDLE_BUILDCONFIG_LIST");
|
|
|
|
t << "\t\t" << testBundleBuildConfigurationListKey << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildConfigurations", testBundleBuildConfigs, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("defaultConfigurationName", "Debug", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
QString primaryTargetDependencyKey = keyFor(pbx_dir + "QMAKE_PBX_PRIMARY_TARGET_DEP");
|
|
|
|
t << "\t\t" << primaryTargetDependencyKey << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXTargetDependency", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("target", keyFor(pbx_dir + "QMAKE_PBX_TARGET")) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
QString testBundleReferenceKey = keyFor("QMAKE_TEST_BUNDLE_REFERENCE");
|
|
|
|
t << "\t\t" << testBundleReferenceKey << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("explicitFileType", "wrapper.cfbundle") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("includeInIndex", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
|
|
|
QString testTargetKey = keyFor(pbx_dir + "QMAKE_PBX_TEST_TARGET");
|
|
|
|
project->values("QMAKE_PBX_TARGETS").append(testTargetKey);
|
|
|
|
t << "\t\t" << testTargetKey << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildPhases", dummySourceBuildPhaseKey, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("dependencies", primaryTargetDependencyKey, SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildConfigurationList", testBundleBuildConfigurationListKey) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("productType", "com.apple.product-type.bundle.unit-test") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("productReference", testBundleReferenceKey) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("name", "Qt Test") << ";\n"
|
|
|
|
<< "\t\t};\n";
|
|
|
|
|
2019-06-09 22:09:10 +00:00
|
|
|
QLatin1String testTargetID("TestTargetID");
|
2015-02-11 12:59:46 +00:00
|
|
|
project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + testTargetKey + "_" + testTargetID)).append(keyFor(pbx_dir + "QMAKE_PBX_TARGET"));
|
|
|
|
project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + testTargetKey)).append(ProKey(testTargetID));
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
//DEBUG/RELEASE
|
2012-11-13 14:26:17 +00:00
|
|
|
QString defaultConfig;
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int as_release = 0; as_release < 2; as_release++)
|
|
|
|
{
|
2013-10-09 13:10:39 +00:00
|
|
|
QString configName = (as_release ? "Release" : "Debug");
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QMap<QString, QString> settings;
|
2016-09-14 18:36:45 +00:00
|
|
|
if (!project->isActiveConfig("no_xcode_development_team")) {
|
2017-03-10 14:39:59 +00:00
|
|
|
QString teamId;
|
|
|
|
if (!project->isEmpty("QMAKE_DEVELOPMENT_TEAM")) {
|
|
|
|
teamId = project->first("QMAKE_DEVELOPMENT_TEAM").toQString();
|
|
|
|
} else {
|
|
|
|
const QList<QVariantMap> teams = provisioningTeams();
|
|
|
|
if (!teams.isEmpty()) // first suitable team we find is the one we'll use by default
|
|
|
|
teamId = teams.first().value(QLatin1String("teamID")).toString();
|
2016-09-14 18:36:45 +00:00
|
|
|
}
|
2017-03-10 14:39:59 +00:00
|
|
|
if (!teamId.isEmpty())
|
|
|
|
settings.insert("DEVELOPMENT_TEAM", teamId);
|
|
|
|
if (!project->isEmpty("QMAKE_PROVISIONING_PROFILE"))
|
|
|
|
settings.insert("PROVISIONING_PROFILE_SPECIFIER", project->first("QMAKE_PROVISIONING_PROFILE").toQString());
|
2016-09-14 18:36:45 +00:00
|
|
|
}
|
2017-03-10 14:39:59 +00:00
|
|
|
|
2017-01-27 19:34:17 +00:00
|
|
|
settings.insert("APPLICATION_EXTENSION_API_ONLY", project->isActiveConfig("app_extension_api_only") ? "YES" : "NO");
|
2016-02-16 14:29:59 +00:00
|
|
|
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
|
|
|
|
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!as_release)
|
|
|
|
settings.insert("GCC_OPTIMIZATION_LEVEL", "0");
|
|
|
|
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
|
2012-09-06 10:21:38 +00:00
|
|
|
settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK").toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &l = project->values("QMAKE_MAC_XCODE_SETTINGS");
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; i < l.size(); ++i) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString name = l.at(i);
|
2013-10-09 13:10:39 +00:00
|
|
|
const ProKey buildKey(name + ".build");
|
|
|
|
if (!project->isEmpty(buildKey)) {
|
2014-11-27 13:49:16 +00:00
|
|
|
const QString build = project->first(buildKey).toQString();
|
2013-10-09 13:10:39 +00:00
|
|
|
if (build.toLower() != configName.toLower())
|
|
|
|
continue;
|
|
|
|
}
|
2012-09-06 10:21:38 +00:00
|
|
|
const QString value = project->values(ProKey(name + ".value")).join(QString(Option::field_sep));
|
|
|
|
const ProKey nkey(name + ".name");
|
|
|
|
if (!project->isEmpty(nkey))
|
2014-11-27 13:49:16 +00:00
|
|
|
name = project->first(nkey);
|
2012-09-06 10:21:38 +00:00
|
|
|
settings.insert(name.toQString(), value);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-01 23:49:18 +00:00
|
|
|
if (project->first("TEMPLATE") == "app") {
|
2012-09-06 10:21:38 +00:00
|
|
|
settings.insert("PRODUCT_NAME", fixForOutput(project->first("QMAKE_ORIG_TARGET").toQString()));
|
2012-06-01 23:49:18 +00:00
|
|
|
} else {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString lib = project->first("QMAKE_ORIG_TARGET");
|
2012-06-01 23:49:18 +00:00
|
|
|
if (!project->isActiveConfig("lib_bundle") && !project->isActiveConfig("staticlib"))
|
|
|
|
lib.prepend("lib");
|
2015-02-06 14:30:02 +00:00
|
|
|
settings.insert("PRODUCT_NAME", lib.toQString());
|
2012-01-26 21:36:42 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-11-13 14:26:17 +00:00
|
|
|
if (project->isActiveConfig("debug") != (bool)as_release)
|
2013-10-09 13:10:39 +00:00
|
|
|
defaultConfig = configName;
|
2012-06-01 23:49:18 +00:00
|
|
|
for (int i = 0; i < buildConfigGroups.size(); i++) {
|
2013-10-09 13:10:39 +00:00
|
|
|
QString key = keyFor("QMAKE_PBX_BUILDCONFIG_" + configName + buildConfigGroups.at(i));
|
2012-09-06 10:21:38 +00:00
|
|
|
project->values(ProKey("QMAKE_PBX_BUILDCONFIGS_" + buildConfigGroups.at(i))).append(key);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << key << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "XCBuildConfiguration", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\tbuildSettings = {\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
for (QMap<QString, QString>::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it)
|
|
|
|
t << "\t\t\t\t" << writeSettings(set_it.key(), set_it.value()) << ";\n";
|
|
|
|
if (buildConfigGroups.at(i) == QLatin1String("PROJECT")) {
|
2012-11-13 14:26:17 +00:00
|
|
|
if (!project->isEmpty("QMAKE_XCODE_GCC_VERSION"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("GCC_VERSION", project->first("QMAKE_XCODE_GCC_VERSION"), SettingsNoQuote) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
ProString program = project->first("QMAKE_CC");
|
|
|
|
if (!program.isEmpty())
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("CC", fixForOutput(findProgram(program))) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
program = project->first("QMAKE_CXX");
|
|
|
|
// Xcode will automatically take care of using CC with the right -x option,
|
|
|
|
// and will actually break if we pass CPLUSPLUS, by adding an additional set of "++"
|
|
|
|
if (!program.isEmpty() && !program.contains("clang++"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("CPLUSPLUS", fixForOutput(findProgram(program))) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
program = project->first("QMAKE_LINK");
|
|
|
|
if (!program.isEmpty())
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("LDPLUSPLUS", fixForOutput(findProgram(program))) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
|
|
|
|
if ((project->first("TEMPLATE") == "app" && project->isActiveConfig("app_bundle")) ||
|
|
|
|
(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") &&
|
|
|
|
project->isActiveConfig("lib_bundle"))) {
|
2015-04-13 19:18:36 +00:00
|
|
|
QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), FileFixifyToIndir);
|
2014-05-15 08:09:50 +00:00
|
|
|
if (!plist.isEmpty()) {
|
|
|
|
if (exists(plist))
|
2015-04-13 19:02:29 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", fileFixify(plist)) << ";\n";
|
2014-05-15 08:09:50 +00:00
|
|
|
else
|
|
|
|
warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData());
|
|
|
|
} else {
|
2015-08-24 10:25:29 +00:00
|
|
|
plist = fileFixify(specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"), FileFixifyBackwards);
|
2012-11-13 14:26:17 +00:00
|
|
|
QFile plist_in_file(plist);
|
|
|
|
if (plist_in_file.open(QIODevice::ReadOnly)) {
|
|
|
|
QTextStream plist_in(&plist_in_file);
|
|
|
|
QString plist_in_text = plist_in.readAll();
|
2016-02-04 14:12:03 +00:00
|
|
|
plist_in_text.replace(QLatin1String("@ICON@"),
|
2012-11-13 14:26:17 +00:00
|
|
|
(project->isEmpty("ICON") ? QString("") : project->first("ICON").toQString().section(Option::dir_sep, -1)));
|
|
|
|
if (project->first("TEMPLATE") == "app") {
|
2016-02-18 09:01:38 +00:00
|
|
|
ProString app_bundle_name = project->first("QMAKE_APPLICATION_BUNDLE_NAME");
|
|
|
|
if (app_bundle_name.isEmpty())
|
|
|
|
app_bundle_name = project->first("QMAKE_ORIG_TARGET");
|
|
|
|
plist_in_text.replace(QLatin1String("@EXECUTABLE@"), app_bundle_name.toQString());
|
2012-11-13 14:26:17 +00:00
|
|
|
} else {
|
2016-02-18 09:01:38 +00:00
|
|
|
ProString lib_bundle_name = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
|
|
|
|
if (lib_bundle_name.isEmpty())
|
|
|
|
lib_bundle_name = project->first("QMAKE_ORIG_TARGET");
|
|
|
|
plist_in_text.replace(QLatin1String("@LIBRARY@"), lib_bundle_name.toQString());
|
2012-11-13 14:26:17 +00:00
|
|
|
}
|
2013-10-30 14:21:04 +00:00
|
|
|
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
|
|
|
|
if (bundlePrefix.isEmpty())
|
|
|
|
bundlePrefix = "com.yourcompany";
|
2016-02-04 14:12:03 +00:00
|
|
|
plist_in_text.replace(QLatin1String("@BUNDLEIDENTIFIER@"), bundlePrefix + '.' + QLatin1String("${PRODUCT_NAME:rfc1034identifier}"));
|
2012-11-13 14:26:17 +00:00
|
|
|
if (!project->values("VERSION").isEmpty()) {
|
2016-02-04 14:12:03 +00:00
|
|
|
plist_in_text.replace(QLatin1String("@SHORT_VERSION@"), project->first("VER_MAJ") + "." + project->first("VER_MIN"));
|
2012-11-13 14:26:17 +00:00
|
|
|
}
|
2016-02-04 14:12:03 +00:00
|
|
|
plist_in_text.replace(QLatin1String("@TYPEINFO@"),
|
2012-11-13 14:26:17 +00:00
|
|
|
(project->isEmpty("QMAKE_PKGINFO_TYPEINFO")
|
|
|
|
? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4).toQString()));
|
2019-04-16 06:32:33 +00:00
|
|
|
QString launchScreen = var("QMAKE_IOS_LAUNCH_SCREEN");
|
|
|
|
if (launchScreen.isEmpty())
|
|
|
|
launchScreen = QLatin1String("LaunchScreen");
|
|
|
|
else
|
|
|
|
launchScreen = QFileInfo(launchScreen).baseName();
|
|
|
|
plist_in_text.replace(QLatin1String("${IOS_LAUNCH_SCREEN}"), launchScreen);
|
2015-04-13 19:02:29 +00:00
|
|
|
QFile plist_out_file(Option::output_dir + "/Info.plist");
|
2012-11-13 14:26:17 +00:00
|
|
|
if (plist_out_file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
|
|
QTextStream plist_out(&plist_out_file);
|
|
|
|
plist_out << plist_in_text;
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";\n";
|
2015-08-24 10:25:29 +00:00
|
|
|
} else {
|
|
|
|
warn_msg(WarnLogic, "Could not write Info.plist: '%s'.", plist_out_file.fileName().toLatin1().constData());
|
2012-11-13 14:26:17 +00:00
|
|
|
}
|
2015-08-24 10:25:29 +00:00
|
|
|
} else {
|
|
|
|
warn_msg(WarnLogic, "Could not open Info.plist: '%s'.", plist.toLatin1().constData());
|
2012-11-13 14:26:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-05 15:08:11 +00:00
|
|
|
if (Option::output_dir != qmake_getpwd()) {
|
|
|
|
// The SYMROOT is marked by Xcode as excluded from Time Machine
|
|
|
|
// backups, as it's a temporary build dir, but that's fine when
|
|
|
|
// we are shadow building.
|
|
|
|
t << "\t\t\t\t" << writeSettings("SYMROOT", "$(PROJECT_DIR)") << ";\n";
|
|
|
|
} else {
|
|
|
|
// For in-source builds we don't want to exclude the sources
|
|
|
|
// from being backed up, so we point SYMROOT to a temporary
|
|
|
|
// build directory.
|
|
|
|
t << "\t\t\t\t" << writeSettings("SYMROOT", ".xcode") << ";\n";
|
|
|
|
|
|
|
|
// Then we set the configuration build dir instead, so that the
|
|
|
|
// final build artifacts end up in the place Qt Creator expects.
|
|
|
|
// The disadvantage of using this over SYMROOT is that Xcode will
|
|
|
|
// fail to archive projects that override this variable.
|
|
|
|
t << "\t\t\t\t" << writeSettings("CONFIGURATION_BUILD_DIR",
|
|
|
|
"$(PROJECT_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)") << ";\n";
|
|
|
|
}
|
2012-11-13 14:26:17 +00:00
|
|
|
|
|
|
|
if (!project->isEmpty("DESTDIR")) {
|
|
|
|
ProString dir = project->first("DESTDIR");
|
|
|
|
if (QDir::isRelativePath(dir.toQString()))
|
2015-04-13 19:02:29 +00:00
|
|
|
dir.prepend(Option::output_dir + Option::dir_sep);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("INSTALL_DIR", dir) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (project->first("TEMPLATE") == "lib")
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("INSTALL_PATH", ProStringList()) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
|
|
|
|
if (!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("DYLIB_CURRENT_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")+"."+project->first("VER_PAT")) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
if (project->isEmpty("COMPAT_VERSION"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
if (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") &&
|
|
|
|
project->isActiveConfig("lib_bundle"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("FRAMEWORK_VERSION", project->first("QMAKE_FRAMEWORK_VERSION")) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
}
|
|
|
|
if (!project->isEmpty("COMPAT_VERSION"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("COMPAT_VERSION")) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
|
|
|
|
if (!project->isEmpty("QMAKE_MACOSX_DEPLOYMENT_TARGET"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("MACOSX_DEPLOYMENT_TARGET", project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET")) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
if (!project->isEmpty("QMAKE_IOS_DEPLOYMENT_TARGET"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("IPHONEOS_DEPLOYMENT_TARGET", project->first("QMAKE_IOS_DEPLOYMENT_TARGET")) << ";\n";
|
2016-02-16 14:29:59 +00:00
|
|
|
if (!project->isEmpty("QMAKE_TVOS_DEPLOYMENT_TARGET"))
|
|
|
|
t << "\t\t\t\t" << writeSettings("APPLETVOS_DEPLOYMENT_TARGET", project->first("QMAKE_TVOS_DEPLOYMENT_TARGET")) << ";\n";
|
2016-05-20 06:01:59 +00:00
|
|
|
if (!project->isEmpty("QMAKE_WATCHOS_DEPLOYMENT_TARGET"))
|
|
|
|
t << "\t\t\t\t" << writeSettings("WATCHOS_DEPLOYMENT_TARGET", project->first("QMAKE_WATCHOS_DEPLOYMENT_TARGET")) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
|
2012-11-21 13:49:47 +00:00
|
|
|
if (!project->isEmpty("QMAKE_XCODE_CODE_SIGN_IDENTITY"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n";
|
2012-11-21 13:49:47 +00:00
|
|
|
|
2012-11-13 14:26:17 +00:00
|
|
|
tmp = project->values("QMAKE_PBX_VARS");
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for (int i = 0; i < tmp.size(); i++) {
|
2012-11-13 14:26:17 +00:00
|
|
|
QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData()));
|
|
|
|
if (val.isEmpty() && var == "TB")
|
|
|
|
val = "/usr/bin/";
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings(var, val) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
}
|
|
|
|
if (!project->isEmpty("PRECOMPILED_HEADER")) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";\n"
|
2015-02-06 14:30:02 +00:00
|
|
|
<< "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", project->first("PRECOMPILED_HEADER")) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
}
|
2015-01-09 12:42:57 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH"), SettingsAsList, 5) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t\t\t" << writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) << ";\n"
|
2012-11-13 14:26:17 +00:00
|
|
|
<< "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"),
|
2013-07-04 09:25:16 +00:00
|
|
|
!project->values("QMAKE_FRAMEWORKPATH").isEmpty() ? SettingsAsList : 0, 5) << ";\n";
|
2012-11-13 14:26:17 +00:00
|
|
|
|
2012-06-01 23:49:18 +00:00
|
|
|
{
|
2013-07-02 10:05:48 +00:00
|
|
|
ProStringList cflags = project->values("QMAKE_CFLAGS");
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &prl_defines = project->values("PRL_EXPORT_DEFINES");
|
2012-06-01 23:49:18 +00:00
|
|
|
for (int i = 0; i < prl_defines.size(); ++i)
|
|
|
|
cflags += "-D" + prl_defines.at(i);
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &defines = project->values("DEFINES");
|
2012-06-01 23:49:18 +00:00
|
|
|
for (int i = 0; i < defines.size(); ++i)
|
|
|
|
cflags += "-D" + defines.at(i);
|
2013-07-11 13:14:13 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("OTHER_CFLAGS", fixListForOutput(cflags), SettingsAsList, 5) << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
}
|
|
|
|
{
|
2013-07-02 10:05:48 +00:00
|
|
|
ProStringList cxxflags = project->values("QMAKE_CXXFLAGS");
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &prl_defines = project->values("PRL_EXPORT_DEFINES");
|
2012-06-01 23:49:18 +00:00
|
|
|
for (int i = 0; i < prl_defines.size(); ++i)
|
|
|
|
cxxflags += "-D" + prl_defines.at(i);
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &defines = project->values("DEFINES");
|
2012-06-01 23:49:18 +00:00
|
|
|
for (int i = 0; i < defines.size(); ++i)
|
|
|
|
cxxflags += "-D" + defines.at(i);
|
2013-07-11 13:14:13 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("OTHER_CPLUSPLUSFLAGS", fixListForOutput(cxxflags), SettingsAsList, 5) << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
}
|
|
|
|
if (!project->isActiveConfig("staticlib")) {
|
|
|
|
t << "\t\t\t\t" << writeSettings("OTHER_LDFLAGS",
|
|
|
|
fixListForOutput("SUBLIBS")
|
|
|
|
+ fixListForOutput("QMAKE_LFLAGS")
|
2018-10-08 16:24:14 +00:00
|
|
|
+ fixListForOutput(fixLibFlags("LIBS"))
|
|
|
|
+ fixListForOutput(fixLibFlags("LIBS_PRIVATE"))
|
2015-02-06 14:30:02 +00:00
|
|
|
+ fixListForOutput(fixLibFlags("QMAKE_LIBS"))
|
|
|
|
+ fixListForOutput(fixLibFlags("QMAKE_LIBS_PRIVATE")),
|
2013-07-04 09:25:16 +00:00
|
|
|
SettingsAsList, 6) << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
}
|
2013-04-11 12:40:58 +00:00
|
|
|
const ProStringList &archs = !project->values("QMAKE_XCODE_ARCHS").isEmpty() ?
|
|
|
|
project->values("QMAKE_XCODE_ARCHS") : project->values("QT_ARCH");
|
2012-09-24 10:04:21 +00:00
|
|
|
if (!archs.isEmpty())
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("ARCHS", archs) << ";\n";
|
2012-12-09 19:03:35 +00:00
|
|
|
if (!project->isEmpty("OBJECTS_DIR"))
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("OBJROOT", project->first("OBJECTS_DIR")) << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
} else {
|
|
|
|
if (project->first("TEMPLATE") == "app") {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("PRODUCT_NAME", fixForOutput(project->first("QMAKE_ORIG_TARGET").toQString())) << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
} else {
|
|
|
|
if (!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("LIBRARY_STYLE", "STATIC") << ";\n";
|
2012-06-01 23:49:18 +00:00
|
|
|
else
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("LIBRARY_STYLE", "DYNAMIC") << ";\n";
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString lib = project->first("QMAKE_ORIG_TARGET");
|
2012-06-01 23:49:18 +00:00
|
|
|
if (!project->isActiveConfig("lib_bundle") && !project->isActiveConfig("staticlib"))
|
|
|
|
lib.prepend("lib");
|
2015-02-06 14:30:02 +00:00
|
|
|
t << "\t\t\t\t" << writeSettings("PRODUCT_NAME", lib) << ";\n";
|
2012-01-26 21:36:42 +00:00
|
|
|
}
|
|
|
|
}
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t\t};\n"
|
2013-10-09 13:10:39 +00:00
|
|
|
<< "\t\t\t" << writeSettings("name", configName) << ";\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-01 23:49:18 +00:00
|
|
|
for (int i = 0; i < buildConfigGroups.size(); i++) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor("QMAKE_PBX_BUILDCONFIG_LIST_" + buildConfigGroups.at(i)) << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("buildConfigurations", project->values(ProKey("QMAKE_PBX_BUILDCONFIGS_" + buildConfigGroups.at(i))), SettingsAsList, 4) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("defaultConfigurationName", defaultConfig) << ";\n"
|
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
//ROOT
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {\n"
|
|
|
|
<< "\t\t\t" << writeSettings("hasScannedForEncodings", "1", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("compatibilityVersion", "Xcode 3.2") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("isa", "PBXProject", SettingsNoQuote) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("mainGroup", keyFor("QMAKE_PBX_ROOT_GROUP")) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("productRefGroup", keyFor("Products")) << ";\n";
|
|
|
|
t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST_PROJECT")) << ";\n";
|
|
|
|
t << "\t\t\t" << writeSettings("projectDirPath", ProStringList()) << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("projectRoot", "") << ";\n"
|
|
|
|
<< "\t\t\t" << writeSettings("targets", project->values("QMAKE_PBX_TARGETS"), SettingsAsList, 4) << ";\n"
|
2015-02-11 12:59:46 +00:00
|
|
|
<< "\t\t\t" << "attributes = {\n"
|
|
|
|
<< "\t\t\t\tTargetAttributes = {\n";
|
2016-01-26 13:38:54 +00:00
|
|
|
for (const ProString &target : project->values("QMAKE_PBX_TARGETS")) {
|
2015-02-11 12:59:46 +00:00
|
|
|
const ProStringList &attributes = project->values(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + target));
|
|
|
|
if (attributes.isEmpty())
|
|
|
|
continue;
|
|
|
|
t << "\t\t\t\t\t" << target << " = {\n";
|
2016-01-26 13:38:54 +00:00
|
|
|
for (const ProString &attribute : attributes)
|
2015-02-11 12:59:46 +00:00
|
|
|
t << "\t\t\t\t\t\t" << writeSettings(attribute.toQString(), project->first(ProKey("QMAKE_PBX_TARGET_ATTRIBUTES_" + target + "_" + attribute))) << ";\n";
|
|
|
|
t << "\t\t\t\t\t};\n";
|
|
|
|
}
|
|
|
|
t << "\t\t\t\t};\n"
|
|
|
|
<< "\t\t\t};\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "\t\t};\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-11-13 14:26:17 +00:00
|
|
|
// FIXME: Deal with developmentRegion and knownRegions for QMAKE_PBX_ROOT
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
//FOOTER
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t};\n"
|
|
|
|
<< "\t" << writeSettings("rootObject", keyFor("QMAKE_PBX_ROOT")) << ";\n"
|
|
|
|
<< "}\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2015-02-09 14:01:30 +00:00
|
|
|
// Scheme
|
|
|
|
{
|
|
|
|
QString xcodeSpecDir = project->first("QMAKE_XCODE_SPECDIR").toQString();
|
|
|
|
|
|
|
|
bool wroteCustomScheme = false;
|
|
|
|
|
|
|
|
QString projectSharedSchemesPath = pbx_dir + "/xcshareddata/xcschemes";
|
|
|
|
if (mkdir(projectSharedSchemesPath)) {
|
|
|
|
QString target = project->first("QMAKE_ORIG_TARGET").toQString();
|
|
|
|
|
|
|
|
QFile defaultSchemeFile(xcodeSpecDir + "/default.xcscheme");
|
|
|
|
QFile outputSchemeFile(projectSharedSchemesPath + Option::dir_sep + target + ".xcscheme");
|
|
|
|
|
|
|
|
if (defaultSchemeFile.open(QIODevice::ReadOnly)
|
|
|
|
&& outputSchemeFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
|
|
|
|
|
|
|
QTextStream defaultSchemeStream(&defaultSchemeFile);
|
|
|
|
QString schemeData = defaultSchemeStream.readAll();
|
|
|
|
|
2016-02-04 14:12:03 +00:00
|
|
|
schemeData.replace(QLatin1String("@QMAKE_ORIG_TARGET@"), target);
|
|
|
|
schemeData.replace(QLatin1String("@TARGET_PBX_KEY@"), keyFor(pbx_dir + "QMAKE_PBX_TARGET"));
|
|
|
|
schemeData.replace(QLatin1String("@TEST_BUNDLE_PBX_KEY@"), keyFor("QMAKE_TEST_BUNDLE_REFERENCE"));
|
2018-07-17 13:41:06 +00:00
|
|
|
schemeData.replace(QLatin1String("@QMAKE_RELATIVE_PBX_DIR@"), fileFixify(pbx_dir));
|
2015-02-09 14:01:30 +00:00
|
|
|
|
|
|
|
QTextStream outputSchemeStream(&outputSchemeFile);
|
|
|
|
outputSchemeStream << schemeData;
|
|
|
|
|
|
|
|
wroteCustomScheme = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wroteCustomScheme) {
|
|
|
|
// Prevent Xcode from auto-generating schemes
|
|
|
|
QString workspaceSettingsFilename("WorkspaceSettings.xcsettings");
|
|
|
|
QString workspaceSharedDataPath = pbx_dir + "/project.xcworkspace/xcshareddata";
|
|
|
|
if (mkdir(workspaceSharedDataPath)) {
|
|
|
|
QFile::copy(xcodeSpecDir + Option::dir_sep + workspaceSettingsFilename,
|
|
|
|
workspaceSharedDataPath + Option::dir_sep + workspaceSettingsFilename);
|
|
|
|
} else {
|
|
|
|
wroteCustomScheme = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!wroteCustomScheme)
|
|
|
|
warn_msg(WarnLogic, "Failed to generate schemes in '%s', " \
|
|
|
|
"falling back to Xcode auto-generated schemes", qPrintable(projectSharedSchemesPath));
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString
|
2012-09-06 10:21:38 +00:00
|
|
|
ProjectBuilderMakefileGenerator::findProgram(const ProString &prog)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
QString ret = prog.toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(QDir::isRelativePath(ret)) {
|
|
|
|
QStringList paths = QString(qgetenv("PATH")).split(':');
|
|
|
|
for(int i = 0; i < paths.size(); ++i) {
|
|
|
|
QString path = paths.at(i) + "/" + prog;
|
|
|
|
if(exists(path)) {
|
|
|
|
ret = path;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString
|
|
|
|
ProjectBuilderMakefileGenerator::fixForOutput(const QString &values)
|
|
|
|
{
|
|
|
|
//get the environment variables references
|
2020-04-03 15:11:36 +00:00
|
|
|
QRegularExpression reg_var("\\$\\((.*)\\)");
|
|
|
|
QRegularExpressionMatch match;
|
|
|
|
for (int rep = 0; (match = reg_var.match(values, rep)).hasMatch();) {
|
|
|
|
if (project->values("QMAKE_PBX_VARS").indexOf(match.captured(1)) == -1)
|
|
|
|
project->values("QMAKE_PBX_VARS").append(match.captured(1));
|
|
|
|
rep = match.capturedEnd();
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2013-06-27 13:21:37 +00:00
|
|
|
|
|
|
|
return values;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList
|
|
|
|
ProjectBuilderMakefileGenerator::fixListForOutput(const char *where)
|
2013-07-02 10:05:48 +00:00
|
|
|
{
|
|
|
|
return fixListForOutput(project->values(where));
|
|
|
|
}
|
|
|
|
|
|
|
|
ProStringList
|
|
|
|
ProjectBuilderMakefileGenerator::fixListForOutput(const ProStringList &l)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList ret;
|
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-30 12:09:04 +00:00
|
|
|
for(int i = 0; i < l.size(); i++)
|
2012-09-06 10:21:38 +00:00
|
|
|
ret += fixForOutput(l[i].toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString
|
|
|
|
ProjectBuilderMakefileGenerator::keyFor(const QString &block)
|
|
|
|
{
|
|
|
|
#if 1 //This make this code much easier to debug..
|
|
|
|
if(project->isActiveConfig("no_pb_munge_key"))
|
|
|
|
return block;
|
|
|
|
#endif
|
|
|
|
QString ret;
|
|
|
|
if(!keys.contains(block)) {
|
2013-08-13 20:38:45 +00:00
|
|
|
ret = qtSha1(block.toUtf8()).left(24).toUpper();
|
2011-04-27 10:05:43 +00:00
|
|
|
keys.insert(block, ret);
|
|
|
|
} else {
|
|
|
|
ret = keys[block];
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ProjectBuilderMakefileGenerator::openOutput(QFile &file, const QString &build) const
|
|
|
|
{
|
2018-07-17 13:11:07 +00:00
|
|
|
Q_ASSERT_X(QDir::isRelativePath(file.fileName()), "ProjectBuilderMakefileGenerator",
|
|
|
|
"runQMake() should have normalized the filename and made it relative");
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QFileInfo fi(fileInfo(file.fileName()));
|
2018-07-17 13:11:07 +00:00
|
|
|
if (fi.suffix() != "pbxproj") {
|
2011-04-27 10:05:43 +00:00
|
|
|
QString output = file.fileName();
|
2018-07-17 13:11:07 +00:00
|
|
|
if (!output.endsWith(projectSuffix())) {
|
|
|
|
if (fi.fileName().isEmpty()) {
|
|
|
|
if (project->first("TEMPLATE") == "subdirs" || project->isEmpty("QMAKE_ORIG_TARGET"))
|
2011-04-27 10:05:43 +00:00
|
|
|
output += fileInfo(project->projectFile()).baseName();
|
|
|
|
else
|
2012-09-06 10:21:38 +00:00
|
|
|
output += project->first("QMAKE_ORIG_TARGET").toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
output += projectSuffix() + QDir::separator();
|
2018-07-17 13:11:07 +00:00
|
|
|
} else {
|
2011-04-27 10:05:43 +00:00
|
|
|
output += QDir::separator();
|
|
|
|
}
|
|
|
|
output += QString("project.pbxproj");
|
|
|
|
file.setFileName(output);
|
|
|
|
}
|
2015-04-28 12:30:57 +00:00
|
|
|
|
2018-07-17 13:11:07 +00:00
|
|
|
pbx_dir = Option::output_dir + Option::dir_sep + file.fileName().section(Option::dir_sep, 0, 0);
|
2015-04-28 12:30:57 +00:00
|
|
|
return UnixMakefileGenerator::openOutput(file, build);
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ProjectBuilderMakefileGenerator::pbuilderVersion() const
|
|
|
|
{
|
2017-01-12 22:51:46 +00:00
|
|
|
if (!project->isEmpty("QMAKE_PBUILDER_VERSION"))
|
2017-08-11 10:16:57 +00:00
|
|
|
return project->first("QMAKE_PBUILDER_VERSION").toInt();
|
2017-01-12 22:51:46 +00:00
|
|
|
return 46; // Xcode 3.2-compatible; default format since that version
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ProjectBuilderMakefileGenerator::reftypeForFile(const QString &where)
|
|
|
|
{
|
|
|
|
int ret = 0; //absolute is the default..
|
2015-02-06 14:30:02 +00:00
|
|
|
if (QDir::isRelativePath(where))
|
2011-04-27 10:05:43 +00:00
|
|
|
ret = 4; //relative
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString
|
|
|
|
ProjectBuilderMakefileGenerator::projectSuffix() const
|
|
|
|
{
|
2017-01-12 22:51:46 +00:00
|
|
|
return ".xcodeproj";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString
|
|
|
|
ProjectBuilderMakefileGenerator::pbxbuild()
|
|
|
|
{
|
2017-01-12 22:51:46 +00:00
|
|
|
return "xcodebuild";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
2013-06-27 13:21:37 +00:00
|
|
|
static QString quotedStringLiteral(const QString &value)
|
|
|
|
{
|
|
|
|
QString result;
|
Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:
auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.
<classes> are:
// sequential:
"QByteArray",
"QList",
"QQueue",
"QStack",
"QString",
"QVarLengthArray",
"QVector",
// associative:
"QHash",
"QMultiHash",
"QMap",
"QMultiMap",
"QSet",
// Qt has no QMultiSet
Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-30 12:09:04 +00:00
|
|
|
const int len = value.size();
|
2013-06-27 13:21:37 +00:00
|
|
|
result.reserve(int(len * 1.1) + 2);
|
|
|
|
|
|
|
|
result += QLatin1Char('"');
|
|
|
|
|
|
|
|
// Escape
|
|
|
|
for (int i = 0; i < len; ++i) {
|
|
|
|
QChar character = value.at(i);;
|
|
|
|
ushort code = character.unicode();
|
|
|
|
switch (code) {
|
|
|
|
case '\\':
|
|
|
|
result += QLatin1String("\\\\");
|
|
|
|
break;
|
|
|
|
case '"':
|
|
|
|
result += QLatin1String("\\\"");
|
|
|
|
break;
|
|
|
|
case '\b':
|
|
|
|
result += QLatin1String("\\b");
|
|
|
|
break;
|
|
|
|
case '\n':
|
|
|
|
result += QLatin1String("\\n");
|
|
|
|
break;
|
|
|
|
case '\r':
|
|
|
|
result += QLatin1String("\\r");
|
|
|
|
break;
|
|
|
|
case '\t':
|
|
|
|
result += QLatin1String("\\t");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (code >= 32 && code <= 127)
|
|
|
|
result += character;
|
|
|
|
else
|
|
|
|
result += QLatin1String("\\u") + QString::number(code, 16).rightJustified(4, '0');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
result += QLatin1Char('"');
|
|
|
|
|
|
|
|
result.squeeze();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QString
|
2012-09-06 10:21:38 +00:00
|
|
|
ProjectBuilderMakefileGenerator::writeSettings(const QString &var, const ProStringList &vals, int flags, int indent_level)
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
|
|
|
QString ret;
|
2013-06-27 13:21:37 +00:00
|
|
|
bool shouldQuote = !((flags & SettingsNoQuote));
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QString newline = "\n";
|
|
|
|
for(int i = 0; i < indent_level; ++i)
|
|
|
|
newline += "\t";
|
2013-06-27 13:21:37 +00:00
|
|
|
|
2020-04-03 15:11:36 +00:00
|
|
|
static QRegularExpression allowedVariableCharacters("^[a-zA-Z0-9_]*$");
|
2013-09-23 14:01:43 +00:00
|
|
|
ret += var.contains(allowedVariableCharacters) ? var : quotedStringLiteral(var);
|
|
|
|
|
|
|
|
ret += " = ";
|
2013-06-27 13:21:37 +00:00
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if(flags & SettingsAsList) {
|
2013-06-27 13:21:37 +00:00
|
|
|
ret += "(" + newline;
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0, count = 0; i < vals.size(); ++i) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString val = vals.at(i).toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!val.isEmpty()) {
|
|
|
|
if(count++ > 0)
|
|
|
|
ret += "," + newline;
|
2013-06-27 13:21:37 +00:00
|
|
|
if (shouldQuote)
|
|
|
|
val = quotedStringLiteral(val);
|
|
|
|
ret += val;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ret += ")";
|
|
|
|
} else {
|
2013-06-27 13:21:37 +00:00
|
|
|
QString val = vals.join(QLatin1Char(' '));
|
|
|
|
if (shouldQuote)
|
|
|
|
val = quotedStringLiteral(val);
|
|
|
|
ret += val;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-09-10 08:01:31 +00:00
|
|
|
bool
|
|
|
|
ProjectBuilderMakefileGenerator::inhibitMakeDirOutPath(const ProKey &path) const
|
|
|
|
{
|
|
|
|
return path == "OBJECTS_DIR";
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
QT_END_NAMESPACE
|