diff -Npur qt-everywhere-opensource-src-4.7.2/mkspecs/features/mac/objective_c.prf qt-xcode4-4.7.2/mkspecs/features/mac/objective_c.prf --- qt-everywhere-opensource-src-4.7.2/mkspecs/features/mac/objective_c.prf 2011-02-22 06:02:55.000000000 -0600 +++ qt-xcode4-4.7.2/mkspecs/features/mac/objective_c.prf 2011-05-18 10:39:36.000000000 -0500 @@ -19,5 +19,6 @@ objective_c.commands = $$QMAKE_OBJECTIVE objective_c.output = $$OBJECTIVE_C_OBJECTS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} objective_c.input = OBJECTIVE_SOURCES objective_c.name = Compile ${QMAKE_FILE_IN} +objective_c.skip_preprocess = 1 silent:objective_c.commands = @echo objective-c ${QMAKE_FILE_IN} && $$objective_c.commands QMAKE_EXTRA_COMPILERS += objective_c diff -Npur qt-everywhere-opensource-src-4.7.2/mkspecs/macx-xcode/Info.plist.app qt-xcode4-4.7.2/mkspecs/macx-xcode/Info.plist.app --- qt-everywhere-opensource-src-4.7.2/mkspecs/macx-xcode/Info.plist.app 2011-02-22 06:02:55.000000000 -0600 +++ qt-xcode4-4.7.2/mkspecs/macx-xcode/Info.plist.app 2011-05-17 13:52:51.000000000 -0500 @@ -1,19 +1,25 @@ - - + + CFBundleIconFile @ICON@ - CFBundlePackageType + CFBundleDisplayName + @DISPLAY_NAME@ + CFBundleVersion + @VERSION@ + CFBundleName + @DISPLAY_NAME@ + CFBundlePackageType APPL - CFBundleGetInfoString - Created by Qt/QMake + CFBundleGetInfoString + @GET_INFO@ CFBundleSignature @TYPEINFO@ CFBundleExecutable @EXECUTABLE@ CFBundleIdentifier - com.yourcompany.@EXECUTABLE@ + @DOMAIN@.@COMPANY@.@EXECUTABLE@ NOTE This file was generated by Qt/QMake. diff -Npur qt-everywhere-opensource-src-4.7.2/mkspecs/macx-xcode/qmake.conf qt-xcode4-4.7.2/mkspecs/macx-xcode/qmake.conf --- qt-everywhere-opensource-src-4.7.2/mkspecs/macx-xcode/qmake.conf 2011-02-22 06:02:55.000000000 -0600 +++ qt-xcode4-4.7.2/mkspecs/macx-xcode/qmake.conf 2011-05-17 13:52:51.000000000 -0500 @@ -9,6 +9,11 @@ TEMPLATE = app CONFIG += qt warn_on release lib_version_first incremental plugin_no_soname link_prl app_bundle QT += core gui +QMAKE_MACX_DOMAIN = com +QMAKE_MACX_COMPANY = yourcompany +QMAKE_MACX_GET_INFO = "Created by Qt/QMake" +QMAKE_MACX_DISPLAY_NAME = "@EXECUTABLE@" + include(../common/mac-g++.conf) QMAKE_CC = diff -Npur qt-everywhere-opensource-src-4.7.2/qmake/generators/mac/pbuilder_pbx.cpp qt-xcode4-4.7.2/qmake/generators/mac/pbuilder_pbx.cpp --- qt-everywhere-opensource-src-4.7.2/qmake/generators/mac/pbuilder_pbx.cpp 2011-02-22 06:02:48.000000000 -0600 +++ qt-xcode4-4.7.2/qmake/generators/mac/pbuilder_pbx.cpp 2011-05-18 11:08:55.000000000 -0500 @@ -505,14 +505,19 @@ ProjectBuilderMakefileGenerator::writeMa QStringList tmp; bool did_preprocess = false; - //HEADER + QStringList PBXBuildFileList; + QStringList PBXCopyFilesBuildPhaseList; + QStringList PBXShellScriptBuildPhaseList; + QStringList PBXFileReferenceList; + QStringList PBXGroupList; + QStringList PBXSourcesBuildPhaseList; + QStringList PBXResourcesBuildPhaseList; + QStringList PBXFrameworksBuildPhaseList; + + // Make sure to be able to handle objective-c and objective-cpp files. + QStringList objc_ext = project->variables()["QMAKE_EXT_OBJECTIVE_C"]; + const int pbVersion = pbuilderVersion(); - t << "// !$*UTF8*$!" << "\n" - << "{" << "\n" - << "\t" << writeSettings("archiveVersion", "1", SettingsNoQuote) << ";" << "\n" - << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n" - << "\t" << writeSettings("objectVersion", QString::number(pbVersion), SettingsNoQuote) << ";" << "\n" - << "\t" << "objects = {" << endl; //MAKE QMAKE equivelant if(!project->isActiveConfig("no_autoqmake") && project->projectFile() != "(stdin)") { @@ -531,17 +536,18 @@ ProjectBuilderMakefileGenerator::writeMa } QString phase_key = keyFor("QMAKE_PBX_MAKEQMAKE_BUILDPHASE"); mkfile = fileFixify(mkfile, qmake_getpwd()); - project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); - t << "\t\t" << phase_key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("files", QStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("generatedFileNames", QStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", "Qt Qmake") << ";" << "\n" - << "\t\t\t" << writeSettings("neededFileNames", QStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";" << "\n" - << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) << ";" << "\n" - << "\t\t" << "};" << "\n"; + project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key + " /* Qt Qmake */"); + PBXShellScriptBuildPhaseList << "\t\t" + phase_key + " = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("buildActionMask", "2147483647", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("files", QStringList(), SettingsAsList, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("generatedFileNames", QStringList(), SettingsAsList, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("neededFileNames", QStringList(), SettingsAsList, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", "Qt Qmake") + ";" + "\n" + + "\t\t\t" + writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("shellPath", "/bin/sh") + ";" + "\n" + + "\t\t\t" + writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) + ";" + "\n" + + "\t\t" + "};" + "\n"; } //DUMP SOURCES @@ -597,7 +603,7 @@ ProjectBuilderMakefileGenerator::writeMa if(file.length() >= 2 && (file[0] == '"' || file[0] == '\'') && file[(int) file.length()-1] == file[0]) file = file.mid(1, file.length()-2); if(!sources.at(source).compilerName().isNull() && - !verifyExtraCompiler(sources.at(source).compilerName(), file)) + !verifyExtraCompiler(sources.at(source).compilerName(), file)) continue; if(file.endsWith(Option::prl_ext)) continue; @@ -628,45 +634,92 @@ ProjectBuilderMakefileGenerator::writeMa } last_grp = new_grp; } - groups[last_grp] += src_key; + groups[last_grp] += src_key + " /* " + file + " */"; in_root = false; } } if(in_root) - src_list.append(src_key); + src_list.append(src_key + " /* " + file + " */"); + bool isBuildable = false; //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"; + QString sourceReferenceString; + sourceReferenceString.append( "\t\t" + src_key + " /* " + file + " */ = {" + "" + + "" + writeSettings("isa", "PBXFileReference", SettingsNoQuote) + ";" + " "); if(pbVersion >= 38) { - QString filetype; + QString filetype = "file"; + for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit) { if(file.endsWith((*cppit))) { filetype = "sourcecode.cpp.cpp"; + isBuildable = true; break; } } + for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit) { + if(file.endsWith((*cit))) { + filetype = "sourcecode.c.c"; + isBuildable = true; + break; + } + } + for(QStringList::Iterator hit = Option::h_ext.begin(); hit != Option::h_ext.end(); ++hit) { + if(file.endsWith((*hit))) { + if( (*hit).contains("hpp") ) + filetype = "sourcecode.cpp.h"; + else + filetype = "sourcecode.c.h"; + break; + } + } + for(QStringList::Iterator mit = objc_ext.begin(); mit != objc_ext.end(); ++mit) { + if(file.endsWith((*mit))) { + if( (*mit) == ".mm" ) + filetype = "sourcecode.cpp.objcpp"; + else if( (*mit) == ".m" ) + filetype = "sourcecode.c.objc"; + isBuildable = true; + break; + } + } + if(file.endsWith(Option::pro_ext)) { + filetype = "text"; + } + if(file.endsWith(".qrc")) { + filetype = "text"; + } + if(file.endsWith(".png")){ + filetype = "image.png"; + } + if(file.endsWith(".icns")){ + filetype = "image.icns"; + isBuildable = true; + } + if(file.endsWith(Option::ui_ext)){ + filetype = "text.xml"; + } if(!filetype.isNull()) - t << "\t\t\t" << writeSettings("lastKnownFileType", filetype) << ";" << "\n"; + sourceReferenceString.append( "" + writeSettings("lastKnownFileType", filetype, SettingsNoQuote) + ";" + " " ); } - t << "\t\t" << "};" << "\n"; - if(sources.at(source).isBuildable()) { //build reference + sourceReferenceString.append( "" + writeSettings("name", escapeFilePath(name)) + ";" + " " + + "" + writeSettings("path", escapeFilePath(file)) + ";" + " " + + "" + writeSettings("sourceTree", "") + ";" + " " + + "" + "};" + "\n"); + PBXFileReferenceList.append( sourceReferenceString ); + if(sources.at(source).isBuildable() && isBuildable ) { //build reference QString build_key = keyFor(file + ".BUILDABLE"); - t << "\t\t" << build_key << " = {" << "\n" - << "\t\t\t" << writeSettings("fileRef", src_key) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXBuildFile", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << "settings = {" << "\n" - << "\t\t\t\t" << writeSettings("ATTRIBUTES", QStringList(), SettingsAsList, 5) << ";" << "\n" - << "\t\t\t" << "};" << "\n" - << "\t\t" << "};" << "\n"; + PBXBuildFileList << "\t\t" + build_key + " /* " + file + " */ = {" + " " + + "" + writeSettings("isa", "PBXBuildFile", SettingsNoQuote) + ";" + " " + + "" + writeSettings("fileRef", src_key) + " /* " + escapeFilePath(file) + " */;" + " " + + "" + "settings = {" + " " + + "" + writeSettings("ATTRIBUTES", QStringList(), SettingsAsList | SettingsNoNewline, 5) + ";" + " " + + "" + "};" + " " + + "" + "};" + "\n"; if(sources.at(source).isObjectOutput(file)) - project->values("QMAKE_PBX_OBJ").append(build_key); + project->values("QMAKE_PBX_OBJ").append(build_key + " /* " + file + " */"); } } if(!src_list.isEmpty()) { - QString group_key = keyFor(sources.at(source).groupName()); + QString group_key = keyFor(sources.at(source).groupName()) + " /* " + sources.at(source).groupName() + " */"; if(root_group_list.indexOf(group_key) == -1) root_group_list += group_key; @@ -677,13 +730,15 @@ ProjectBuilderMakefileGenerator::writeMa } } } + + // PBX Groups, or at least some of them. for(QMap::Iterator grp_it = groups.begin(); grp_it != groups.end(); ++grp_it) { - 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" - << "\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" << "};" << "\n"; + PBXGroupList << "\t\t" + keyFor(grp_it.key()) + " /* " + escapeFilePath(grp_it.key().section(Option::dir_sep, -1)) + " */ = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXGroup", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("children", grp_it.value(), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", escapeFilePath(grp_it.key().section(Option::dir_sep, -1))) + ";" + "\n" + + "\t\t\t" + writeSettings("sourceTree", "") + ";" + "\n" + + "\t\t" + "};" + "\n"; } //PREPROCESS BUILDPHASE (just a makefile) @@ -718,7 +773,7 @@ ProjectBuilderMakefileGenerator::writeMa mkt << " " << "-I" << escapeFilePath((*incit)); } if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS")) - mkt << " " << var("QMAKE_FRAMEWORKPATH_FLAGS"); + mkt << " " << var("QMAKE_FRAMEWORKPATH_FLAGS"); mkt << endl; mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl; @@ -751,6 +806,8 @@ ProjectBuilderMakefileGenerator::writeMa mkt << "compilers:"; const QStringList &compilers = project->values("QMAKE_EXTRA_COMPILERS"); for(int compiler = 0; compiler < compilers.size(); ++compiler) { + if(!project->isEmpty(compilers.at(compiler) + ".skip_preprocess")) + continue; QString tmp_out = project->first(compilers.at(compiler) + ".output"); if(project->isEmpty(compilers.at(compiler) + ".output")) continue; @@ -779,35 +836,24 @@ ProjectBuilderMakefileGenerator::writeMa } mkfile = fileFixify(mkfile, qmake_getpwd()); 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); - t << "\t\t" << phase_key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("files", QStringList(), 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("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", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) << ";" << "\n" - << "\t\t" << "};" << "\n"; - } - - //SOURCE BUILDPHASE - if(!project->isEmpty("QMAKE_PBX_OBJ")) { - QString grp = "Build Sources", 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", fixListForOutput("QMAKE_PBX_OBJ"), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXSourcesBuildPhase", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", grp) << ";" << "\n" - << "\t\t" << "};" << "\n"; + // project->values("QMAKE_PBX_BUILDPHASES").append(phase_key); + project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key + " /* Qt Preprocessors */"); + PBXShellScriptBuildPhaseList << "\t\t" + phase_key + " = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("buildActionMask", "2147483647", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("files", QStringList(), SettingsAsList, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("generatedFileNames", project->values("QMAKE_PBX_OBJ"), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("neededFileNames", project->values("QMAKE_PBX_OBJ"), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", "Qt Preprocessors") + ";" + "\n" + + "\t\t\t" + writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("shellPath", "/bin/sh") + ";" + "\n" + + "\t\t\t" + writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) + ";" + "\n" + + "\t\t" + "};" + "\n"; } if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES QStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"), - &frameworkdirs = project->values("QMAKE_FRAMEWORKPATH"); + &frameworkdirs = project->values("QMAKE_FRAMEWORKPATH"); QString libs[] = { "QMAKE_LFLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LIBS", QString() }; for(int i = 0; !libs[i].isNull(); i++) { @@ -816,7 +862,7 @@ ProjectBuilderMakefileGenerator::writeMa bool remove = false; QString library, name, opt = tmp[x].trimmed(); if(opt.length() >= 2 && (opt[0] == '"' || opt[0] == '\'') && - opt[(int) opt.length()-1] == opt[0]) + opt[(int) opt.length()-1] == opt[0]) opt = opt.mid(1, opt.length()-2); if(opt.startsWith("-L")) { QString r = opt.right(opt.length() - 2); @@ -907,24 +953,27 @@ ProjectBuilderMakefileGenerator::writeMa if(!path.isEmpty() && !libdirs.contains(path)) libdirs += path; } + library = fileFixify(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("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" << "};" << "\n"; - project->values("QMAKE_PBX_LIBRARIES").append(key); + PBXFileReferenceList << "\t\t" + key + " /* " + library + " */ = {" + " " + + "" + writeSettings("isa", "PBXFileReference", SettingsNoQuote) + ";" + " " + + "" + writeSettings("lastKnownFileType", (is_frmwrk ? "wrapper.framework" : "unknown"), SettingsNoQuote) + ";" + " " + + "" + writeSettings("name", escapeFilePath(name)) + ";" + " " + + "" + writeSettings("path", escapeFilePath(library)) + ";" + " " + + "" + writeSettings("sourceTree", "") + ";" + " " + + "" + "};" + "\n"; + project->values("QMAKE_PBX_LIBRARIES").append(key + " /* " + library + " */"); + 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); + PBXBuildFileList << "\t\t" + build_key + " /* " + library + " */ = {" + " " + + "" + writeSettings("isa", "PBXBuildFile", SettingsNoQuote) + ";" + " " + + "" + writeSettings("fileRef", key, SettingsNoQuote) + ";" + " " + //+ "" + "settings = {" + "\n" + //+ "" + "};" + "\n" + + "" + "};" + "\n"; + project->values("QMAKE_PBX_BUILD_LIBRARIES").append(build_key + " /* " + library + " */"); } if(remove) tmp.removeAt(x); @@ -934,6 +983,7 @@ ProjectBuilderMakefileGenerator::writeMa project->values(libs[i]) = tmp; } } + //SUBLIBS BUILDPHASE (just another makefile) if(!project->isEmpty("SUBLIBS")) { QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak"; @@ -946,97 +996,103 @@ ProjectBuilderMakefileGenerator::writeMa mkt << "SUBLIBS= "; tmp = project->values("SUBLIBS"); for(int i = 0; i < tmp.count(); i++) - t << "tmp/lib" << tmp[i] << ".a "; - t << endl << endl; + mkt << "tmp/lib" << tmp[i] << ".a "; + mkt << endl << endl; mkt << "sublibs: $(SUBLIBS)" << endl << endl; tmp = project->values("SUBLIBS"); for(int i = 0; i < tmp.count(); i++) - t << "tmp/lib" << tmp[i] << ".a" << ":\n\t" - << var(QString("MAKELIB") + tmp[i]) << endl << endl; + mkt << "tmp/lib" << tmp[i] << ".a" << ":\n\t" + << var(QString("MAKELIB") + tmp[i]) << endl << endl; mkt.flush(); mkf.close(); writingUnixMakefileGenerator = false; } QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE"); mkfile = fileFixify(mkfile, qmake_getpwd()); - project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); - t << "\t\t" << phase_key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("files", QStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("generatedFileNames", QStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", "Qt Sublibs") << ";" << "\n" - << "\t\t\t" << writeSettings("neededFileNames", QStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("shellPath", "/bin/sh") << "\n" - << "\t\t\t" << writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) << ";" << "\n" - << "\t\t" << "};" << "\n"; + project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key + " /* Qt Sublibs */"); + PBXShellScriptBuildPhaseList << "\t\t" + phase_key + " = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("buildActionMask", "2147483647", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("files", QStringList(), SettingsAsList, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("generatedFileNames", QStringList(), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("neededFileNames", QStringList(), SettingsAsList, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", "Qt Sublibs") + ";" + "\n" + + "\t\t\t" + writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("shellPath", "/bin/sh") + "\n" + + "\t\t\t" + writeSettings("shellScript", fixForOutput("make -C " + escapeFilePath(qmake_getpwd()) + " -f '" + escapeFilePath(mkfile) + "'")) + ";" + "\n" + + "\t\t" + "};" + "\n"; } + + //SOURCE BUILDPHASE + if(!project->isEmpty("QMAKE_PBX_OBJ")) { + QString grp = "Build Sources", key = keyFor(grp); + project->values("QMAKE_PBX_BUILDPHASES").append(key + " /* " + grp + " */"); + PBXSourcesBuildPhaseList << "\t\t" + key + " /* " + grp + " */ = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXSourcesBuildPhase", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("buildActionMask", "2147483647", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("files", project->values("QMAKE_PBX_OBJ"), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", grp) + ";" + "\n" + + "\t\t\t" + writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) + ";" + "\n" + + "\t\t" + "};" + "\n"; + } + //LIBRARY BUILDPHASE if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) { tmp = project->values("QMAKE_PBX_LIBRARIES"); if(!tmp.isEmpty()) { QString grp("External Frameworks and Libraries"), 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" - << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";" << "\n" - << "\t\t\t" << writeSettings("path", QStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "};" << "\n"; + project->values("QMAKE_PBX_GROUPS").append(key + " /* " + grp + " */"); + PBXGroupList << "\t\t" + key + " /* " + grp + " */ = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXGroup", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("children", project->values("QMAKE_PBX_LIBRARIES"), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", escapeFilePath(grp)) + ";" + "\n" + + "\t\t\t" + writeSettings("sourceTree", "") + ";" + "\n" + + "\t\t" + "};" + "\n"; } } + + //Products group { - QString grp("Frameworks & Libraries"), 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", project->values("QMAKE_PBX_BUILD_LIBRARIES"), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXFrameworksBuildPhase", SettingsNoQuote) << ";" << "\n" - << "\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")) { - QString icon = project->first("ICON"); - if(icon.length() >= 2 && (icon[0] == '"' || icon[0] == '\'') && icon[(int)icon.length()-1] == icon[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("name", escapeFilePath(grp)) << ";" << "\n" - << "\t\t" << "};" << "\n"; + QString grp("Products"), key = keyFor(grp); + project->values("QMAKE_PBX_GROUPS").append(key + " /* " + grp + " */"); + PBXGroupList << "\t\t" + key + " = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXGroup", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("children", project->values("QMAKE_PBX_PRODUCTS"), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", "Products") + ";" + "\n" + + "\t\t\t" + writeSettings("sourceTree", "") + ";" + "\n" + + "\t\t" + "};" + "\n"; } - { //INSTALL BUILDPHASE (copy) + + + //INSTALL BUILDPHASE (copy) + { QString phase_key = keyFor("QMAKE_PBX_TARGET_COPY_PHASE"); QString destDir = Option::output_dir; if (!project->isEmpty("QMAKE_ORIG_DESTDIR")) destDir = project->first("QMAKE_ORIG_DESTDIR"); destDir = fixForOutput(destDir); destDir = fileInfo(Option::fixPathToLocalOS(destDir)).absoluteFilePath(); - project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key); - t << "\t\t" << phase_key << " = {\n" - << "\t\t\t" << writeSettings("name", "Project Copy") << ";" << "\n" - << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("dstPath", escapeFilePath(destDir)) << ";" << "\n" - << "\t\t\t" << writeSettings("dstSubfolderSpec", "0", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("files", keyFor("QMAKE_PBX_TARGET_COPY_FILE"), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "};\n" - << "\t\t" << keyFor("QMAKE_PBX_TARGET_COPY_FILE") << " = {\n" - << "\t\t\t" << writeSettings("fileRef", keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")) << ";" << "\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_PRESCRIPT_BUILDPHASES").append(phase_key + " /* Project Copy */"); + + PBXCopyFilesBuildPhaseList << "\t\t" + phase_key + " /* Project Copy */ = {\n" + + "\t\t\t" + writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("buildActionMask", "2147483647", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("dstPath", escapeFilePath(destDir)) + ";" + "\n" + + "\t\t\t" + writeSettings("dstSubfolderSpec", "0", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("files", QStringList( keyFor("QMAKE_PBX_TARGET_COPY_FILE") ), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", "Project Copy") + ";" + "\n" + + "\t\t\t" + writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) + ";" + "\n" + + "\t\t" + "};\n"; + + PBXBuildFileList << "\t\t" + keyFor("QMAKE_PBX_TARGET_COPY_FILE") + " /* " + project->first("QMAKE_ORIG_TARGET") + " */ = { " + + "" + writeSettings("isa", "PBXBuildFile", SettingsNoQuote) + ";" + " " + + "" + writeSettings("fileRef", keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")) + ";" + " " + //+ "" + "settings = { " + //+ "" + "}; " + + "" + "};\n"; + } + //BUNDLE_DATA BUILDPHASE (copy) if(!project->isEmpty("QMAKE_BUNDLE_DATA")) { QStringList bundle_file_refs; @@ -1049,20 +1105,22 @@ ProjectBuilderMakefileGenerator::writeMa for(int file = 0; file < files.count(); file++) { QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE_REF." + bundle_data[i] + "-" + files[file]); 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(files[file])) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", QString::number(reftypeForFile(files[file])), SettingsNoQuote) << ";" << "\n" - << "\t\t" << "};" << "\n"; + PBXFileReferenceList << "\t\t" + file_ref_key + " = {" + " " + + "" + writeSettings("isa", "PBXFileReference", SettingsNoQuote) + ";" + " " + + "" + writeSettings("path", escapeFilePath(files[file])) + ";" + " " + + "" + writeSettings("sourceTree", "") + ";" + " " + + "" + "};" + "\n"; + QString copy_file_key = keyFor("QMAKE_PBX_BUNDLE_COPY_FILE." + bundle_data[i] + "-" + files[file]); pbx_files += copy_file_key; - 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"; + PBXBuildFileList << "\t\t" + copy_file_key + " = { " + + "" + writeSettings("fileRef", file_ref_key) + ";" + " " + + "" + writeSettings("isa", "PBXBuildFile", SettingsNoQuote) + ";" + " " + + "" + "settings = { " + + "" + "}" + ";" + " " + + "" + "}" + ";" + "\n"; } + //the phase QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]); QString path; @@ -1070,45 +1128,79 @@ ProjectBuilderMakefileGenerator::writeMa //### } path += project->first(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" - << "\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("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "}" << ";" << "\n"; + project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").append(phase_key + " /* Bundle Copy [" + bundle_data[i] + "] */"); + PBXCopyFilesBuildPhaseList << "\t\t" + phase_key + " = {\n" + + "\t\t\t" + writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) + ";" + "\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 | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", "Bundle Copy [" + bundle_data[i] + "]") + ";" + "\n" + + "\t\t\t" + writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) + ";" + "\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" - << "\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", QStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "};" << "\n"; + project->values("QMAKE_PBX_GROUPS").append(bundle_copy_key + " /* Source [bundle data] */"); + PBXGroupList << "\t\t" + bundle_copy_key + " = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXGroup", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("children", bundle_file_refs, SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", "Source [bundle data]") + ";" + "\n" + + "\t\t\t" + writeSettings("sourceTree", "") + ";" + "\n" + + "\t\t" + "};" + "\n"; + } + + // PBXFrameworksBuildPhaseList; + { + QString grp("Frameworks & Libraries"), key = keyFor(grp); + project->values("QMAKE_PBX_BUILDPHASES").append(key + " /* " + grp + " */"); + PBXFrameworksBuildPhaseList << "\t\t" + key + " = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXFrameworksBuildPhase", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("buildActionMask", "2147483647", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("files", project->values("QMAKE_PBX_BUILD_LIBRARIES"), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", escapeFilePath(grp)) + ";" + "\n" + + "\t\t\t" + writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) + ";" + "\n" + + "\t\t" + "};" + "\n"; + } + + // Bundle Resources Build Phase work. + 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 + " /* " + grp + " */"); + PBXResourcesBuildPhaseList << "\t\t" + key + " /* " + grp + " */ = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("buildActionMask", "2147483647", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + "files = (" + "\n"; + if(!project->isEmpty("ICON")) { + QString icon = project->first("ICON"); + if(icon.length() >= 2 && (icon[0] == '"' || icon[0] == '\'') && icon[(int)icon.length()-1] == icon[0]) + icon = icon.mid(1, icon.length()-2); + PBXResourcesBuildPhaseList.last().append( "\t\t\t\t" + keyFor(icon + ".BUILDABLE") + " /* " + icon + " */,\n" ); + + } + PBXResourcesBuildPhaseList.last().append( "\t\t\t);\n"); + PBXResourcesBuildPhaseList.last().append( "\t\t\t" + writeSettings("name", escapeFilePath(grp)) + ";" + "\n"); + PBXResourcesBuildPhaseList.last().append( "\t\t\t" + writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) + ";" + "\n"); + PBXResourcesBuildPhaseList.last().append( "\t\t};\n"); } if(/*pbVersion >= 38 &&*/ !project->isEmpty("QMAKE_PBX_PRESCRIPT_BUILDPHASES") && 0) { // build reference - t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPT_BUILDREFERENCE") << " = {" << "\n" - << "\t\t\t" << writeSettings("includeInIndex", "0") << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXFileReference", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("path", "preprocessor.out") << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "3", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "};" << "\n"; - project->values("QMAKE_PBX_PRODUCTS").append(keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE")); + PBXFileReferenceList << "\t\t" + keyFor("QMAKE_PBX_PRESCRIPT_BUILDREFERENCE") + " = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXFileReference", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("includeInIndex", "0") + ";" + "\n" + + "\t\t\t" + writeSettings("path", "preprocessor.out") + ";" + "\n" + + "\t\t\t" + writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) + ";" + "\n" + + "\t\t" + "};" + "\n"; + project->values("QMAKE_PBX_PRODUCTS").append(keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE") + " /* Qt Prescript Build Phase */"); + //build phase t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE") << " = {" << "\n" - << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES"), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("buildRules", QStringList(), SettingsAsList, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES"), SettingsAsList | SettingsNoQuote, 4) << ";" << "\n" + //<< "\t\t\t" << writeSettings("buildRules", QStringList(), SettingsAsList | SettingsNoQuote, 4) << ";" << "\n" << "\t\t\t" << writeSettings("buildSettings", QStringList(), SettingsAsList, 4) << ";" << "\n" << "\t\t\t" << writeSettings("dependencies", QStringList(), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("name", "Qt Preprocessor Steps") << ";" << "\n" << "\t\t\t" << writeSettings("productName", "Qt Preprocessor Steps") << ";" << "\n" << "\t\t\t" << writeSettings("productReference", keyFor("QMAKE_PBX_PRESCRIPTS_BUILDREFERENCE")) << ";" << "\n"; @@ -1117,28 +1209,31 @@ ProjectBuilderMakefileGenerator::writeMa else t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.tool") << ";" << "\n"; t << "\t\t" << "};" << "\n"; + //dependency t << "\t\t" << keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY") << " = {" << "\n" << "\t\t\t" << writeSettings("isa", "PBXTargetDependency", SettingsNoQuote) << ";" << "\n" << "\t\t\t" << writeSettings("target", keyFor("QMAKE_PBX_PRESCRIPTS_BUILDPHASE")) << ";" << "\n" << "\t\t" << "};" << "\n"; - project->values("QMAKE_PBX_TARGET_DEPENDS").append(keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY")); + project->values("QMAKE_PBX_TARGET_DEPENDS").append(keyFor("QMAKE_PBX_PRESCRIPTS_DEPENDENCY") + " /* Qt Prescript Dependencies */"); project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES").clear(); //these are already consumed above - } + } //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", QStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "};" << "\n"; + PBXGroupList << "\t\t" + keyFor("QMAKE_PBX_ROOT_GROUP") + " = {" + "\n" + + "\t\t\t" + writeSettings("isa", "PBXGroup", SettingsNoQuote) + ";" + "\n" + + "\t\t\t" + writeSettings("children", project->values("QMAKE_PBX_GROUPS"), SettingsAsList | SettingsNoQuote, 4) + ";" + "\n" + + "\t\t\t" + writeSettings("name", escapeFilePath(project->first("QMAKE_ORIG_TARGET"))) + ";" + "\n" + + "\t\t\t" + writeSettings("path", QStringList()) + ";" + "\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"; + project->values("QMAKE_PBX_PRODUCTS").append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") + " /* Qt Reference */"); + PBXFileReferenceList << "\t\t" + keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") + " /* " + project->first("QMAKE_ORIG_TARGET") + " */ = {" + " " + + "" + writeSettings("isa", "PBXFileReference", SettingsNoQuote) + ";" + " " + + "" + writeSettings("includeInIndex", "0", SettingsNoQuote) + ";" + " "; if(project->first("TEMPLATE") == "app") { QString targ = project->first("QMAKE_ORIG_TARGET"); if(project->isActiveConfig("bundle") && !project->isEmpty("QMAKE_BUNDLE_EXTENSION")) { @@ -1146,18 +1241,18 @@ ProjectBuilderMakefileGenerator::writeMa targ = project->first("QMAKE_BUNDLE_NAME"); targ += project->first("QMAKE_BUNDLE_EXTENSION"); if(!project->isEmpty("QMAKE_PBX_BUNDLE_TYPE")) - t << "\t\t\t" << writeSettings("explicitFileType", project->first("QMAKE_PBX_BUNDLE_TYPE")) + ";" << "\n"; + PBXFileReferenceList.last() + "" + writeSettings("explicitFileType", project->first("QMAKE_PBX_BUNDLE_TYPE")) + ";" + " "; } else if(project->isActiveConfig("app_bundle")) { if(!project->isEmpty("QMAKE_APPLICATION_BUNDLE_NAME")) targ = project->first("QMAKE_APPLICATION_BUNDLE_NAME"); targ += ".app"; - t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.application") << ";" << "\n"; + PBXFileReferenceList.last().append( "" + writeSettings("explicitFileType", "wrapper.application") + ";" + " "); } else { - t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.executable") << ";" << "\n"; + PBXFileReferenceList.last().append( "" + writeSettings("explicitFileType", "wrapper.executable") + ";" + " "); } QString app = (!project->isEmpty("DESTDIR") ? project->first("DESTDIR") + project->first("QMAKE_ORIG_TARGET") : - qmake_getpwd()) + Option::dir_sep + targ; - t << "\t\t\t" << writeSettings("path", escapeFilePath(targ)) << ";" << "\n"; + qmake_getpwd()) + Option::dir_sep + targ; + PBXFileReferenceList.last().append( "" + writeSettings("path", escapeFilePath(targ)) + ";" + " "); } else { QString lib = project->first("QMAKE_ORIG_TARGET"); if(project->isActiveConfig("staticlib")) { @@ -1176,49 +1271,442 @@ ProjectBuilderMakefileGenerator::writeMa lib = project->first("QMAKE_BUNDLE_NAME"); lib += project->first("QMAKE_BUNDLE_EXTENSION"); if(!project->isEmpty("QMAKE_PBX_BUNDLE_TYPE")) - t << "\t\t\t" << writeSettings("explicitFileType", project->first("QMAKE_PBX_BUNDLE_TYPE")) << ";" << "\n"; + PBXFileReferenceList.last().append( "" + writeSettings("explicitFileType", project->first("QMAKE_PBX_BUNDLE_TYPE")) + ";" + " "); } 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"; - t << "\t\t\t" << writeSettings("explicitFileType", "wrapper.framework") << ";" << "\n"; + PBXFileReferenceList.last().append( "" + writeSettings("explicitFileType", "wrapper.framework") + ";" + " "); } else { - t << "\t\t\t" << writeSettings("explicitFileType", "compiled.mach-o.dylib") << ";" << "\n"; + PBXFileReferenceList.last().append( "" + writeSettings("explicitFileType", "compiled.mach-o.dylib") + ";" + " "); } - t << "\t\t\t" << writeSettings("path", escapeFilePath(lib)) << ";" << "\n"; + PBXFileReferenceList.last().append( "" + writeSettings("path", escapeFilePath(lib)) + ";" + " "); } - t << "\t\t\t" << writeSettings("refType", "3", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) << ";" << "\n" - << "\t\t" << "};" << "\n"; - { //Products group - QString grp("Products"), key = keyFor(grp); - project->values("QMAKE_PBX_GROUPS").append(key); - 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" - << "\t\t\t" << writeSettings("refType", "4", SettingsNoQuote) << ";" << "\n" + PBXFileReferenceList.last().append( "" + writeSettings("sourceTree", "BUILT_PRODUCTS_DIR", SettingsNoQuote) + ";" + " " + + "" + "};" + "\n"); + + QStringList::const_iterator listIt; + // Now that everything for the sources and frameworks and resources have been evaluated + // and placed into their own streams we can now construct the file. + //HEADER + t << "// !$*UTF8*$!" << "\n" + << "{" << "\n" + << "\t" << writeSettings("archiveVersion", "1", SettingsNoQuote) << ";" << "\n" + << "\t" << "classes = {" << "\n" << "\t" << "};" << "\n" + << "\t" << writeSettings("objectVersion", QString::number(pbVersion), SettingsNoQuote) << ";" << "\n" + << "\t" << "objects = {" << endl << endl; + + /****************************************** + + PBXBuildFile Section. + + ******************************************/ + t << "/* Begin PBXBuildFile section */" << "\n"; + PBXBuildFileList.sort(); + for( listIt = PBXBuildFileList.constBegin(); listIt != PBXBuildFileList.constEnd(); ++listIt ) + t << (*listIt).toLocal8Bit().constData(); + t << "/* End PBXBuildFile section */" << "\n\n"; + + /****************************************** + + PBXCopyFilesBuildPhase Section. + + ******************************************/ + t << "/* Begin PBXCopyFilesBuildPhase section */" << "\n"; + for( listIt = PBXCopyFilesBuildPhaseList.constBegin(); listIt != PBXCopyFilesBuildPhaseList.constEnd(); ++listIt ) + t << (*listIt).toLocal8Bit().constData(); + t << "/* End PBXCopyFilesBuildPhase section */" << "\n\n"; + + /****************************************** + + PBXFileReferenceBuildPhase Section. + + ******************************************/ + t << "/* Begin PBXFileReference section */" << "\n"; + PBXFileReferenceList.sort(); + for( listIt = PBXFileReferenceList.constBegin(); listIt != PBXFileReferenceList.constEnd(); ++listIt ) + t << (*listIt).toLocal8Bit().constData(); + t << "/* End PBXFileReference section */" << "\n\n"; + + /****************************************** + + PBXFrameworksBuildPhase Section. + + ******************************************/ + t << "/* Begin PBXFrameworksBuildPhase section */" << "\n"; + for( listIt = PBXFrameworksBuildPhaseList.constBegin(); listIt != PBXFrameworksBuildPhaseList.constEnd(); ++listIt ) + t << (*listIt).toLocal8Bit().constData(); + t << "/* End PBXFrameworksBuildPhase section */" << "\n\n"; + + /****************************************** + + PBXGroup Section. + + ******************************************/ + PBXGroupList.sort(); + t << "/* Begin PBXGroup section */" << "\n"; + for( listIt = PBXGroupList.constBegin(); listIt != PBXGroupList.constEnd(); ++listIt ) + t << (*listIt).toLocal8Bit().constData(); + t << "/* End PBXGroup section */" << "\n\n"; + + /****************************************** + + PBXNativeTarget Section. + + ******************************************/ + + { + + t << "/* Begin PBXNativeTarget section */\n"; + QString target_key = keyFor(pbx_dir + "QMAKE_PBX_TARGET"); + project->values("QMAKE_PBX_TARGETS").append(target_key); + t << "\t\t" << target_key << " /* " << escapeFilePath(project->first("QMAKE_ORIG_TARGET")) << " */ = {" << "\n"; + if(pbVersion >= 38) + t << "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";" << "\n"; + + t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_NATIVE_TARGET_CONFIG_LIST"), SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("buildPhases", project->values("QMAKE_PBX_PRESCRIPT_BUILDPHASES") + project->values("QMAKE_PBX_BUILDPHASES"), SettingsAsList | SettingsNoQuote, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("buildRules", QStringList(), SettingsAsList, 4) << ";" << "\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"; + + if(project->first("TEMPLATE") == "app") { + 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"; + if(!project->isActiveConfig("app_bundle")) { + if(pbVersion >= 38) { + 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"; + } else { + t << "\t\t\t" << writeSettings("isa", "PBXToolTarget", SettingsNoQuote) << ";" << "\n"; + } + } else { + if(pbVersion >= 38) { + 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.application") << ";" << "\n"; + } else { + t << "\t\t\t" << writeSettings("isa", "PBXApplicationTarget", SettingsNoQuote) << ";" << "\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 { + QString lib = project->first("QMAKE_ORIG_TARGET"); + if(!project->isActiveConfig("lib_bundle") && !project->isActiveConfig("staticlib")) + lib.prepend("lib"); + t << "\t\t\t" << writeSettings("name", escapeFilePath(lib)) << ";" << "\n" + << "\t\t\t" << writeSettings("productName", escapeFilePath(lib)) << ";" << "\n"; + if(pbVersion >= 38) { + if(!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) + t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; + else if(project->isActiveConfig("staticlib")) + t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.library.static") << ";" << "\n"; + else if(project->isActiveConfig("lib_bundle")) + t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.framework") << ";" << "\n"; + else + t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.library.dynamic") << ";" << "\n"; + } else { + t << "\t\t\t" << writeSettings("isa", "PBXLibraryTarget", SettingsNoQuote) << ";" << "\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"; + t << "/* End PBXNativeTarget section */\n\n"; + } + + /****************************************** + + PBXProject Section. + + ******************************************/ + + { + t << "/* Begin PBXProject section */\n"; + t << "\t\t" << keyFor("QMAKE_PBX_ROOT") << " = {" << "\n" + << "\t\t\t" << writeSettings("isa", "PBXProject", SettingsNoQuote) << ";" << "\n"; + if(pbVersion >= 42) + t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST")) << ";" << "\n"; + t << "\t\t\t" << writeSettings("compatibilityVersion", "Xcode 2.4") << ";" << "\n" + << "\t\t\t" << writeSettings("developmentRegion", "English", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("hasScannedForEncodings", "1", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("knownRegions", QStringList("en"), SettingsAsList | SettingsNoQuote, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("mainGroup", keyFor("QMAKE_PBX_ROOT_GROUP")) << ";" << "\n" + << "\t\t\t" << writeSettings("projectDirPath", QStringList()) << ";" << "\n" + << "\t\t\t" << writeSettings("projectRoot", QStringList()) << ";" << "\n" + << "\t\t\t" << writeSettings("targets", project->values("QMAKE_PBX_TARGETS"), SettingsAsList | SettingsNoQuote, 4) << ";" << "\n" + << "\t\t" << "};" << "\n"; + t << "/* End PBXProject section */\n\n"; + } + + /****************************************** + + PBXResourcesBuildPhase Section. + + ******************************************/ + t << "/* Begin PBXResourcesBuildPhase section */" << "\n"; + for( listIt = PBXResourcesBuildPhaseList.constBegin(); listIt != PBXResourcesBuildPhaseList.constEnd(); ++listIt ) + t << (*listIt).toLocal8Bit().constData(); + t << "/* End PBXResourcesBuildPhase section */" << "\n\n"; + + /****************************************** + + PBXShellScriptBuildPhase Section. + + ******************************************/ + t << "/* Begin PBXShellScriptBuildPhase section */\n"; + PBXShellScriptBuildPhaseList.sort(); + for( listIt = PBXShellScriptBuildPhaseList.constBegin(); listIt != PBXShellScriptBuildPhaseList.constEnd(); ++listIt ) + t << (*listIt).toLocal8Bit().constData(); + t << "/* End PBXShellScriptBuildPhase section */\n\n"; + + /****************************************** + + PBXSourcesBuildPhase Section. + + ******************************************/ + t << "/* Begin PBXSourcesBuildPhase section */\n"; + for( listIt = PBXSourcesBuildPhaseList.constBegin(); listIt != PBXSourcesBuildPhaseList.constEnd(); ++listIt ) + t << (*listIt).toLocal8Bit().constData(); + t << "/* End PBXSourcesBuildPhase section */\n\n"; + + /****************************************** + + XCBuildConfiguration Section. + + ******************************************/ + QString active_buildstyle; + { + // Project build configs. + t << "/* Begin XCBuildConfiguration section */\n"; + + for(int as_release = 0; as_release < 2; as_release++) + { + QMap settings; + settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO")); + settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES"); + if(!as_release) + settings.insert("GCC_OPTIMIZATION_LEVEL", "0"); + if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK")) + settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK")); + { + const QStringList &l = project->values("QMAKE_MAC_XCODE_SETTINGS"); + for(int i = 0; i < l.size(); ++i) { + QString name = l.at(i); + const QString value = project->values(name + QLatin1String(".value")).join(QString(Option::field_sep)); + if(!project->isEmpty(name + QLatin1String(".name"))) + name = project->values(name + QLatin1String(".name")).first(); + settings.insert(name, value); + } + } + + QString name; + if(pbVersion >= 42) + name = (as_release ? "Release" : "Debug"); + else + name = (as_release ? "Deployment" : "Development"); + if(pbVersion >= 42) { + QString key = keyFor("QMAKE_PBX_BUILDCONFIG_" + name); + project->values("QMAKE_PBX_BUILDCONFIGS").append(key); + t << "\t\t" << key << " = {" << "\n" + << "\t\t\t" << writeSettings("isa", "XCBuildConfiguration", SettingsNoQuote) << ";" << "\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("name", name) << ";" << "\n" + << "\t\t" << "};" << "\n"; + } + + + QString key = keyFor("QMAKE_PBX_BUILDSTYLE_" + name); + if(project->isActiveConfig("debug") != (bool)as_release) { + project->values("QMAKE_PBX_BUILDSTYLES").append(key); + active_buildstyle = name; + } else if(pbVersion >= 42) { + project->values("QMAKE_PBX_BUILDSTYLES").append(key); + } + } + + // Native Target build configs. + for(int as_release = 0; as_release < 2; as_release++) + { + QMap settings; + settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO")); + settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES"); + if(!as_release) + settings.insert("GCC_OPTIMIZATION_LEVEL", "0"); + if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK")) + settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK")); + { + const QStringList &l = project->values("QMAKE_MAC_XCODE_SETTINGS"); + for(int i = 0; i < l.size(); ++i) { + QString name = l.at(i); + const QString value = project->values(name + QLatin1String(".value")).join(QString(Option::field_sep)); + if(!project->isEmpty(name + QLatin1String(".name"))) + name = project->values(name + QLatin1String(".name")).first(); + settings.insert(name, value); + } + } + + QString name; + if(pbVersion >= 42) + name = (as_release ? "Release" : "Debug"); + else + name = (as_release ? "Deployment" : "Development"); + if(pbVersion >= 42) { + QString key = keyFor("QMAKE_PBX_NATIVE_TARGET_CONFIG_" + name); + project->values("QMAKE_PBX_NATIVE_TARGET_CONFIG_LIST").append(key); + t << "\t\t" << key << " = {" << "\n" + << "\t\t\t" << writeSettings("isa", "XCBuildConfiguration", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << "buildSettings = {" << "\n" + << writeTargetBuildSettings(pbVersion, settings) + << "\t\t\t" << "};" << "\n" + << "\t\t\t" << writeSettings("name", name) << ";" << "\n" + << "\t\t" << "};" << "\n"; + } + + + QString key = keyFor("QMAKE_PBX_NATIVE_TARGET_BUILDSTYLE_" + name); + if(project->isActiveConfig("debug") != (bool)as_release) { + project->values("QMAKE_PBX_NATIVE_TARGET_BUILDSTYLES").append(key); + active_buildstyle = name; + } else if(pbVersion >= 42) { + project->values("QMAKE_PBX_NATIVE_TARGET_BUILDSTYLES").append(key); + } + } + t << "/* End XCBuildConfiguration section */\n\n"; + } + + /****************************************** + + XCConfigurationList Section. + + ******************************************/ + if(pbVersion >= 42) { + t << "/* Begin XCConfigurationList section */\n"; + t << "\t\t" << keyFor("QMAKE_PBX_BUILDCONFIG_LIST") << " = {" << "\n" + << "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("buildConfigurations", project->values("QMAKE_PBX_BUILDCONFIGS"), SettingsAsList, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("defaultConfigurationIsName", active_buildstyle) << ";" << "\n" << "\t\t" << "};" << "\n"; + + /******************** + + + HEY CHANGE THE QMAKE_PBX_BUILDCONFIGS array. + + + *******************/ + t << "\t\t" << keyFor("QMAKE_PBX_NATIVE_TARGET_CONFIG_LIST") << " = {" << "\n" + << "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("buildConfigurations", project->values("QMAKE_PBX_NATIVE_TARGET_CONFIG_LIST"), SettingsAsList, 4) << ";" << "\n" + << "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";" << "\n" + << "\t\t\t" << writeSettings("defaultConfigurationIsName", active_buildstyle) << ";" << "\n" + << "\t\t" << "};" << "\n"; + + t << "/* End XCConfigurationList section */\n\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"; + + //ROOT + t << "\t" << "};" << "\n" + << "\t" << writeSettings("rootObject", keyFor("QMAKE_PBX_ROOT")) << ";" << "\n" + << "}" << endl; + + if(project->isActiveConfig("generate_pbxbuild_makefile")) { + QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), + qmake_getpwd()); + QFile mkwrapf(mkwrap); + if(mkwrapf.open(QIODevice::WriteOnly | QIODevice::Text)) { + writingUnixMakefileGenerator = true; + debug_msg(1, "pbuilder: Creating file: %s", mkwrap.toLatin1().constData()); + QTextStream mkwrapt(&mkwrapf); + writeHeader(mkwrapt); + const char cleans[] = "preprocess_clean "; + mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n" + << "all:" << "\n\t" + << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << "\n" + << "install: all" << "\n\t" + << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " install\n" + << "distclean clean: preprocess_clean" << "\n\t" + << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " clean" << "\n" + << (!did_preprocess ? cleans : "") << ":" << "\n"; + if(did_preprocess) + mkwrapt << cleans << ":" << "\n\t" + << "make -f " + << pbx_dir << Option::dir_sep << "qt_preprocess.mak $@" << endl; + writingUnixMakefileGenerator = false; + } + } + return true; +} + +QString +ProjectBuilderMakefileGenerator::writeTargetBuildSettings(int pbVersion, QMap& additionalSettings) +{ + QStringList buildSettingsList; QString cCompiler = project->first("QMAKE_CC"); if (!cCompiler.isEmpty()) { - t << "\t\t\t\t" << writeSettings("CC", fixForOutput(findProgram(cCompiler))) << ";" << "\n"; + buildSettingsList << "\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"; + buildSettingsList << "\t\t\t\t" + writeSettings("CPLUSPLUS", fixForOutput(findProgram(cCompiler))) + ";" + "\n"; } - t << "\t\t\t\t" << writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + QStringList(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("OPTIMIZATION_CFLAGS", QStringList(), SettingsAsList, 5) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("HEADER_SEARCH_PATHS", fixListForOutput("INCLUDEPATH") + QStringList(fixForOutput(specdir())), SettingsAsList, 5) + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("LIBRARY_SEARCH_PATHS", fixListForOutput("QMAKE_PBX_LIBPATHS"), SettingsAsList, 5) + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("OPTIMIZATION_CFLAGS", QStringList(), SettingsAsList, 5) + ";" + "\n"; { QStringList cflags = fixListForOutput("QMAKE_CFLAGS"); const QStringList &prl_defines = project->values("PRL_EXPORT_DEFINES"); @@ -1227,7 +1715,7 @@ ProjectBuilderMakefileGenerator::writeMa const QStringList &defines = project->values("DEFINES"); for(int i = 0; i < defines.size(); ++i) cflags += "-D" + defines.at(i); - t << "\t\t\t\t" << writeSettings("OTHER_CFLAGS", cflags, SettingsAsList, 5) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("OTHER_CFLAGS", cflags, SettingsAsList, 5) + ";" + "\n"; } { QStringList cxxflags = fixListForOutput("QMAKE_CXXFLAGS"); @@ -1237,26 +1725,26 @@ ProjectBuilderMakefileGenerator::writeMa const QStringList &defines = project->values("DEFINES"); for(int i = 0; i < defines.size(); ++i) cxxflags += "-D" + defines.at(i); - t << "\t\t\t\t" << writeSettings("OTHER_CPLUSPLUSFLAGS", cxxflags, SettingsAsList, 5) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("OTHER_CPLUSPLUSFLAGS", cxxflags, SettingsAsList, 5) + ";" + "\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", QStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("SECTORDER_FLAGS", QStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("WARNING_CFLAGS", QStringList()) << ";" << "\n" - << "\t\t\t\t" << writeSettings("PREBINDING", QStringList((project->isEmpty("QMAKE_DO_PREBINDING") ? "NO" : "YES")), SettingsNoQuote) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("LEXFLAGS", fixListForOutput("QMAKE_LEXFLAGS")) + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("YACCFLAGS", fixListForOutput("QMAKE_YACCFLAGS")) + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("OTHER_REZFLAGS", QStringList()) + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("SECTORDER_FLAGS", QStringList()) + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("WARNING_CFLAGS", QStringList()) + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("PREBINDING", QStringList((project->isEmpty("QMAKE_DO_PREBINDING") ? "NO" : "YES")), SettingsNoQuote) + ";" + "\n"; if(!project->isEmpty("PRECOMPILED_HEADER")) { if(pbVersion >= 38) { - 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"; + buildSettingsList << "\t\t\t\t" + writeSettings("GCC_PRECOMPILE_PREFIX_HEADER", "YES") + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("GCC_PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) + ";" + "\n"; } else { - t << "\t\t\t\t" << writeSettings("PRECOMPILE_PREFIX_HEADER", "YES") << ";" << "\n" - << "\t\t\t\t" << writeSettings("PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("PRECOMPILE_PREFIX_HEADER", "YES") + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("PREFIX_HEADER", escapeFilePath(project->first("PRECOMPILED_HEADER"))) + ";" + "\n"; } } if((project->first("TEMPLATE") == "app" && project->isActiveConfig("app_bundle")) || - (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && - project->isActiveConfig("lib_bundle"))) { + (project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") && + project->isActiveConfig("lib_bundle"))) { QString plist = fileFixify(project->first("QMAKE_INFO_PLIST")); if(plist.isEmpty()) plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE"); @@ -1266,70 +1754,75 @@ ProjectBuilderMakefileGenerator::writeMa 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").section(Option::dir_sep, -1))); + (project->isEmpty("ICON") ? QString("") : project->first("ICON").section(Option::dir_sep, -1))); if(project->first("TEMPLATE") == "app") { + plist_in_text = plist_in_text.replace("@DISPLAY_NAME@", project->first("QMAKE_MACX_DISPLAY_NAME")); plist_in_text = plist_in_text.replace("@EXECUTABLE@", project->first("QMAKE_ORIG_TARGET")); + plist_in_text = plist_in_text.replace("@DOMAIN@", project->first("QMAKE_MACX_DOMAIN")); + plist_in_text = plist_in_text.replace("@COMPANY@", project->first("QMAKE_MACX_COMPANY")); + plist_in_text = plist_in_text.replace("@VERSION@", project->first("VERSION")); + plist_in_text = plist_in_text.replace("@GET_INFO@", project->first("QMAKE_MACX_GET_INFO")); } else { plist_in_text = plist_in_text.replace("@LIBRARY@", project->first("QMAKE_ORIG_TARGET")); 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))); + (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : + project->first("QMAKE_PKGINFO_TYPEINFO").left(4))); 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"; + buildSettingsList << "\t\t\t\t" + writeSettings("INFOPLIST_FILE", "Info.plist") + ";" + "\n"; } } } } #if 1 - t << "\t\t\t\t" << writeSettings("BUILD_ROOT", escapeFilePath(qmake_getpwd())) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("BUILD_ROOT", escapeFilePath(qmake_getpwd())) + ";" + "\n"; #endif if(!project->isActiveConfig("staticlib")) { - t << "\t\t\t\t" << writeSettings("OTHER_LDFLAGS", + buildSettingsList << "\t\t\t\t" + writeSettings("OTHER_LDFLAGS", fixListForOutput("SUBLIBS") + fixListForOutput("QMAKE_LFLAGS") + fixListForOutput("QMAKE_LIBDIR_FLAGS") + fixListForOutput("QMAKE_FRAMEWORKPATH_FLAGS") + fixListForOutput("QMAKE_LIBS"), - SettingsAsList, 6) << ";" << "\n"; + SettingsAsList, 5) + ";" + "\n"; } if(!project->isEmpty("DESTDIR")) { QString dir = project->first("DESTDIR"); if (QDir::isRelativePath(dir)) dir.prepend(qmake_getpwd() + Option::dir_sep); - t << "\t\t\t\t" << writeSettings("INSTALL_DIR", dir) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("INSTALL_DIR", dir) + ";" + "\n"; } if (project->first("TEMPLATE") == "lib") { - t << "\t\t\t\t" << writeSettings("INSTALL_PATH", QStringList()) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("INSTALL_PATH", QStringList()) + ";" + "\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"; + buildSettingsList << "\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"; + buildSettingsList << "\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"; + project->isActiveConfig("lib_bundle")) + buildSettingsList << "\t\t\t\t" + writeSettings("FRAMEWORK_VERSION", project->first("QMAKE_FRAMEWORK_VERSION")) + ";" + "\n"; } if(!project->isEmpty("COMPAT_FRAMEWORKPATH")) - t << "\t\t\t\t" << writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), SettingsAsList, 5) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("FRAMEWORK_SEARCH_PATHS", fixListForOutput("QMAKE_FRAMEWORKPATH"), SettingsAsList, 5) + ";" + "\n"; if(!project->isEmpty("COMPAT_VERSION")) - t << "\t\t\t\t" << writeSettings("DYLIB_COMPATIBILITY_VERSION", project->first("COMPAT_VERSION")) << ";" << "\n"; + buildSettingsList << "\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"; + buildSettingsList << "\t\t\t\t" + writeSettings("MACOSX_DEPLOYMENT_TARGET", project->first("QMAKE_MACOSX_DEPLOYMENT_TARGET")) + ";" + "\n"; if(pbVersion >= 38) { if(!project->isEmpty("OBJECTS_DIR")) - t << "\t\t\t\t" << writeSettings("OBJROOT", fixForOutput(project->first("OBJECTS_DIR"))) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("OBJROOT", fixForOutput(project->first("OBJECTS_DIR"))) + ";" + "\n"; } #if 0 if(!project->isEmpty("DESTDIR")) - t << "\t\t\t\t" << writeSettings("SYMROOT", fixForOutput(project->first("DESTDIR"))) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("SYMROOT", fixForOutput(project->first("DESTDIR"))) + ";" + "\n"; else - t << "\t\t\t\t" << writeSettings("SYMROOT", fixForOutput(qmake_getpwd())) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("SYMROOT", fixForOutput(qmake_getpwd())) + ";" + "\n"; #endif { QStringList archs; @@ -1351,232 +1844,42 @@ ProjectBuilderMakefileGenerator::writeMa archs += "x86_64"; } if(!archs.isEmpty()) - t << "\t\t\t\t" << writeSettings("ARCHS", archs) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("ARCHS", archs) + ";" + "\n"; } if(project->first("TEMPLATE") == "app") { if(pbVersion < 38 && project->isActiveConfig("app_bundle")) - t << "\t\t\t\t" << writeSettings("WRAPPER_SUFFIX", "app") << ";" << "\n"; - t << "\t\t\t\t" << writeSettings("PRODUCT_NAME", fixForOutput(project->first("QMAKE_ORIG_TARGET"))) << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("WRAPPER_SUFFIX", "app") + ";" + "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("PRODUCT_NAME", fixForOutput(project->first("QMAKE_ORIG_TARGET"))) + ";" + "\n"; } else { if(!project->isActiveConfig("plugin") && project->isActiveConfig("staticlib")) { - t << "\t\t\t\t" << writeSettings("LIBRARY_STYLE", "STATIC") << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("LIBRARY_STYLE", "STATIC") + ";" + "\n"; } else { - t << "\t\t\t\t" << writeSettings("LIBRARY_STYLE", "DYNAMIC") << ";" << "\n"; + buildSettingsList << "\t\t\t\t" + writeSettings("LIBRARY_STYLE", "DYNAMIC") + ";" + "\n"; } QString 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"; + buildSettingsList << "\t\t\t\t" + writeSettings("PRODUCT_NAME", escapeFilePath(lib)) + ";" + "\n"; } - tmp = project->values("QMAKE_PBX_VARS"); + QStringList tmp = project->values("QMAKE_PBX_VARS"); for(int i = 0; i < tmp.count(); i++) { QString var = tmp[i], val = qgetenv(var.toLatin1()); if(val.isEmpty() && var == "TB") val = "/usr/bin/"; - t << "\t\t\t\t" << writeSettings(var, escapeFilePath(val)) << ";" << "\n"; + buildSettingsList << "\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"; - if(pbVersion >= 38) - t << "\t\t\t" << writeSettings("isa", "PBXNativeTarget", SettingsNoQuote) << ";" << "\n"; - if(project->first("TEMPLATE") == "app") { - if(!project->isActiveConfig("app_bundle")) { - if(pbVersion >= 38) { - 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"; - } else { - t << "\t\t\t" << writeSettings("isa", "PBXToolTarget", SettingsNoQuote) << ";" << "\n"; - } - } else { - if(pbVersion >= 38) { - 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.application") << ";" << "\n"; - } else { - t << "\t\t\t" << writeSettings("isa", "PBXApplicationTarget", SettingsNoQuote) << ";" << "\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"; - } - 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"; - } else { - QString lib = project->first("QMAKE_ORIG_TARGET"); - if(!project->isActiveConfig("lib_bundle") && !project->isActiveConfig("staticlib")) - lib.prepend("lib"); - t << "\t\t\t" << writeSettings("name", escapeFilePath(lib)) << ";" << "\n" - << "\t\t\t" << writeSettings("productName", escapeFilePath(lib)) << ";" << "\n"; - if(pbVersion >= 38) { - if(!project->isEmpty("QMAKE_PBX_PRODUCT_TYPE")) - t << "\t\t\t" << writeSettings("productType", project->first("QMAKE_PBX_PRODUCT_TYPE")) << ";" << "\n"; - else if(project->isActiveConfig("staticlib")) - t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.library.static") << ";" << "\n"; - else if(project->isActiveConfig("lib_bundle")) - t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.framework") << ";" << "\n"; - else - t << "\t\t\t" << writeSettings("productType", "com.apple.product-type.library.dynamic") << ";" << "\n"; - } else { - t << "\t\t\t" << writeSettings("isa", "PBXLibraryTarget", SettingsNoQuote) << ";" << "\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; - for(int as_release = 0; as_release < 2; as_release++) - { - QMap settings; - settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO")); - settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES"); - if(!as_release) - settings.insert("GCC_OPTIMIZATION_LEVEL", "0"); - if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK")) - settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK")); - { - const QStringList &l = project->values("QMAKE_MAC_XCODE_SETTINGS"); - for(int i = 0; i < l.size(); ++i) { - QString name = l.at(i); - const QString value = project->values(name + QLatin1String(".value")).join(QString(Option::field_sep)); - if(!project->isEmpty(name + QLatin1String(".name"))) - name = project->values(name + QLatin1String(".name")).first(); - settings.insert(name, value); - } - } - QString name; - if(pbVersion >= 42) - name = (as_release ? "Release" : "Debug"); - else - name = (as_release ? "Deployment" : "Development"); - if(pbVersion >= 42) { - QString key = keyFor("QMAKE_PBX_BUILDCONFIG_" + name); - project->values("QMAKE_PBX_BUILDCONFIGS").append(key); - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("isa", "XCBuildConfiguration", SettingsNoQuote) << ";" << "\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("name", name) << ";" << "\n" - << "\t\t" << "};" << "\n"; - } - - QString key = keyFor("QMAKE_PBX_BUILDSTYLE_" + name); - if(project->isActiveConfig("debug") != (bool)as_release) { - project->values("QMAKE_PBX_BUILDSTYLES").append(key); - active_buildstyle = name; - } else if(pbVersion >= 42) { - project->values("QMAKE_PBX_BUILDSTYLES").append(key); - } - t << "\t\t" << key << " = {" << "\n" - << "\t\t\t" << writeSettings("buildRules", QStringList(), 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"; - } - if(pbVersion >= 42) { - t << "\t\t" << keyFor("QMAKE_PBX_BUILDCONFIG_LIST") << " = {" << "\n" - << "\t\t\t" << writeSettings("isa", "XCConfigurationList", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("buildConfigurations", project->values("QMAKE_PBX_BUILDCONFIGS"), SettingsAsList, 4) << ";" << "\n" - << "\t\t\t" << writeSettings("defaultConfigurationIsVisible", "0", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("defaultConfigurationIsName", active_buildstyle) << ";" << "\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("isa", "PBXProject", SettingsNoQuote) << ";" << "\n" - << "\t\t\t" << writeSettings("mainGroup", keyFor("QMAKE_PBX_ROOT_GROUP")) << ";" << "\n"; - if(pbVersion >= 42) - t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_PBX_BUILDCONFIG_LIST")) << ";" << "\n"; - t << "\t\t\t" << writeSettings("projectDirPath", QStringList()) << ";" << "\n" - << "\t\t\t" << writeSettings("targets", project->values("QMAKE_PBX_TARGETS"), SettingsAsList, 4) << ";" << "\n" - << "\t\t" << "};" << "\n"; + for(QMap::Iterator set_it = additionalSettings.begin(); set_it != additionalSettings.end(); ++set_it) + buildSettingsList << "\t\t\t\t" + writeSettings(set_it.key(), set_it.value()) + ";\n"; - //FOOTER - t << "\t" << "};" << "\n" - << "\t" << writeSettings("rootObject", keyFor("QMAKE_PBX_ROOT")) << ";" << "\n" - << "}" << endl; + QString outString; + buildSettingsList.sort(); + for(QStringList::const_iterator listIt = buildSettingsList.constBegin(); listIt != buildSettingsList.constEnd(); ++listIt) + outString += (*listIt).toLocal8Bit().constData(); + buildSettingsList.clear(); - if(project->isActiveConfig("generate_pbxbuild_makefile")) { - QString mkwrap = fileFixify(pbx_dir + Option::dir_sep + ".." + Option::dir_sep + project->first("MAKEFILE"), - qmake_getpwd()); - QFile mkwrapf(mkwrap); - if(mkwrapf.open(QIODevice::WriteOnly | QIODevice::Text)) { - writingUnixMakefileGenerator = true; - debug_msg(1, "pbuilder: Creating file: %s", mkwrap.toLatin1().constData()); - QTextStream mkwrapt(&mkwrapf); - writeHeader(mkwrapt); - const char cleans[] = "preprocess_clean "; - mkwrapt << "#This is a makefile wrapper for PROJECT BUILDER\n" - << "all:" << "\n\t" - << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << "\n" - << "install: all" << "\n\t" - << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " install\n" - << "distclean clean: preprocess_clean" << "\n\t" - << "cd " << project->first("QMAKE_ORIG_TARGET") << projectSuffix() << "/ && " << pbxbuild() << " clean" << "\n" - << (!did_preprocess ? cleans : "") << ":" << "\n"; - if(did_preprocess) - mkwrapt << cleans << ":" << "\n\t" - << "make -f " - << pbx_dir << Option::dir_sep << "qt_preprocess.mak $@" << endl; - writingUnixMakefileGenerator = false; - } - } - return true; + return outString; } QString @@ -1690,7 +1993,9 @@ ProjectBuilderMakefileGenerator::pbuilde #ifdef Q_OS_DARWIN ret = QLatin1String("34"); QCFType cfurl; - OSStatus err = LSFindApplicationForInfo(0, CFSTR("com.apple.Xcode"), 0, 0, &cfurl); + OSStatus err = LSFindApplicationForInfo(0, CFSTR("com.apple.dt.Xcode"), 0, 0, &cfurl); + if (err != noErr) + err = LSFindApplicationForInfo(0, CFSTR("com.apple.Xcode"), 0, 0, &cfurl ); if (err == noErr) { QCFType bundle = CFBundleCreate(0, cfurl); if (bundle) { @@ -1826,20 +2131,21 @@ ProjectBuilderMakefileGenerator::writeSe QString ret; const QString quote = (flags & SettingsNoQuote) ? "" : "\""; const QString escape_quote = quote.isEmpty() ? "" : "\\" + quote; - QString newline = "\n"; - for(int i = 0; i < indent_level; ++i) - newline += "\t"; + QString newline = (flags & SettingsNoNewline ) ? "" : "\n"; + if( !(flags & SettingsNoNewline) ){ + for(int i = 0; i < indent_level; ++i) + newline += "\t"; + } if(flags & SettingsAsList) { - ret += var + " = (" + newline; - for(int i = 0, count = 0; i < vals.size(); ++i) { + ret += var + " = (";// + newline; + for(int i = 0; i < vals.size(); ++i) { QString val = vals.at(i); if(!val.isEmpty()) { - if(count++ > 0) - ret += "," + newline; - ret += quote + val.replace(quote, escape_quote) + quote; + ret += newline + quote + val.replace(quote, escape_quote) + quote + ","; } } - ret += ")"; + newline.chop(1); // at the end of the line. need to remove one tab character to keep the proper alignment in the file. + ret += newline + ")"; } else { ret += var + " = " + quote; for(int i = 0; i < vals.size(); ++i) { diff -Npur qt-everywhere-opensource-src-4.7.2/qmake/generators/mac/pbuilder_pbx.h qt-xcode4-4.7.2/qmake/generators/mac/pbuilder_pbx.h --- qt-everywhere-opensource-src-4.7.2/qmake/generators/mac/pbuilder_pbx.h 2011-02-22 06:02:48.000000000 -0600 +++ qt-xcode4-4.7.2/qmake/generators/mac/pbuilder_pbx.h 2011-05-18 10:47:20.000000000 -0500 @@ -63,7 +63,7 @@ class ProjectBuilderMakefileGenerator : QStringList fixListForOutput(const QString &where); int reftypeForFile(const QString &where); QString projectSuffix() const; - enum { SettingsAsList=0x01, SettingsNoQuote=0x02 }; + enum { SettingsAsList=0x01, SettingsNoQuote=0x02, SettingsNoNewline=0x04 }; inline QString writeSettings(QString var, QString val, int flags=0, int indent_level=0) { Q_UNUSED(indent_level); return writeSettings(var, QStringList(val), flags); } QString writeSettings(QString var, QStringList vals, int flags=0, int indent_level=0); @@ -78,6 +78,7 @@ protected: virtual QString escapeFilePath(const QString &path) const; bool doPrecompiledHeaders() const { return false; } virtual bool doDepends() const { return false; } //never necesary + virtual QString writeTargetBuildSettings(int pbVersion, QMap& additionalSettings); }; inline ProjectBuilderMakefileGenerator::~ProjectBuilderMakefileGenerator()