From a36eaae89338ce5a17a8c831a3fad2b746322f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 12 Nov 2012 15:48:36 +0100 Subject: Xcode: Merge various sources and extra-compilers into more managable groups Instead of letting each qmake variable have its own auto-generated name we try to group common variables into similar groups as used by the Xcode templates provided by Apple. We also prevent the same files from ending up multiple times in a group. Change-Id: I73b13d6071bb7b3cd1501c422a99c60743221485 Reviewed-by: Andy Shaw --- qmake/generators/mac/pbuilder_pbx.cpp | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 9893a7a7a4..0bf4b601b2 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -451,18 +451,17 @@ public: ProjectBuilderSources::ProjectBuilderSources(const QString &k, bool b, const QString &g, const QString &c, bool o) : buildable(b), object_output(o), key(k), group(g), compiler(c) { - if(group.isNull()) { - if(k == "SOURCES") - group = "Sources"; - else if(k == "HEADERS") - group = "Headers"; - else if(k == "QMAKE_INTERNAL_INCLUDED_FILES") - group = "Sources [qmake]"; - else if(k == "GENERATED_SOURCES" || k == "GENERATED_FILES") - group = "Temporary Sources"; - else - fprintf(stderr, "No group available for %s!\n", k.toLatin1().constData()); - } + // 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 + "]"; } QStringList @@ -545,10 +544,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { if (project->isEmpty(ProKey(*it + ".output"))) continue; - ProString name = *it; - const ProKey nkey(*it + ".name"); - if (!project->isEmpty(nkey)) - name = project->first(nkey); const ProStringList &inputs = project->values(ProKey(*it + ".input")); for(int input = 0; input < inputs.size(); ++input) { if (project->isEmpty(inputs.at(input).toKey())) @@ -572,7 +567,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } } sources.append(ProjectBuilderSources(inputs.at(input).toQString(), true, - QString("Sources [") + name + "]", (*it).toQString(), isObj)); + QString(), (*it).toQString(), isObj)); } } } @@ -618,12 +613,17 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } last_grp = new_grp; } + if (groups[last_grp].contains(src_key)) + continue; groups[last_grp] += src_key; in_root = false; } } - if(in_root) + if (in_root) { + if (src_list.contains(src_key)) + continue; src_list.append(src_key); + } //source reference t << "\t\t" << src_key << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" -- cgit v1.2.3 From e70e81d554f0e3ff459a8cae4646ea4b003d9412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 12 Nov 2012 13:50:40 +0100 Subject: Xcode: Change groups/build phase wording to match Apple's templates Change-Id: I286965a05750bc77b94ca4d3b76364b0130e32ed Reviewed-by: Andy Shaw --- qmake/generators/mac/pbuilder_pbx.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 0bf4b601b2..2c7715ecf2 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -786,7 +786,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //SOURCE BUILDPHASE if(!project->isEmpty("QMAKE_PBX_OBJ")) { - QString grp = "Build Sources", key = keyFor(grp); + QString grp = "Compile Sources", key = keyFor(grp); project->values("QMAKE_PBX_BUILDPHASES").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" @@ -967,7 +967,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) { tmp = project->values("QMAKE_PBX_LIBRARIES"); if(!tmp.isEmpty()) { - QString grp("External Frameworks and Libraries"), key = keyFor(grp); + QString grp("Frameworks"), key = keyFor(grp); project->values("QMAKE_PBX_GROUPS").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_LIBRARIES"), SettingsAsList, 4) << ";" << "\n" @@ -980,7 +980,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } } { - QString grp("Frameworks & Libraries"), key = keyFor(grp); + QString grp("Link Binary With Libraries"), key = keyFor(grp); project->values("QMAKE_PBX_BUILDPHASES").append(key); t << "\t\t" << key << " = {" << "\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" -- cgit v1.2.3 From 66f6e5b1621fba4d7a8d6d63c5d5e33ad938c04d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 13 Nov 2012 15:26:17 +0100 Subject: qmake: Update Xcode generator to produce project files similar to Xcode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There was quite a bit of cruft left over from older Xcode version. We now produce Xcode 3.2 compatible files, similar to what Xcode would do when asked to upgrade one of our generated files. In particular: - Removed refType - Set more lastKnownFileTypes - Renamed defaultConfigurationIsName to defaultConfigurationName - Add runOnlyForDeploymentPostprocessing = 0 to build phases - Don't put buildSettings directly into PBXNativeTarget - Don't write productSettingsXML - Don't write startupPath - Don't write name when path is the exact same - Write empty buildSetting lists as empty string - Don't write empty PBXBuildFile settings - Don't write generated/neede filenames for PBXShellScriptBuildPhase - Use PBXFileReference instad of PBXFrameworkReference - Prune deprecated buildSetting variables - Remove deprecated PBXBuildStyle sections - Resolve correct CC/CPLUSPLUS/LDPLUSPLUS - Write IPHONEOS_DEPLOYMENT_TARGET Change-Id: Ia2365c2623fe898878bd10636c3b85145c1cff04 Reviewed-by: Andy Shaw Reviewed-by: Morten Johan Sørvig --- qmake/generators/mac/pbuilder_pbx.cpp | 435 ++++++++++++++-------------------- 1 file changed, 180 insertions(+), 255 deletions(-) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 2c7715ecf2..c68b3d4f83 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #ifdef Q_OS_UNIX @@ -222,7 +223,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) << "\t\t\t" << writeSettings("lastKnownFileType", "wrapper.pb-project") << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(tmp_proj.first("TARGET") + projectSuffix())) << ";" << "\n" << "\t\t\t" << writeSettings("path", pbxproj) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; //WRAPPER @@ -235,8 +235,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t\t" << writeSettings("fileType", "compiled.mach-o.dylib") << ";" << "\n" << "\t\t\t" << writeSettings("path", tmp_proj.first("TARGET") + ".dylib") << ";" << "\n"; } - t << "\t\t\t" << writeSettings("refType", "3", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("remoteRef", keyFor(pbxproj + "_WRAPPERREF")) << ";" << "\n" + 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" @@ -252,7 +251,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) << "\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("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -291,14 +289,13 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("children", grp_it.value(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp_it.key().section(Option::dir_sep, -1))) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; } //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER - //BUILDSTYLE - QString active_buildstyle; + //BUILDCONFIGURATIONS + QString defaultConfig; for(int as_release = 0; as_release < 2; as_release++) { QMap settings; @@ -320,6 +317,8 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) } QString name = (as_release ? "Release" : "Debug"); + if (project->isActiveConfig("debug") != (bool)as_release) + defaultConfig = name; QString key = keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_" + name); project->values("QMAKE_SUBDIR_PBX_BUILDCONFIGS").append(key); t << "\t\t" << key << " = {" << "\n" @@ -330,26 +329,12 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t\t" << "};" << "\n" << "\t\t\t" << writeSettings("name", name) << ";" << "\n" << "\t\t" << "};" << "\n"; - - key = keyFor("QMAKE_SUBDIR_PBX_BUILDSTYLE_" + name); - project->values("QMAKE_SUBDIR_PBX_BUILDSTYLES").append(key); - if (project->isActiveConfig("debug") != (bool)as_release) - active_buildstyle = name; - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << "buildSettings = {" << "\n"; - for(QMap::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it) - t << "\t\t\t\t" << writeSettings(set_it.key(), set_it.value()) << ";\n"; - t << "\t\t\t" << "};" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXBuildStyle", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", name) << ";" << "\n" - << "\t\t" << "};" << "\n"; } 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("defaultConfigurationIsName", active_buildstyle) << ";" << "\n" + << "\t\t\t" << writeSettings("defaultConfigurationName", defaultConfig, SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; #ifdef GENERATE_AGGREGRATE_SUBDIR @@ -376,7 +361,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) 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("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; @@ -482,6 +466,36 @@ ProjectBuilderSources::files(QMakeProject *project) const return ret; } +static QString xcodeFiletypeForFilename(const QString &filename) +{ + foreach (const QString &ext, Option::cpp_ext) { + if (filename.endsWith(ext)) + return QStringLiteral("sourcecode.cpp.cpp"); + } + + foreach (const QString &ext, Option::c_ext) { + if (filename.endsWith(ext)) + return QStringLiteral("sourcecode.c.c"); + } + + foreach (const QString &ext, Option::h_ext) { + if (filename.endsWith(ext)) + return "sourcecode.c.h"; + } + + if (filename.endsWith(QStringLiteral(".mm"))) + return QStringLiteral("sourcecode.cpp.objcpp"); + if (filename.endsWith(QStringLiteral(".m"))) + return QStringLiteral("sourcecode.c.objc"); + if (filename.endsWith(QStringLiteral(".framework"))) + return QStringLiteral("wrapper.framework"); + if (filename.endsWith(QStringLiteral(".a"))) + return QStringLiteral("archive.ar"); + if (filename.endsWith(QStringLiteral(".pro")) || filename.endsWith(QStringLiteral(".qrc"))) + return QStringLiteral("text"); + + return QString(); +} bool ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) @@ -522,10 +536,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) 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("generatedFileNames", 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("neededFileNames", ProStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";" << "\n" << "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(qmake_getpwd()) + " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";" << "\n" << "\t\t" << "};" << "\n"; @@ -627,21 +640,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //source reference t << "\t\t" << src_key << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n" - << "\t\t\t" << writeSettings("path", escapeFilePath(file)) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(file)), SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(file)) << ";" << "\n"; - QString filetype; - for (QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { - if (file.endsWith((*cppit))) { - filetype = "sourcecode.cpp.cpp"; - break; - } - } + << "\t\t\t" << writeSettings("path", escapeFilePath(file)) << ";" << "\n"; + if (name != file) + t << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n"; + t << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(file)) << ";" << "\n"; + QString filetype = xcodeFiletypeForFilename(file); if (!filetype.isNull()) t << "\t\t\t" << writeSettings("lastKnownFileType", filetype) << ";" << "\n"; t << "\t\t" << "};" << "\n"; - if(sources.at(source).isBuildable()) { //build reference + if (sources.at(source).isBuildable() && sources.at(source).isObjectOutput(file)) { //build reference QString build_key = keyFor(file + ".BUILDABLE"); t << "\t\t" << build_key << " = {" << "\n" << "\t\t\t" << writeSettings("fileRef", src_key) << ";" << "\n" @@ -650,8 +657,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t\t" << writeSettings("ATTRIBUTES", ProStringList(), SettingsAsList, 5) << ";" << "\n" << "\t\t\t" << "};" << "\n" << "\t\t" << "};" << "\n"; - if(sources.at(source).isObjectOutput(file)) - project->values("QMAKE_PBX_OBJ").append(build_key); + project->values("QMAKE_PBX_OBJ").append(build_key); } } if(!src_list.isEmpty()) { @@ -671,7 +677,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("children", grp_it.value(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp_it.key().section(Option::dir_sep, -1))) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -775,10 +780,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) 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("generatedFileNames", fixListForOutput("QMAKE_PBX_OBJ"), 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" - << "\t\t\t" << writeSettings("neededFileNames", fixListForOutput("QMAKE_PBX_OBJ"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";" << "\n" << "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(qmake_getpwd()) + " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";" << "\n" << "\t\t" << "};" << "\n"; @@ -792,6 +796,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\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"; } @@ -899,22 +904,21 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) libdirs += path; } library = fileFixify(library); + QString filetype = xcodeFiletypeForFilename(library); QString key = keyFor(library); - bool is_frmwrk = (library.endsWith(".framework")); t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("isa", (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference"), SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n" << "\t\t\t" << writeSettings("path", escapeFilePath(library)) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(library)), SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(library)) << ";" << "\n" - << "\t\t" << "};" << "\n"; + << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(library)) << ";" << "\n"; + if (!filetype.isNull()) + t << "\t\t\t" << writeSettings("lastKnownFileType", filetype) << ";" << "\n"; + t << "\t\t" << "};" << "\n"; project->values("QMAKE_PBX_LIBRARIES").append(key); QString build_key = keyFor(library + ".BUILDABLE"); t << "\t\t" << build_key << " = {" << "\n" << "\t\t\t" << writeSettings("fileRef", key) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << "settings = {" << "\n" - << "\t\t\t" << "};" << "\n" << "\t\t" << "};" << "\n"; project->values("QMAKE_PBX_BUILD_LIBRARIES").append(build_key); } @@ -955,10 +959,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) 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("generatedFileNames", 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" - << "\t\t\t" << writeSettings("neededFileNames", ProStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << "\n" << "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(qmake_getpwd()) + " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";" << "\n" << "\t\t" << "};" << "\n"; @@ -973,8 +976,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("children", project->values("QMAKE_PBX_LIBRARIES"), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" - << "\t\t\t" << writeSettings("path", ProStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -986,6 +987,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\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" << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -1003,6 +1005,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } t << "\t\t\t" << ");" << "\n" << "\t\t\t" << writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" << "\t\t" << "};" << "\n"; } @@ -1040,7 +1043,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t" << file_ref_key << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("path", escapeFilePath(fn)) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(fn)), SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(fn)) << ";" << "\n" << "\t\t" << "};" << "\n"; QString copy_file_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE." + bundle_data[i] + "-" + fn); @@ -1048,8 +1050,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t" << copy_file_key << " = {\n" << "\t\t\t" << writeSettings("fileRef", file_ref_key) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << "settings = {\n" - << "\t\t\t" << "}" << ";" << "\n" << "\t\t" << "}" << ";" << "\n"; } //the phase @@ -1076,26 +1076,15 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("children", bundle_file_refs, SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Source [bundle data]") << ";" << "\n" - << "\t\t\t" << writeSettings("path", ProStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; } - //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER - //ROOT_GROUP - 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" - << "\t\t\t" << writeSettings("name", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n" - << "\t\t\t" << writeSettings("path", ProStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" - << "\t\t" << "};" << "\n"; //REFERENCE project->values("QMAKE_PBX_PRODUCTS").append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")); t << "\t\t" << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << " = {" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n"; + << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("includeInIndex", "0", SettingsNoQuote) << ";" << "\n"; if(project->first("TEMPLATE") == "app") { ProString targ = project->first("QMAKE_ORIG_TARGET"); if(project->isActiveConfig("bundle") && !project->isEmpty("QMAKE_BUNDLE_EXTENSION")) { @@ -1110,7 +1099,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) targ += ".app"; t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.application") << ";" << "\n"; } else { - t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.executable") << ";" << "\n"; + t << "\t\t\t" << writeSettings("explicitFileType", "compiled.mach-o.executable") << ";" << "\n"; } QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") : qmake_getpwd()) + Option::dir_sep + targ; @@ -1144,8 +1133,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } t << "\t\t\t" << writeSettings("path", escapeFilePath(lib)) << ";" << "\n"; } - t << "\t\t\t" << writeSettings("refType", "3", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";" << "\n" + t << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";" << "\n" << "\t\t" << "};" << "\n"; { //Products group QString grp("Products"), key = keyFor(grp); @@ -1154,177 +1142,38 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\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" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; } + + //DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER + //ROOT_GROUP + 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" + << "\t\t\t" << writeSettings("name", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n" + << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" + << "\t\t" << "};" << "\n"; + //TARGET QString target_key = keyFor(pbx_dir + "QMAKE_PBX_TARGET"); project->values("QMAKE_PBX_TARGETS").append(target_key); t << "\t\t" << target_key << " = {" << "\n" << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES") + project->values("QMAKE_PBX_BUILDPHASES"), - SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << "buildSettings = {" << "\n"; - ProString cCompiler = project->first("QMAKE_CC"); - if (!cCompiler.isEmpty()) { - t << "\t\t\t\t" << writeSettings("CC", fixForOutput(findProgram(cCompiler))) << ";" << "\n"; - } - cCompiler = project->first("QMAKE_CXX"); - if (!cCompiler.isEmpty()) { - t << "\t\t\t\t" << writeSettings("CPLUSPLUS", fixForOutput(findProgram(cCompiler))) << ";" << "\n"; - } - - t << "\t\t\t\t" << writeSettings("LEXFLAGS", fixListForOutput("QMAKE_LEXFLAGS")) << ";" << "\n" - << "\t\t\t\t" << writeSettings("YACCFLAGS", fixListForOutput("QMAKE_YACCFLAGS")) << ";" << "\n" - << "\t\t\t\t" << writeSettings("OTHER_REZFLAGS", ProStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("SECTORDER_FLAGS", ProStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("WARNING_CFLAGS", ProStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("PREBINDING", ProStringList((project->isEmpty("QMAKE_DO_PREBINDING") ? "NO" : "YES")), SettingsNoQuote) << ";" << "\n"; - if((project->first("TEMPLATE") == "app" && project->isActiveConfig("app_bundle")) || - (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && - project->isActiveConfig("lib_bundle"))) { - QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString()); - if(plist.isEmpty()) - plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); - if(exists(plist)) { - 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(); - plist_in_text = plist_in_text.replace("@ICON@", - (project->isEmpty("ICON") ? QString("") : project->first("ICON").toQString().section(Option::dir_sep, -1))); - if(project->first("TEMPLATE") == "app") { - plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET").toQString()); - } else { - plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString()); - } - if (!project->values("VERSION").isEmpty()) { - plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." + - project->first("VER_MIN")); - } - plist_in_text = plist_in_text.replace("@TYPEINFO@", - (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : - project->first("QMAKE_PKGINFO_TYPEINFO").left(4).toQString())); - QFile plist_out_file("Info.plist"); - if(plist_out_file.open(QIODevice::WriteOnly | QIODevice::Text)) { - QTextStream plist_out(&plist_out_file); - plist_out << plist_in_text; - t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";" << "\n"; - } - } - } - } -#if 1 - t << "\t\t\t\t" << writeSettings("BUILD_ROOT", escapeFilePath(qmake_getpwd())) << ";" << "\n"; -#endif - if(!project->isActiveConfig("staticlib")) { - t << "\t\t\t\t" << writeSettings("OTHER_LDFLAGS", - fixListForOutput("SUBLIBS") - + fixListForOutput("QMAKE_LFLAGS") - + fixListForOutput("QMAKE_LIBS") - + fixListForOutput("QMAKE_LIBS_PRIVATE"), - SettingsAsList, 6) << ";" << "\n"; - } - if(!project->isEmpty("DESTDIR")) { - ProString dir = project->first("DESTDIR"); - if (QDir::isRelativePath(dir.toQString())) - dir.prepend(qmake_getpwd() + Option::dir_sep); - t << "\t\t\t\t" << writeSettings("INSTALL_DIR", dir) << ";" << "\n"; - } - if (project->first("TEMPLATE") == "lib") { - t << "\t\t\t\t" << writeSettings("INSTALL_PATH", ProStringList()) << ";" << "\n"; - } - if(!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") { - t << "\t\t\t\t" << writeSettings("DYLIB_CURRENT_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")+"."+project->first("VER_PAT")) << ";" << "\n"; - if(project->isEmpty("COMPAT_VERSION")) - t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")) << ";" << "\n"; - if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && - project->isActiveConfig("lib_bundle")) - t << "\t\t\t\t" << writeSettings("FRAMEWORK_VERSION", project->first("QMAKE_FRAMEWORK_VERSION")) << ";" << "\n"; - } - if(!project->isEmpty("COMPAT_VERSION")) - t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("COMPAT_VERSION")) << ";" << "\n"; - if(!project->isEmpty("QMAKE_MACOSX_DEPLOYMENT_TARGET")) - t << "\t\t\t\t" << writeSettings("MACOSX_DEPLOYMENT_TARGET", project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET")) << ";" << "\n"; - if(project->first("TEMPLATE") == "app") { - t << "\t\t\t\t" << writeSettings("PRODUCT_NAME", fixForOutput(project->first("QMAKE_ORIG_TARGET").toQString())) << ";" << "\n"; - } else { - if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) { - t << "\t\t\t\t" << writeSettings("LIBRARY_STYLE", "STATIC") << ";" << "\n"; - } else { - t << "\t\t\t\t" << writeSettings("LIBRARY_STYLE", "DYNAMIC") << ";" << "\n"; - } - ProString lib = project->first("QMAKE_ORIG_TARGET"); - if(!project->isActiveConfig("lib_bundle") && !project->isActiveConfig("staticlib")) - lib.prepend("lib"); - t << "\t\t\t\t" << writeSettings("PRODUCT_NAME", escapeFilePath(lib)) << ";" << "\n"; - } - tmp = project->values("QMAKE_PBX_VARS"); - for(int i = 0; i < tmp.count(); i++) { - QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())); - if(val.isEmpty() && var == "TB") - val = "/usr/bin/"; - t << "\t\t\t\t" << writeSettings(var, escapeFilePath(val)) << ";" << "\n"; - } - t << "\t\t\t" << "};" << "\n" - << "\t\t\t" << "conditionalBuildSettings = {" << "\n" - << "\t\t\t" << "};" << "\n" - << "\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" << writeSettings("shouldUseHeadermap", "1", SettingsNoQuote) << ";" << "\n"; + 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"; if(project->first("TEMPLATE") == "app") { - if(!project->isActiveConfig("app_bundle")) { - if (!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) - t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; - else - t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.tool") << ";" << "\n"; + if (!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) { + t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; } else { - if (!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) - t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; - else + if (project->isActiveConfig("app_bundle")) t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.application") << ";" << "\n"; - t << "\t\t\t" << "productSettingsXML = \""; - bool read_plist = false; - if(exists("Info.plist")) { - QFile plist("Info.plist"); - if (plist.open(QIODevice::ReadOnly)) { - read_plist = true; - QTextStream stream(&plist); - while(!stream.atEnd()) - t << stream.readLine().replace('"', "\\\"") << endl; - } - } - if(!read_plist) { - t << "" << "\n" - << "\t\t\t\t" << "" << "\n" - << "\t\t\t\t" << "" << "\n" - << "\t\t\t\t" << "" << "\n" - << "\t\t\t\t\t" << "CFBundleDevelopmentRegion" << "\n" - << "\t\t\t\t\t" << "English" << "\n" - << "\t\t\t\t\t" << "CFBundleExecutable" << "\n" - << "\t\t\t\t\t" << "" << project->first("QMAKE_ORIG_TARGET") << "" << "\n" - << "\t\t\t\t\t" << "CFBundleIconFile" << "\n" - << "\t\t\t\t\t" << "" << var("ICON").section(Option::dir_sep, -1) << "" << "\n" - << "\t\t\t\t\t" << "CFBundleInfoDictionaryVersion" << "\n" - << "\t\t\t\t\t" << "6.0" << "\n" - << "\t\t\t\t\t" << "CFBundlePackageType" << "\n" - << "\t\t\t\t\t" << "APPL" << "\n" - << "\t\t\t\t\t" << "CFBundleSignature" << "\n" - << "\t\t\t\t\t" << "" - << (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : - project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << "" << "\n" - << "\t\t\t\t\t" << "CFBundleVersion" << "\n" - << "\t\t\t\t\t" << "0.1" << "\n" - << "\t\t\t\t\t" << "CSResourcesFileMapped" << "\n" - << "\t\t\t\t\t" << "" << "\n" - << "\t\t\t\t" << "" << "\n" - << "\t\t\t\t" << ""; - } - t << "\";" << "\n"; + else + t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.tool") << ";" << "\n"; } t << "\t\t\t" << writeSettings("name", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n" << "\t\t\t" << writeSettings("productName", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n"; @@ -1343,12 +1192,11 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) else t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.library.dynamic") << ";" << "\n"; } - t << "\t\t\t" << writeSettings("startupPath", "<>") << ";" << "\n"; if(!project->isEmpty("DESTDIR")) t << "\t\t\t" << writeSettings("productInstallPath", escapeFilePath(project->first("DESTDIR"))) << ";" << "\n"; t << "\t\t" << "};" << "\n"; //DEBUG/RELEASE - QString active_buildstyle; + QString defaultConfig; for(int as_release = 0; as_release < 2; as_release++) { QMap settings; @@ -1379,6 +1227,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } QString name = (as_release ? "Release" : "Debug"); + if (project->isActiveConfig("debug") != (bool)as_release) + defaultConfig = name; for (int i = 0; i < buildConfigGroups.size(); i++) { QString key = keyFor("QMAKE_PBX_BUILDCONFIG_" + name + buildConfigGroups.at(i)); project->values(ProKey("QMAKE_PBX_BUILDCONFIGS_" + buildConfigGroups.at(i))).append(key); @@ -1387,15 +1237,100 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << "buildSettings = {" << "\n"; for (QMap::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 (!project->isEmpty("PRECOMPILED_HEADER")) { - t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";" << "\n" - << "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";" << "\n"; - } if (buildConfigGroups.at(i) == QLatin1String("PROJECT")) { + if (!project->isEmpty("QMAKE_XCODE_GCC_VERSION")) + t << "\t\t\t\t" << writeSettings("GCC_VERSION", project->first("QMAKE_XCODE_GCC_VERSION"), SettingsNoQuote) << ";" << "\n"; + ProString program = project->first("QMAKE_CC"); + if (!program.isEmpty()) + t << "\t\t\t\t" << writeSettings("CC", fixForOutput(findProgram(program))) << ";" << "\n"; + 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++")) + t << "\t\t\t\t" << writeSettings("CPLUSPLUS", fixForOutput(findProgram(program))) << ";" << "\n"; + program = project->first("QMAKE_LINK"); + if (!program.isEmpty()) + t << "\t\t\t\t" << writeSettings("LDPLUSPLUS", fixForOutput(findProgram(program))) << ";" << "\n"; + + if ((project->first("TEMPLATE") == "app" && project->isActiveConfig("app_bundle")) || + (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && + project->isActiveConfig("lib_bundle"))) { + QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString()); + if (plist.isEmpty()) + plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); + if (exists(plist)) { + 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(); + plist_in_text = plist_in_text.replace("@ICON@", + (project->isEmpty("ICON") ? QString("") : project->first("ICON").toQString().section(Option::dir_sep, -1))); + if (project->first("TEMPLATE") == "app") { + plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET").toQString()); + } else { + plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString()); + } + if (!project->values("VERSION").isEmpty()) { + plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." + + project->first("VER_MIN")); + } + plist_in_text = plist_in_text.replace("@TYPEINFO@", + (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") + ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4).toQString())); + QFile plist_out_file("Info.plist"); + if (plist_out_file.open(QIODevice::WriteOnly | QIODevice::Text)) { + QTextStream plist_out(&plist_out_file); + plist_out << plist_in_text; + t << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";" << "\n"; + } + } + } + } + + t << "\t\t\t\t" << writeSettings("SYMROOT", escapeFilePath(qmake_getpwd())) << ";" << "\n"; + + if (!project->isEmpty("DESTDIR")) { + ProString dir = project->first("DESTDIR"); + if (QDir::isRelativePath(dir.toQString())) + dir.prepend(qmake_getpwd() + Option::dir_sep); + t << "\t\t\t\t" << writeSettings("TARGET_BUILD_DIR", dir) << ";" << "\n"; + } + + if (project->first("TEMPLATE") == "lib") + t << "\t\t\t\t" << writeSettings("INSTALL_PATH", ProStringList()) << ";" << "\n"; + + if (!project->isEmpty("VERSION") && project->first("VERSION") != "0.0.0") { + t << "\t\t\t\t" << writeSettings("DYLIB_CURRENT_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")+"."+project->first("VER_PAT")) << ";" << "\n"; + if (project->isEmpty("COMPAT_VERSION")) + t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("VER_MAJ")+"."+project->first("VER_MIN")) << ";" << "\n"; + if (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && + project->isActiveConfig("lib_bundle")) + t << "\t\t\t\t" << writeSettings("FRAMEWORK_VERSION", project->first("QMAKE_FRAMEWORK_VERSION")) << ";" << "\n"; + } + if (!project->isEmpty("COMPAT_VERSION")) + t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("COMPAT_VERSION")) << ";" << "\n"; + + if (!project->isEmpty("QMAKE_MACOSX_DEPLOYMENT_TARGET")) + t << "\t\t\t\t" << writeSettings("MACOSX_DEPLOYMENT_TARGET", project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET")) << ";" << "\n"; + if (!project->isEmpty("QMAKE_IOS_DEPLOYMENT_TARGET")) + t << "\t\t\t\t" << writeSettings("IPHONEOS_DEPLOYMENT_TARGET", project->first("QMAKE_IOS_DEPLOYMENT_TARGET")) << ";" << "\n"; + + tmp = project->values("QMAKE_PBX_VARS"); + for (int i = 0; i < tmp.count(); i++) { + QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())); + if (val.isEmpty() && var == "TB") + val = "/usr/bin/"; + t << "\t\t\t\t" << writeSettings(var, escapeFilePath(val)) << ";" << "\n"; + } + if (!project->isEmpty("PRECOMPILED_HEADER")) { + t << "\t\t\t\t" << writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") << ";" << "\n" + << "\t\t\t\t" << writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";" << "\n"; + } t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + ProStringList(fixForOutput(specdir())), SettingsAsList, 5) << ";" << "\n" << "\t\t\t\t" << writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) << ";" << "\n" - << "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), SettingsAsList, 5) << ";" << "\n" - << "\t\t\t\t" << writeSettings("INFOPLIST_FILE", "Info.plist") << ";" << "\n"; + << "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), + !project->values("QMAKE_FRAMEWORKPATH").isEmpty() ? SettingsAsList : 0, 5) << ";" << "\n"; + { ProStringList cflags = fixListForOutput("QMAKE_CFLAGS"); const ProStringList &prl_defines = project->values("PRL_EXPORT_DEFINES"); @@ -1446,20 +1381,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t" << "};" << "\n" << "\t\t\t" << writeSettings("name", name) << ";" << "\n" << "\t\t" << "};" << "\n"; - - key = keyFor("QMAKE_PBX_BUILDSTYLE_" + name); - project->values("QMAKE_PBX_BUILDSTYLES").append(key); - if (project->isActiveConfig("debug") != (bool)as_release) - active_buildstyle = name; - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildRules", ProStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << "buildSettings = {" << "\n"; - for(QMap::Iterator set_it = settings.begin(); set_it != settings.end(); ++set_it) - t << "\t\t\t\t" << writeSettings(set_it.key(), set_it.value()) << ";" << "\n"; - t << "\t\t\t" << "};" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXBuildStyle") << ";" << "\n" - << "\t\t\t" << writeSettings("name", name) << ";" << "\n" - << "\t\t" << "};" << "\n"; } } for (int i = 0; i < buildConfigGroups.size(); i++) { @@ -1467,20 +1388,24 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\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("defaultConfigurationIsName", active_buildstyle) << ";" << "\n" + << "\t\t\t" << writeSettings("defaultConfigurationName", defaultConfig) << ";" << "\n" << "\t\t" << "};" << "\n"; } //ROOT t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" - << "\t\t\t" << writeSettings("buildStyles", project->values("QMAKE_PBX_BUILDSTYLES"), SettingsAsList, 4) << ";" << "\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("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" << "\t\t" << "};" << "\n"; + // FIXME: Deal with developmentRegion and knownRegions for QMAKE_PBX_ROOT + //FOOTER t << "\t" << "};" << "\n" << "\t" << writeSettings("rootObject", keyFor("QMAKE_PBX_ROOT")) << ";" << "\n" -- cgit v1.2.3 From c6eae1acf8939e512d742578ef3c0c710d3c1653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 3 Dec 2012 14:55:19 +0100 Subject: qmake: Don't generate Xcode project bundle identifiers with spaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace them with dashes, like Xcode itself does. Change-Id: I302425363a2eef13394025cd4a9e414048ce55ce Reviewed-by: Morten Johan Sørvig --- qmake/generators/mac/pbuilder_pbx.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index c68b3d4f83..c5bf7bb7c9 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1270,6 +1270,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } else { plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET").toQString()); } + plist_in_text = plist_in_text.replace("@BUNDLEIDENTIFIER@", QLatin1String("${PRODUCT_NAME:rfc1034identifier}")); if (!project->values("VERSION").isEmpty()) { plist_in_text = plist_in_text.replace("@SHORT_VERSION@", project->first("VER_MAJ") + "." + project->first("VER_MIN")); -- cgit v1.2.3 From 883efa10cdfd81cc4ccbcca55d42a454877d146e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 26 Feb 2013 13:12:25 +0100 Subject: qmake: Prevent duplicate libaries from being added to the link phase Change-Id: I5ec7acb8f060e9d9bbd8cdb95d40ace03cffe9c7 Reviewed-by: Richard Moe Gustavsen --- qmake/generators/mac/pbuilder_pbx.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index c5bf7bb7c9..87085318bc 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -906,21 +906,23 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) library = fileFixify(library); QString filetype = xcodeFiletypeForFilename(library); QString key = keyFor(library); - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n" - << "\t\t\t" << writeSettings("path", escapeFilePath(library)) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(library)) << ";" << "\n"; - if (!filetype.isNull()) - t << "\t\t\t" << writeSettings("lastKnownFileType", filetype) << ";" << "\n"; - t << "\t\t" << "};" << "\n"; - project->values("QMAKE_PBX_LIBRARIES").append(key); - QString build_key = keyFor(library + ".BUILDABLE"); - t << "\t\t" << build_key << " = {" << "\n" - << "\t\t\t" << writeSettings("fileRef", key) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "};" << "\n"; - project->values("QMAKE_PBX_BUILD_LIBRARIES").append(build_key); + if (!project->values("QMAKE_PBX_LIBRARIES").contains(key)) { + t << "\t\t" << key << " = {" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("name", escapeFilePath(name)) << ";" << "\n" + << "\t\t\t" << writeSettings("path", escapeFilePath(library)) << ";" << "\n" + << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(library)) << ";" << "\n"; + if (!filetype.isNull()) + t << "\t\t\t" << writeSettings("lastKnownFileType", filetype) << ";" << "\n"; + t << "\t\t" << "};" << "\n"; + project->values("QMAKE_PBX_LIBRARIES").append(key); + QString build_key = keyFor(library + ".BUILDABLE"); + t << "\t\t" << build_key << " = {" << "\n" + << "\t\t\t" << writeSettings("fileRef", key) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" + << "\t\t" << "};" << "\n"; + project->values("QMAKE_PBX_BUILD_LIBRARIES").append(build_key); + } } if(remove) tmp.removeAt(x); -- cgit v1.2.3 From 0e548b585695f4bcfaaccf289da8124c851d6d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 7 Jan 2013 16:05:21 +0100 Subject: qmake: Use PBXResourcesBuildPhase for QMAKE_BUNDLE_DATA without a path The PBXResourcesBuildPhase will optimize resources, such as turning XIB files into NIB files, running pngcrush on images, turning string files into binary plists, etc, so we prefer that if possible. Unfortunatly this phase does not support custom paths, so whenever we encounter bundle data with a custom path we fall back to the regular PBXCopyFilesBuildPhase. Change-Id: I539db03dd7982fd37293123b6428cdb695f64d2b Reviewed-by: Richard Moe Gustavsen --- qmake/generators/mac/pbuilder_pbx.cpp | 100 +++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 43 deletions(-) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 87085318bc..d0b7efaca6 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -993,24 +993,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" << "\t\t" << "};" << "\n"; } - if(project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES - QString grp("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" << "files = (" << "\n"; - if(!project->isEmpty("ICON")) { - ProString icon = project->first("ICON"); - if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0))) - icon = icon.mid(1, icon.length()-2); - t << "\t\t\t\t" << keyFor(icon + ".BUILDABLE") << ",\n"; - } - t << "\t\t\t" << ");" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" - << "\t\t" << "};" << "\n"; - } if (!project->isEmpty("DESTDIR")) { QString phase_key = keyFor("QMAKE_PBX_TARGET_COPY_PHASE"); QString destDir = project->first("DESTDIR").toQString(); @@ -1029,55 +1011,87 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("shellScript", fixForOutput("cp -r $BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME " + escapeFilePath(destDir))) << ";" << "\n" << "\t\t" << "};\n"; } - //BUNDLE_DATA BUILDPHASE (copy) - if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { + // Copy Bundle Resources + if (!project->isEmpty("QMAKE_BUNDLE_DATA")) { ProStringList bundle_file_refs; + ProStringList bundle_resources_files; + + bool useCopyResourcesPhase = project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app"; + //all bundle data const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); for(int i = 0; i < bundle_data.count(); i++) { - ProStringList pbx_files; + ProStringList bundle_files; + ProString path = project->first(ProKey(bundle_data[i] + ".path")); //all files const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); for(int file = 0; file < files.count(); file++) { QString fn = files[file].toQString(); - QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE_REF." + bundle_data[i] + "-" + fn); + QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE_REF." + bundle_data[i] + "-" + fn); bundle_file_refs += file_ref_key; t << "\t\t" << file_ref_key << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("path", escapeFilePath(fn)) << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", sourceTreeForFile(fn)) << ";" << "\n" << "\t\t" << "};" << "\n"; - QString copy_file_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE." + bundle_data[i] + "-" + fn); - pbx_files += copy_file_key; - t << "\t\t" << copy_file_key << " = {\n" + QString file_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE." + bundle_data[i] + "-" + fn); + bundle_files += file_key; + t << "\t\t" << file_key << " = {\n" << "\t\t\t" << writeSettings("fileRef", file_ref_key) << ";" << "\n" << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" << "\t\t" << "}" << ";" << "\n"; } - //the phase - QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]); - QString path; - if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) { - //### + + if (!useCopyResourcesPhase || !path.isEmpty()) { + // The resource copy phase doesn't support paths, so we have to use + // a regular file copy phase (which doesn't optimize the resources). + QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]); + if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) { + //### + } + + project->values("QMAKE_PBX_PRESCRIPT_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" + << "\t\t\t" << writeSettings("dstPath", escapeFilePath(path)) << ";" << "\n" + << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("files", bundle_files, SettingsAsList, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" + << "\t\t" << "}" << ";" << "\n"; + } else { + // Otherwise we leave it to the resource copy phase below + bundle_resources_files += bundle_files; + } + } + + if (useCopyResourcesPhase) { + if (!project->isEmpty("ICON")) { + ProString icon = project->first("ICON"); + if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0))) { + icon = icon.mid(1, icon.length() - 2); + bundle_resources_files += keyFor(icon + ".BUILDABLE"); + } } - path += project->first(ProKey(bundle_data[i] + ".path")); - project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); - t << "\t\t" << phase_key << " = {\n" - << "\t\t\t" << writeSettings("name", "Bundle Copy [" + bundle_data[i] + "]") << ";" << "\n" + + 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("dstPath", escapeFilePath(path)) << ";" << "\n" - << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("files", pbx_files, SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", 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" - << "\t\t" << "}" << ";" << "\n"; + << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" + << "\t\t" << "};" << "\n"; } - QString bundle_copy_key = keyFor("QMAKE_PBX_BUNDLE_COPY"); - project->values("QMAKE_PBX_GROUPS").append(bundle_copy_key); - t << "\t\t" << bundle_copy_key << " = {" << "\n" + + QString bundle_data_key = keyFor("QMAKE_PBX_BUNDLE_DATA"); + project->values("QMAKE_PBX_GROUPS").append(bundle_data_key); + 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" - << "\t\t\t" << writeSettings("name", "Source [bundle data]") << ";" << "\n" + << "\t\t\t" << writeSettings("name", "Bundle Resources") << ";" << "\n" << "\t\t\t" << writeSettings("sourceTree", "") << ";" << "\n" << "\t\t" << "};" << "\n"; } -- cgit v1.2.3 From f6d13a45c88d94a7b616450efe1adb0a231a92c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sat, 22 Dec 2012 19:57:10 +0100 Subject: qmake: Prevent Obj-C sources from building both as extra compiler and in Xcode We already assume that if a source is buildable and should end up in OBJECTS we can let Xcode build it, so we skip this input for the extra compiler. Change-Id: I17b2408925b8e6513f0fa0d2459ec539bf7381d3 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Oswald Buddenhagen --- qmake/generators/mac/pbuilder_pbx.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index d0b7efaca6..4710f7e939 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -557,10 +557,13 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { if (project->isEmpty(ProKey(*it + ".output"))) continue; - const ProStringList &inputs = project->values(ProKey(*it + ".input")); - for(int input = 0; input < inputs.size(); ++input) { - if (project->isEmpty(inputs.at(input).toKey())) + ProStringList &inputs = project->values(ProKey(*it + ".input")); + int input = 0; + while (input < inputs.size()) { + if (project->isEmpty(inputs.at(input).toKey())) { + ++input; continue; + } bool duplicate = false; bool isObj = project->values(ProKey(*it + ".CONFIG")).indexOf("no_link") == -1; if (!isObj) { @@ -581,7 +584,14 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) } sources.append(ProjectBuilderSources(inputs.at(input).toQString(), true, QString(), (*it).toQString(), isObj)); + + if (isObj) { + inputs.removeAt(input); + continue; + } } + + ++input; } } } -- cgit v1.2.3 From dd5b437d6a9b509466021c9484cc396bbdf0f1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 11 Dec 2012 16:46:55 +0100 Subject: qmake: Fix file paths in Xcode projects when shadow-building The Xcode generator seems to have been written with the assumption that writeMakeParts() would be called with the output directory as the current directory, but that's not the case when shadow-building. Perhaps this was changed in qmake at some point, and the Xcode generator was not updated to reflect that. Instead of replacing every occurance of fileFixify and other logic to deal with paths, we just chdir into the output_dir for the duration of the function (except when writing the 'make qmake' makefile, as the regular makefile generator works as expected with the current directory set to the input directory). Change-Id: I6ba492036d73f29f4adbd7cd554db9504050629e Reviewed-by: Richard Moe Gustavsen --- qmake/generators/mac/pbuilder_pbx.cpp | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 4710f7e939..41af3d2a53 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -453,7 +453,6 @@ ProjectBuilderSources::files(QMakeProject *project) const { QStringList ret = project->values(ProKey(key)).toQStringList(); if(key == "QMAKE_INTERNAL_INCLUDED_FILES") { - ret.prepend(project->projectFile()); for(int i = 0; i < ret.size(); ++i) { QStringList newret; if(!ret.at(i).endsWith(Option::prf_ext)) @@ -500,6 +499,14 @@ static QString xcodeFiletypeForFilename(const QString &filename) bool ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) { + // The code in this function assumes that the current directory matches + // the output directory, which is not actually the case when we are called + // from the generic generator code. Instead of changing every single + // assumption and fileFixify we cheat by moving into the output directory + // for the duration of this function. + QString input_dir = qmake_getpwd(); + qmake_setpwd(Option::output_dir); + ProStringList tmp; bool did_preprocess = false; @@ -521,6 +528,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) QFile mkf(mkfile); if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) { writingUnixMakefileGenerator = true; + qmake_setpwd(input_dir); // Makefile generation assumes input_dir as pwd debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData()); QTextStream mkt(&mkf); writeHeader(mkt); @@ -529,6 +537,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt.flush(); mkf.close(); writingUnixMakefileGenerator = false; + qmake_setpwd(Option::output_dir); } QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE"); mkfile = fileFixify(mkfile, qmake_getpwd()); @@ -544,6 +553,10 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t" << "};" << "\n"; } + // 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. + project->values("QMAKE_INTERNAL_INCLUDED_FILES").prepend(fileFixify(project->projectFile(), qmake_getpwd(), input_dir)); + //DUMP SOURCES QMap groups; QList sources; @@ -1463,6 +1476,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) writingUnixMakefileGenerator = false; } } + + qmake_setpwd(input_dir); + return true; } @@ -1676,10 +1692,9 @@ ProjectBuilderMakefileGenerator::reftypeForFile(const QString &where) QString ProjectBuilderMakefileGenerator::sourceTreeForFile(const QString &where) { - QString ret = ""; - if (QDir::isRelativePath(unescapeFilePath(where))) - ret = "SOURCE_ROOT"; //relative - return ret; + // We always use absolute paths, instead of maintaining the SRCROOT + // build variable and making files relative to that. + return QLatin1String(""); } QString -- cgit v1.2.3 From a6286039babdd3680124c9449d14911ed29b2295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 21 Nov 2012 14:49:47 +0100 Subject: iOS: Write default code signing identify for iOS in Xcode generator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic04da6063863585665c9133caba0279ba478fbb4 Reviewed-by: Oswald Buddenhagen Reviewed-by: Ian Dean Reviewed-by: Morten Johan Sørvig --- qmake/generators/mac/pbuilder_pbx.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'qmake/generators/mac/pbuilder_pbx.cpp') diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index 41af3d2a53..923639d89d 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1355,6 +1355,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if (!project->isEmpty("QMAKE_IOS_DEPLOYMENT_TARGET")) t << "\t\t\t\t" << writeSettings("IPHONEOS_DEPLOYMENT_TARGET", project->first("QMAKE_IOS_DEPLOYMENT_TARGET")) << ";" << "\n"; + if (!project->isEmpty("QMAKE_XCODE_CODE_SIGN_IDENTITY")) + t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";" << "\n"; + tmp = project->values("QMAKE_PBX_VARS"); for (int i = 0; i < tmp.count(); i++) { QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())); -- cgit v1.2.3