QDoc: Implement -installdir CLI option for module cross-linking.

QDoc needs to know the final location of the installed documentation to
generate correct relative links between the modules. Normally you can
use QLibraryInfo::DocumentationPath for this, but since QDoc gets compiled
during Qt bootstrapping QLibraryInfo is not available yet.
The -installdir option still allows us to specify
QLibraryInfo::DocumentationPath  on the command line.

Change-Id: Ic4729f4daad112f0d175931467cf09cfcf5145a3
Reviewed-by: Martin Smith <martin.smith@nokia.com>
This commit is contained in:
Casper van Donderen 2012-04-23 16:47:43 +02:00 committed by Qt by Nokia
parent 3de77c3daa
commit 82fcbe9d7d
4 changed files with 22 additions and 3 deletions

View File

@ -150,6 +150,7 @@ QStringList MetaStack::getExpanded(const Location& location)
QT_STATIC_CONST_IMPL QString Config::dot = QLatin1String(".");
bool Config::generateExamples = true;
QString Config::overrideOutputDir;
QString Config::installDir;
QSet<QString> Config::overrideOutputFormats;
QMap<QString, QString> Config::extractedDirs;
int Config::numInstances;

View File

@ -111,6 +111,7 @@ public:
QT_STATIC_CONST QString dot;
static bool generateExamples;
static QString installDir;
static QString overrideOutputDir;
static QSet<QString> overrideOutputFormats;

View File

@ -116,10 +116,12 @@ static void printHelp()
"Display this information and exit\n"
" -highlighting "
"Turn on syntax highlighting (makes qdoc run slower)\n"
" -no-examples "
"Do not generate documentation for examples\n"
" -indexdir "
"Specify a directory where QDoc should search for indices to link to\n"
" -installdir "
"Specify the directory where the output will be after running \"make install\"\n"
" -no-examples "
"Do not generate documentation for examples\n"
" -obsoletelinks "
"Report links from obsolete items to non-obsolete items\n"
" -outputdir "
@ -488,6 +490,10 @@ int main(int argc, char **argv)
}
i++;
}
else if (opt == "-installdir") {
Config::installDir = argv[i];
i++;
}
else if (opt == "-obsoletelinks") {
obsoleteLinks = true;
}

View File

@ -967,7 +967,18 @@ void Tree::readIndexFile(const QString& path)
file.close();
QDomElement indexElement = document.documentElement();
QString indexUrl = indexElement.attribute("url", "");
// Generate a relative URL between the install dir and the index file
// when the -installdir command line option is set.
QString indexUrl;
if (Config::installDir.isEmpty()) {
indexUrl = indexElement.attribute("url", "");
}
else {
QDir installDir(Config::installDir);
indexUrl = installDir.relativeFilePath(path).section('/', 0, -2);
}
priv->basesList.clear();
priv->relatedList.clear();