📄 unixmake.cpp
字号:
} else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) {
if(opt.length() > 11)
opt = opt.mid(11);
else
opt = l.at(++lit);
opt = opt.trimmed();
const QList<QMakeLocalFileName> dirs = frameworkdirs + libdirs;
for(QList<QMakeLocalFileName>::ConstIterator dep_it = dirs.begin(); dep_it != dirs.end(); ++dep_it) {
QString prl = (*dep_it).local() + "/" + opt + ".framework/" + opt + Option::prl_ext;
if(processPrlFile(prl))
break;
}
}
} else if(!opt.isNull()) {
QString lib = opt;
processPrlFile(lib);
#if 0
if(ret)
opt = linkLib(lib, "");
#endif
if(!opt.isEmpty())
l.replaceInStrings(lib, opt);
}
QStringList &prl_libs = project->variables()["QMAKE_CURRENT_PRL_LIBS"];
if(!prl_libs.isEmpty()) {
for(int prl = 0; prl < prl_libs.size(); ++prl)
l.insert(lit+prl+1, prl_libs.at(prl));
prl_libs.clear();
}
}
//merge them into a logical order
if(!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) {
QStringList lflags;
for(int lit = 0; lit < l.size(); ++lit) {
QString opt = l.at(lit).trimmed();
if(opt.startsWith("-")) {
if(opt.startsWith("-L") ||
(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F"))) {
if(lit == 0 || l.lastIndexOf(opt, lit-1) == -1)
lflags.append(opt);
} else if(opt.startsWith("-l")) {
if(lit == l.size()-1 || l.indexOf(opt, lit+1) == -1)
lflags.append(opt);
} else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) {
if(opt.length() > 11)
opt = opt.mid(11);
else
opt = l.at(++lit);
bool found = false;
for(int x = lit+1; x < l.size(); ++x) {
QString xf = l.at(x);
if(xf.startsWith("-framework")) {
QString framework;
if(xf.length() > 11)
framework = xf.mid(11);
else
framework = l.at(++x);
if(framework == opt) {
found = true;
break;
}
}
}
if(!found) {
lflags.append("-framework");
lflags.append(opt);
}
} else {
lflags.append(opt);
}
} else if(!opt.isNull()) {
if(lit == 0 || l.lastIndexOf(opt, lit-1) == -1)
lflags.append(opt);
}
}
l = lflags;
}
}
}
QString
UnixMakefileGenerator::defaultInstall(const QString &t)
{
if(t != "target" || project->first("TEMPLATE") == "subdirs")
return QString();
bool bundle = false;
const QString root = "$(INSTALL_ROOT)";
QStringList &uninst = project->variables()[t + ".uninstall"];
QString ret, destdir=project->first("DESTDIR");
QString targetdir = Option::fixPathToTargetOS(project->first("target.path"), false);
if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep)
destdir += Option::dir_sep;
targetdir = fileFixify(targetdir, FileFixifyAbsolute);
if(targetdir.right(1) != Option::dir_sep)
targetdir += Option::dir_sep;
QStringList links;
QString target="$(TARGET)";
if(!project->isEmpty("QMAKE_BUNDLE_NAME")) {
target = project->first("QMAKE_BUNDLE_NAME");
bundle = true;
} else if(project->first("TEMPLATE") == "app") {
target = "$(QMAKE_TARGET)";
} else if(project->first("TEMPLATE") == "lib") {
if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") &&
!project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
const QString src_prl = project->first("QMAKE_INTERNAL_PRL_FILE"),
dst_prl = filePrefixRoot(root, targetdir + src_prl.section('/', -1));
ret += "-$(INSTALL_FILE) \"" + src_prl + "\" \"" + dst_prl + "\"";
if(!uninst.isEmpty())
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"");
}
if(project->isActiveConfig("create_libtool") && !project->isActiveConfig("compile_libtool")) {
const QString src_lt = libtoolFileName(),
dst_lt = filePrefixRoot(root, targetdir + src_lt.section('/', -1));
if(!ret.isEmpty())
ret += "\n\t";
ret += "-$(INSTALL_FILE) \"" + src_lt + "\" \"" + dst_lt + "\"";
if(!uninst.isEmpty())
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_lt + "\"");
}
if(project->isActiveConfig("create_pc")) {
const QString src_pc = pkgConfigFileName(),
dst_pc = filePrefixRoot(root, targetdir + src_pc.section('/', -1));
if(!ret.isEmpty())
ret += "\n\t";
ret += "-$(INSTALL_FILE) \"" + src_pc + "\" \"" + dst_pc + "\"";
if(!uninst.isEmpty())
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_pc + "\"");
}
if(project->isEmpty("QMAKE_CYGWIN_SHLIB")) {
if(!project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin")) {
if(project->isEmpty("QMAKE_HPUX_SHLIB")) {
links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)";
} else {
links << "$(TARGET0)";
}
}
}
}
if(!bundle && project->isActiveConfig("compile_libtool")) {
QString src_targ = target;
if(src_targ == "$(TARGET)")
src_targ = "$(TARGETL)";
QString dst_dir = fileFixify(targetdir, FileFixifyAbsolute);
if(QDir::isRelativePath(dst_dir))
dst_dir = Option::fixPathToTargetOS(Option::output_dir + Option::dir_sep + dst_dir);
ret = "-$(LIBTOOL) --mode=install cp \"" + src_targ + "\" \"" + filePrefixRoot(root, dst_dir) + "\"";
uninst.append("-$(LIBTOOL) --mode=uninstall \"" + src_targ + "\"");
} else {
QString src_targ = target;
if(!destdir.isEmpty())
src_targ = Option::fixPathToTargetOS(destdir + target, false);
QString dst_targ = filePrefixRoot(root, fileFixify(targetdir + target, FileFixifyAbsolute));
if(bundle) {
if(!ret.isEmpty())
ret += "\n\t";
ret += "$(DEL_FILE) -r \"" + dst_targ + "\"\n\t";
}
if(!ret.isEmpty())
ret += "\n\t";
const QString copy_cmd = QString(bundle ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" +
src_targ + "\" \"" + dst_targ + "\"";
if(project->first("TEMPLATE") == "lib" && !project->isActiveConfig("staticlib")
&& project->values(t + ".CONFIG").indexOf("fix_rpath") != -1) {
if(!project->isEmpty("QMAKE_FIX_RPATH")) {
ret += copy_cmd;
ret += "\n\t-" + var("QMAKE_FIX_RPATH") + " \"" +
dst_targ + "\" \"" + dst_targ + "\"";
} else if(!project->isEmpty("QMAKE_LFLAGS_RPATH")) {
ret += "-$(LINK) $(LFLAGS) " + var("QMAKE_LFLAGS_RPATH") + targetdir + " -o \"" +
dst_targ + "\" $(OBJECTS) $(LIBS) $(OBJCOMP)";
} else {
ret += copy_cmd;
}
} else {
ret += copy_cmd;
}
if(project->first("TEMPLATE") == "lib" && project->isActiveConfig("staticlib")) {
if(!project->isEmpty("QMAKE_RANLIB"))
ret += QString("\n\t$(RANLIB) \"") + dst_targ + "\"";
} else if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) {
ret += "\n\t-" + var("QMAKE_STRIP");
if(project->first("TEMPLATE") == "lib" && !project->isEmpty("QMAKE_STRIPFLAGS_LIB"))
ret += " " + var("QMAKE_STRIPFLAGS_LIB");
else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP"))
ret += " " + var("QMAKE_STRIPFLAGS_APP");
if(bundle)
ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\"";
else
ret += " \"" + dst_targ + "\"";
}
if(!uninst.isEmpty())
uninst.append("\n\t");
if(bundle)
uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\"");
else
uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
if(!links.isEmpty()) {
for(QStringList::Iterator it = links.begin(); it != links.end(); it++) {
if(Option::target_mode == Option::TARG_WIN_MODE ||
Option::target_mode == Option::TARG_MAC9_MODE) {
} else if(Option::target_mode == Option::TARG_UNIX_MODE ||
Option::target_mode == Option::TARG_MACX_MODE) {
QString link = Option::fixPathToTargetOS(destdir + (*it), false);
int lslash = link.lastIndexOf(Option::dir_sep);
if(lslash != -1)
link = link.right(link.length() - (lslash + 1));
QString dst_link = filePrefixRoot(root, fileFixify(targetdir + link, FileFixifyAbsolute));
ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\"";
if(!uninst.isEmpty())
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_link + "\"");
}
}
}
}
return ret;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -