summaryrefslogtreecommitdiff
path: root/qmake
Side-by-side diff
Diffstat (limited to 'qmake') (more/less context) (show whitespace changes)
-rw-r--r--qmake/generators/mac/pbuilder_pbx.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp
index 8525058..b46005b 100644
--- a/qmake/generators/mac/pbuilder_pbx.cpp
+++ b/qmake/generators/mac/pbuilder_pbx.cpp
@@ -153,385 +153,385 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
}
last_grp = new_grp;
}
groups[last_grp] += src_key;
in_root = FALSE;
}
}
if(in_root)
src_list.append(src_key);
//source reference
t << "\t\t" << src_key << " = {" << "\n"
<< "\t\t\t" << "isa = PBXFileReference;" << "\n"
<< "\t\t\t" << "path = \"" << file << "\";" << "\n"
<< "\t\t\t" << "refType = " << reftypeForFile(file) << ";" << "\n"
<< "\t\t" << "};" << "\n";
//build reference
QString obj_key = file + ".o";
obj_key = keyFor(obj_key);
t << "\t\t" << obj_key << " = {" << "\n"
<< "\t\t\t" << "fileRef = " << src_key << ";" << "\n"
<< "\t\t\t" << "isa = PBXBuildFile;" << "\n"
<< "\t\t\t" << "settings = {" << "\n"
<< "\t\t\t\t" << "ATTRIBUTES = (" << "\n"
<< "\t\t\t\t" << ");" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t" << "};" << "\n";
project->variables()["QMAKE_PBX_OBJ"].append(obj_key);
}
if(!src_list.isEmpty()) {
QString grp;
if(srcs[i] == "SOURCES") {
if(project->first("TEMPLATE") == "app" && !project->isEmpty("RC_FILE")) { //Icon
QString icns_file = keyFor("ICNS_FILE");
src_list.append(icns_file);
t << "\t\t" << icns_file << " = {" << "\n"
<< "\t\t\t" << "isa = PBXFileReference;" << "\n"
<< "\t\t\t" << "path = \"" << project->first("RC_FILE") << "\";" << "\n"
<< "\t\t\t" << "refType = " << reftypeForFile(project->first("RC_FILE")) << ";" << "\n"
<< "\t\t" << "};" << "\n";
t << "\t\t" << keyFor("ICNS_FILE_REFERENCE") << " = {" << "\n"
<< "\t\t\t" << "fileRef = " << icns_file << ";" << "\n"
<< "\t\t\t" << "isa = PBXBuildFile;" << "\n"
<< "\t\t\t" << "settings = {" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t" << "};" << "\n";
}
grp = "Sources";
} else if(srcs[i] == "SRCMOC") {
grp = "Mocables";
} else if(srcs[i] == "UICIMPLS") {
grp = "UICables";
}
QString grp_key = keyFor(grp);
project->variables()["QMAKE_PBX_GROUPS"].append(grp_key);
t << "\t\t" << grp_key << " = {" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< varGlue("QMAKE_PBX_" + srcs[i], "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "name = " << grp << ";" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
}
}
for(QMap<QString, QStringList>::Iterator grp_it = groups.begin();
grp_it != groups.end(); ++grp_it) {
t << "\t\t" << keyFor(grp_it.key()) << " = {" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< valGlue(grp_it.data(), "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "name = \"" << grp_it.key().section(Option::dir_sep, -1) << "\";" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
}
//PREPROCESS BUILDPHASE (just a makefile)
if(!project->isEmpty("UICIMPLS") || !project->isEmpty("SRCMOC") ||
!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES")) {
QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak";
QFile mkf(mkfile);
if(mkf.open(IO_WriteOnly | IO_Translate)) {
did_preprocess = TRUE;
debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1());
QTextStream mkt(&mkf);
writeHeader(mkt);
mkt << "MOC = " << var("QMAKE_MOC") << endl;
mkt << "UIC = " << var("QMAKE_UIC") << endl;
mkt << "LEX = " << var("QMAKE_LEX") << endl;
mkt << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl;
mkt << "YACC = " << var("QMAKE_YACC") << endl;
mkt << "YACCFLAGS = " << var("QMAKE_YACCFLAGS") << endl;
mkt << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
mkt << "MOVE = " << var("QMAKE_MOVE") << endl << endl;
mkt << "FORMS = " << varList("UICIMPLS") << endl;
mkt << "MOCS = " << varList("SRCMOC") << endl;
mkt << "PARSERS =";
if(!project->isEmpty("YACCSOURCES")) {
QStringList &yaccs = project->variables()["YACCSOURCES"];
for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) {
QFileInfo fi((*yit));
mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE)
<< Option::yacc_mod << Option::cpp_ext.first();
}
}
if(!project->isEmpty("LEXSOURCES")) {
QStringList &lexs = project->variables()["LEXSOURCES"];
for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) {
QFileInfo fi((*lit));
mkt << " " << fi.dirPath() << Option::dir_sep << fi.baseName(TRUE)
<< Option::lex_mod << Option::cpp_ext.first();
}
}
mkt << "\n";
mkt << "preprocess: $(FORMS) $(MOCS) $(PARSERS)" << endl;
mkt << "preprocess_clean: mocclean uiclean parser_clean" << endl << endl;
mkt << "mocclean:" << "\n";
if(!project->isEmpty("SRCMOC"))
mkt << "\t-rm -f $(MOCS)" << "\n";
mkt << "uiclean:" << "\n";
if(!project->isEmpty("UICIMPLS"))
mkt << "\t-rm -f $(FORMS)" << "\n";
mkt << "parser_clean:" << "\n";
if(!project->isEmpty("YACCSOURCES") || !project->isEmpty("LEXSOURCES"))
mkt << "\t-rm -f $(PARSERS)" << "\n";
writeUicSrc(mkt, "FORMS");
writeMocSrc(mkt, "HEADERS");
writeMocSrc(mkt, "SOURCES");
writeMocSrc(mkt, "UICDECLS");
writeYaccSrc(mkt, "YACCSOURCES");
writeLexSrc(mkt, "LEXSOURCES");
mkf.close();
}
QString target_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET");
mkfile = fileFixify(mkfile, QDir::currentDirPath());
t << "\t\t" << target_key << " = {" << "\n"
<< "\t\t\t" << "buildArgumentsString = \"-f " << mkfile << "\";" << "\n"
<< "\t\t\t" << "buildPhases = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "buildSettings = {" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t\t" << "buildToolPath = \"/usr/bin/gnumake\";"<< "\n"
<< "\t\t\t" << "buildWorkingDirectory = \"" << QDir::currentDirPath() << "\";" << "\n"
<< "\t\t\t" << "dependencies = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXLegacyTarget;" << "\n"
<< "\t\t\t" << "name = QtPreprocessors;" << "\n"
<< "\t\t\t" << "productName = QtPreprocessors;" << "\n"
<< "\t\t\t" << "settingsToExpand = 6;" << "\n"
<< "\t\t\t" << "settingsToPassInEnvironment = 287;" << "\n"
<< "\t\t\t" << "settingsToPassOnCommandLine = 280;" << "\n"
<< "\t\t\t" << "shouldsUseHeadermap = 0;" << "\n"
<< "\t\t" << "};" << "\n";
QString target_depend_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET_DEPEND");
project->variables()["QMAKE_PBX_TARGETDEPENDS"].append(target_depend_key);
t << "\t\t" << target_depend_key << " = {" << "\n"
<< "\t\t\t" << "isa = PBXTargetDependency;" << "\n"
<< "\t\t\t" << "target = " << target_key << ";" << "\n"
<< "\t\t" << "};" << "\n";
}
//SOURCE BUILDPHASE
if(!project->isEmpty("QMAKE_PBX_OBJ")) {
QString grp = "Build Sources", key = keyFor(grp);
project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< varGlue("QMAKE_PBX_OBJ", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXSourcesBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"" << grp << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES
QStringList &libdirs = project->variables()["QMAKE_PBX_LIBPATHS"];
QString libs[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
for(i = 0; !libs[i].isNull(); i++) {
tmp = project->variables()[libs[i]];
for(QStringList::Iterator it = tmp.begin(); it != tmp.end();) {
bool remove = FALSE;
QString library, name, opt = (*it).stripWhiteSpace();
if(opt.startsWith("-L")) {
QString r = opt.right(opt.length() - 2);
fixEnvVariables(r);
libdirs.append(r);
} else if(opt.startsWith("-l")) {
name = opt.right(opt.length() - 2);
QString lib("lib" + name);
for(QStringList::Iterator lit = libdirs.begin(); lit != libdirs.end(); ++lit) {
if(project->isActiveConfig("link_prl")) {
- /* This isn't real nice, but it is real usefull. This looks in a prl
+ /* This isn't real nice, but it is real useful. This looks in a prl
for what the library will ultimately be called so we can stick it
in the ProjectFile. If the prl format ever changes (not likely) then
this will not really work. However, more concerning is that it will
encode the version number in the Project file which might be a bad
things in days to come? --Sam
*/
QString prl_file = (*lit) + Option::dir_sep + lib + Option::prl_ext;
if(QFile::exists(prl_file)) {
QMakeProject proj;
if(proj.read(prl_file, QDir::currentDirPath())) {
if(!proj.isEmpty("QMAKE_PRL_TARGET")) {
library = (*lit) + Option::dir_sep + proj.first("QMAKE_PRL_TARGET");
debug_msg(1, "pbuilder: Found library (%s) via PRL %s (%s)",
opt.latin1(), prl_file.latin1(), library.latin1());
remove = TRUE;
}
}
}
}
if(!remove) {
QString extns[] = { ".dylib", ".so", ".a", QString::null };
for(int n = 0; !remove && !extns[n].isNull(); n++) {
QString tmp = (*lit) + Option::dir_sep + lib + extns[n];
if(QFile::exists(tmp)) {
library = tmp;
debug_msg(1, "pbuilder: Found library (%s) via %s",
opt.latin1(), library.latin1());
remove = TRUE;
}
}
}
}
} else if(opt == "-framework") {
++it;
if(it == tmp.end())
break;
QStringList &fdirs = project->variables()["QMAKE_FRAMEWORKDIR"];
if(fdirs.isEmpty())
fdirs.append("/System/Library/Frameworks/");
for(QStringList::Iterator fit = fdirs.begin(); fit != fdirs.end(); ++fit) {
if(QFile::exists((*fit) + QDir::separator() + (*it) + ".framework")) {
--it;
it = tmp.remove(it);
remove = TRUE;
library = (*fit) + Option::dir_sep + (*it) + ".framework";
break;
}
}
} else if(opt.left(1) != "-") {
remove = TRUE;
library = opt;
}
if(!library.isEmpty()) {
if(name.isEmpty()) {
int slsh = library.findRev(Option::dir_sep);
if(slsh != -1)
name = library.right(library.length() - slsh - 1);
}
library = fileFixify(library);
QString key = keyFor(library);
bool is_frmwrk = (library.endsWith(".framework"));
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "isa = " << (is_frmwrk ? "PBXFrameworkReference" : "PBXFileReference") << ";" << "\n"
<< "\t\t\t" << "name = \"" << name << "\";" << "\n"
<< "\t\t\t" << "path = \"" << library << "\";" << "\n"
<< "\t\t\t" << "refType = " << reftypeForFile(library) << ";" << "\n"
<< "\t\t" << "};" << "\n";
project->variables()["QMAKE_PBX_LIBRARIES"].append(key);
QString obj_key = library + ".o";
obj_key = keyFor(obj_key);
t << "\t\t" << obj_key << " = {" << "\n"
<< "\t\t\t" << "fileRef = " << key << ";" << "\n"
<< "\t\t\t" << "isa = PBXBuildFile;" << "\n"
<< "\t\t\t" << "settings = {" << "\n"
<< "\t\t\t" << "};" << "\n"
<< "\t\t" << "};" << "\n";
project->variables()["QMAKE_PBX_BUILD_LIBRARIES"].append(obj_key);
}
if(remove)
it = tmp.remove(it);
else
++it;
}
project->variables()[libs[i]] = tmp;
}
}
//SUBLIBS BUILDPHASE (just another makefile)
if(!project->isEmpty("SUBLIBS")) {
QString mkfile = pbx_dir + Option::dir_sep + "qt_sublibs.mak";
QFile mkf(mkfile);
if(mkf.open(IO_WriteOnly | IO_Translate)) {
debug_msg(1, "pbuilder: Creating file: %s", mkfile.latin1());
QTextStream mkt(&mkf);
writeHeader(mkt);
mkt << "SUBLIBS= ";
tmp = project->variables()["SUBLIBS"];
QStringList::Iterator it;
for(it = tmp.begin(); it != tmp.end(); ++it)
t << "tmp/lib" << (*it) << ".a ";
t << endl << endl;
mkt << "sublibs: $(SUBLIBS)" << endl << endl;
tmp = project->variables()["SUBLIBS"];
for(it = tmp.begin(); it != tmp.end(); ++it)
t << "tmp/lib" << (*it) << ".a" << ":\n\t"
<< var(QString("MAKELIB") + (*it)) << endl << endl;
mkf.close();
}
QString phase_key = keyFor("QMAKE_PBX_SUBLIBS_BUILDPHASE");
mkfile = fileFixify(mkfile, QDir::currentDirPath());
project->variables()["QMAKE_PBX_BUILDPHASES"].append(phase_key);
t << "\t\t" << phase_key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "generatedFileNames = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXShellScriptBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"Qt Sublibs\";" << "\n"
<< "\t\t\t" << "neededFileNames = (" << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "shellPath = /bin/sh;" << "\n"
<< "\t\t\t" << "shellScript = \"make -C " << QDir::currentDirPath() <<
" -f " << mkfile << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
//LIBRARY BUILDPHASE
if(!project->isEmpty("QMAKE_PBX_LIBRARIES")) {
tmp = project->variables()["QMAKE_PBX_LIBRARIES"];
if(!tmp.isEmpty()) {
QString grp("External Frameworks and Libraries"), key = keyFor(grp);
project->variables()["QMAKE_PBX_GROUPS"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< varGlue("QMAKE_PBX_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "name = \"" << grp << "\"" << ";" << "\n"
<< "\t\t\t" << "path = \"\";" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
}
}
{
QString grp("Frameworks & Libraries"), key = keyFor(grp);
project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< varGlue("QMAKE_PBX_BUILD_LIBRARIES", "\t\t\t\t", ",\n\t\t\t\t", "\n")
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXFrameworksBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"" << grp << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console") &&
project->first("TEMPLATE") == "app") { //BUNDLE RESOURCES
QString grp("Bundle Resources"), key = keyFor(grp);
project->variables()["QMAKE_PBX_BUILDPHASES"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "buildActionMask = 2147483647;" << "\n"
<< "\t\t\t" << "files = (" << "\n"
<< (!project->isEmpty("RC_FILE") ? keyFor("ICNS_FILE_REFERENCE") : QString(""))
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXResourcesBuildPhase;" << "\n"
<< "\t\t\t" << "name = \"" << grp << "\";" << "\n"
<< "\t\t" << "};" << "\n";
}
//DUMP EVERYTHING THAT TIES THE ABOVE TOGETHER
//PRODUCTS
{
QString grp("Products"), key = keyFor(grp);
project->variables()["QMAKE_PBX_GROUPS"].append(key);
t << "\t\t" << key << " = {" << "\n"
<< "\t\t\t" << "children = (" << "\n"
<< "\t\t\t\t" << keyFor("QMAKE_PBX_REFERENCE") << "\n"
<< "\t\t\t" << ");" << "\n"
<< "\t\t\t" << "isa = PBXGroup;" << "\n"
<< "\t\t\t" << "name = Products;" << "\n"
<< "\t\t\t" << "refType = 4;" << "\n"
<< "\t\t" << "};" << "\n";
}
{ //INSTALL BUILDPHASE (sh script)
QString targ = project->first("TARGET");
if(project->first("TEMPLATE") == "app" ||
(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib") &&
project->isActiveConfig("frameworklib")))
targ = project->first("QMAKE_ORIG_TARGET");
int slsh = targ.findRev(Option::dir_sep);
if(slsh != -1)
targ = targ.right(targ.length() - slsh - 1);