Modularize documenation build

qdocconf files can now reference $QT_INSTALL_DOCS to pick up e.g. global
includes, instead of using relative paths. Qt modules will automatically
get a doc target that builds and installs into the right place (including
supporting shadow-builds) if they set QMAKE_DOCS before loading(qt_module).

Change-Id: Ia408385199e56e3ead0afa45645a059d1a8b0d48
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
bb10
Tor Arne Vestbø 2012-10-08 17:19:14 +02:00 committed by The Qt Project
parent 9adf7fb708
commit 087efb572a
31 changed files with 80 additions and 66 deletions

6
configure vendored
View File

@ -2254,9 +2254,9 @@ if [ "$OPT_SHADOW" = "yes" ]; then
mv "$outpath/mkspecs-modules-inst" "$outpath/mkspecs/modules-inst"
fi
# symlink the doc directory
rm -rf "$outpath/doc"
ln -s "$relpath/doc" "$outpath/doc"
# Prepare doc directory
mkdir -p "$outpath/doc"
ln -s "$relpath"/doc/global "$outpath/doc"
fi
# symlink fonts to be able to run application from build directory

View File

@ -92,6 +92,7 @@ QMAKE_LIBDIR += $$QMAKE_LIBDIR_POST
!exists($$QMAKE_DOCS):error("Cannot find documentation specification file $$QMAKE_DOCS")
qtPrepareTool(QDOC, qdoc)
for(index, QMAKE_DOCS_INDEX):QDOC_INDEX += -indexdir $$index
!isEmpty(QMAKE_DOCS_OUTPUTDIR):QMAKE_DOCS_OPTIONS += -outputdir $$QMAKE_DOCS_OUTPUTDIR
!isEmpty(QMAKE_DOCS_INSTALLDIR):QMAKE_DOCS_OPTIONS += -installdir $$QMAKE_DOCS_INSTALLDIR
docs.commands += $$QDOC $$QMAKE_DOCS_OPTIONS $$QDOC_INDEX $$QMAKE_DOCS
}

View File

@ -47,3 +47,11 @@ qt_install_module {
warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
}
}
qt_install_module_docs {
module_docs.files = $$QMAKE_DOCS_OUTPUTDIR
module_docs.path = $$[QT_INSTALL_DOCS]
module_docs.CONFIG += no_check_exist directory
module_docs.depends += docs
INSTALLS += module_docs
}

View File

@ -121,6 +121,11 @@ CONFIG += qt warn_on depend_includepath
CONFIG += qmake_cache target_qt
CONFIG -= fix_output_dirs
!isEmpty(QMAKE_DOCS) {
QMAKE_DOCS_OUTPUTDIR = $$eval(QT.$${MODULE}.docs)/qt$${MODULE}
CONFIG += qt_install_module_docs
}
# If Qt was configured with -debug-and-release then build the module the same way
if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release

View File

@ -99,6 +99,10 @@ mkspecs.files -= $$PWD/mkspecs/modules
}
INSTALLS += mkspecs
global_docs.files = $$PWD/doc/global
global_docs.path = $$[QT_INSTALL_DOCS]
INSTALLS += global_docs
OTHER_FILES += \
configure \
header.BSD \

View File

@ -7,6 +7,8 @@ CONFIG += exceptions
DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf
load(qt_module)
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
@ -37,9 +39,6 @@ HEADERS += \
# private headers
HEADERS += \
QMAKE_DOCS = $$PWD/doc/qtconcurrent.qdocconf
QMAKE_DOCS_INDEX = ../../doc
contains(QT_CONFIG, clock-gettime) {
linux-*|hpux-*|solaris-*:LIBS *= -lrt
}

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtConcurrent
description = Qt Concurrent Reference Documentation
@ -29,7 +29,6 @@ qhp.QtConcurrent.subprojects.examples.title = Qt Concurrent Examples
qhp.QtConcurrent.subprojects.examples.indexTitle = Qt Concurrent Examples
qhp.QtConcurrent.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtconcurrent
tagfile = ../../../doc/qtconcurrent/qtconcurrent.tags
depends += qtcore

View File

@ -14,10 +14,9 @@ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
# otherwise mingw headers do not declare common functions like putenv
win32-g++*:QMAKE_CXXFLAGS_CXX11 = -std=gnu++0x
load(qt_module)
QMAKE_DOCS = $$PWD/doc/qtcore.qdocconf
QMAKE_DOCS_INDEX = ../../doc
load(qt_module)
include(animation/animation.pri)
include(arch/arch.pri)

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtCore
description = Qt Core Reference Documentation
@ -29,7 +29,6 @@ qhp.QtCore.subprojects.examples.title = Qt Core Examples
qhp.QtCore.subprojects.examples.indexTitle = Qt Core Examples
qhp.QtCore.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtcore
tagfile = ../../../doc/qtcore/qtcore.tags
depends += qtwidgets

View File

@ -26,10 +26,10 @@ win32 {
CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d
else:LIBS_PRIVATE += -ldbus-1
}
load(qt_module)
QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf
QMAKE_DOCS_INDEX = ../../doc
load(qt_module)
PUB_HEADERS = qdbusargument.h \
qdbusconnectioninterface.h \

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtDBus
description = Qt DBus Reference Documentation
@ -29,7 +29,6 @@ qhp.QtDBus.subprojects.examples.title = Qt DBus Examples
qhp.QtDBus.subprojects.examples.indexTitle = Qt DBus Examples
qhp.QtDBus.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtdbus
tagfile = ../../../doc/qtdbus/qtdbus.tags
depends += qtcore

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtGui
description = Qt GUI Reference Documentation
@ -29,7 +29,6 @@ qhp.QtGui.subprojects.examples.title = Qt GUI Examples
qhp.QtGui.subprojects.examples.indexTitle = Qt GUI Examples
qhp.QtGui.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtgui
tagfile = ../../../doc/qtgui/qtgui.tags
depends += qtcore

View File

@ -6,6 +6,8 @@ MODULE_CONFIG = opengl
DEFINES += QT_NO_USING_NAMESPACE
QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf
load(qt_module)
# Code coverage with TestCocoon
@ -22,9 +24,6 @@ mac {
CONFIG += simd
QMAKE_DOCS = $$PWD/doc/qtgui.qdocconf
QMAKE_DOCS_INDEX = ../../doc
include(accessible/accessible.pri)
include(kernel/kernel.pri)
include(image/image.pri)

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtNetwork
description = Qt Network Reference Documentation
@ -29,7 +29,6 @@ qhp.QtNetwork.subprojects.examples.title = Qt Network Examples
qhp.QtNetwork.subprojects.examples.indexTitle = Qt Network Examples
qhp.QtNetwork.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtnetwork
tagfile = ../../../doc/qtnetwork/qtnetwork.tags
depends += qtcore

View File

@ -13,10 +13,9 @@ DEFINES += QT_NO_USING_NAMESPACE
#DEFINES += QUDPSOCKET_DEBUG QUDPSERVER_DEBUG
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000
load(qt_module)
QMAKE_DOCS = $$PWD/doc/qtnetwork.qdocconf
QMAKE_DOCS_INDEX = ../../doc
load(qt_module)
include(access/access.pri)
include(bearer/bearer.pri)

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtOpenGL
description = Qt OpenGL Reference Documentation
@ -29,7 +29,6 @@ qhp.QtOpenGL.subprojects.examples.title = Qt OpenGL Examples
qhp.QtOpenGL.subprojects.examples.indexTitle = Qt OpenGL Examples
qhp.QtOpenGL.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtopengl
tagfile = ../../../doc/qtopengl/qtopengl.tags
depends += qtcore qtgui qtwidgets

View File

@ -8,6 +8,8 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf
load(qt_module)
contains(QT_CONFIG, opengl):CONFIG += opengl
@ -15,9 +17,6 @@ contains(QT_CONFIG, opengles1):CONFIG += opengles1
contains(QT_CONFIG, opengles2):CONFIG += opengles2
contains(QT_CONFIG, egl):CONFIG += egl
QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf
QMAKE_DOCS_INDEX = ../../doc
HEADERS += qgl.h \
qgl_p.h \
qglcolormap.h \

View File

@ -12,8 +12,6 @@ showinternal = true
headers.fileextensions = "*.h"
sources.fileextensions = "*.cpp *.qdoc"
outputdir = doc
qhp.projects = QtLighthouseWindows
qhp.QtLighthouseWindowsDev.file = qtlighthousewindows-dev.qhp
qhp.QtLighthouseWindowsDev.namespace = com.nokia.qt.developer.lighthouse

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtPrintSupport
description = Qt Print Support Reference Documentation
@ -29,7 +29,6 @@ qhp.QtPrintSupport.subprojects.examples.title = Qt Print Support Examples
qhp.QtPrintSupport.subprojects.examples.indexTitle = Qt Print Support Examples
qhp.QtPrintSupport.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtprintsupport
tagfile = ../../../doc/qtprintsupport/qtprintsupport.tags
depends += qtcore qtgui qtwidgets

View File

@ -5,10 +5,9 @@ QT = core-private gui-private widgets-private
DEFINES += QT_NO_USING_NAMESPACE
load(qt_module)
QMAKE_DOCS = $$PWD/doc/qtprintsupport.qdocconf
QMAKE_DOCS_INDEX = ../../doc
load(qt_module)
QMAKE_LIBS += $$QMAKE_LIBS_PRINTSUPPORT

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtSql
description = Qt SQL Reference Documentation
@ -29,7 +29,6 @@ qhp.QtSql.subprojects.examples.title = Qt SQL Examples
qhp.QtSql.subprojects.examples.indexTitle = Qt SQL Examples
qhp.QtSql.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtsql
tagfile = ../../../doc/qtsql/qtsql.tags
depends += qtcore

View File

@ -6,15 +6,14 @@ QT = core-private
DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf
load(qt_module)
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
SQL_P = sql
QMAKE_DOCS = $$PWD/doc/qtsql.qdocconf
QMAKE_DOCS_INDEX = ../../doc
include(kernel/kernel.pri)
include(drivers/drivers.pri)
include(models/models.pri)

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtTest
description = Qt Test Reference Documentation
@ -29,7 +29,6 @@ qhp.QtTest.subprojects.examples.title = Qt Test Examples
qhp.QtTest.subprojects.examples.indexTitle = Qt Test Examples
qhp.QtTest.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qttest
tagfile = ../../../doc/qttest/qttest.tags
depends += qtcore

View File

@ -12,7 +12,6 @@ unix:!embedded:QMAKE_PKGCONFIG_DESCRIPTION = Qt \
Library
QMAKE_DOCS = $$PWD/doc/qttest.qdocconf
QMAKE_DOCS_INDEX = ../../doc
HEADERS = qbenchmark.h \
qbenchmark_p.h \

View File

@ -26,7 +26,6 @@ exampledirs = .. \
imagedirs = ../../../doc/src/templates/images \
images
outputdir = ../html
tagfile = ../html/qdoc.tags
qhp.projects = QDoc

View File

@ -40,6 +40,7 @@
****************************************************************************/
#include <qglobal.h>
#include <qlibraryinfo.h>
#include <stdlib.h>
#include "codemarker.h"
#include "codeparser.h"
@ -172,6 +173,12 @@ static void processQdocconfFile(const QString &fileName)
config.setStringList(CONFIG_NOLINKERRORS, QStringList(noLinkErrors ? "true" : "false"));
config.setStringList(CONFIG_OBSOLETELINKS, QStringList(obsoleteLinks ? "true" : "false"));
QString documentationPath = QLibraryInfo::rawLocation(QLibraryInfo::DocumentationPath,
QLibraryInfo::EffectivePaths);
// Set a few environment variables that can be used from the qdocconf file
qputenv("QT_INSTALL_DOCS", documentationPath.toLatin1());
/*
With the default configuration values in place, load
the qdoc configuration file. Note that the configuration
@ -256,6 +263,11 @@ static void processQdocconfFile(const QString &fileName)
dependModules += config.getStringList(CONFIG_DEPENDS);
// Allow modules and third-party application/libraries to link
// to the Qt docs without having to explicitly pass --indexdir.
if (!indexDirs.contains(documentationPath))
indexDirs.append(documentationPath);
if (dependModules.size() > 0) {
if (indexDirs.size() > 0) {
for (int i = 0; i < indexDirs.size(); i++) {

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtWidgets
description = Qt Widgets Reference Documentation
@ -29,7 +29,6 @@ qhp.QtWidgets.subprojects.examples.title = Qt Widgets Examples
qhp.QtWidgets.subprojects.examples.indexTitle = Qt Widgets Examples
qhp.QtWidgets.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtwidgets
tagfile = ../../../doc/qtwidgets/qtwidgets.tags
depends += qtcore qtgui

View File

@ -9,7 +9,6 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
QMAKE_DOCS_INDEX = ../../doc
load(qt_module)

View File

@ -1,5 +1,5 @@
include(../../../doc/global/qt-html-templates-offline.qdocconf)
include(../../../doc/global/qt-module-defaults.qdocconf)
include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf)
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtXml
description = Qt XML Reference Documentation
@ -29,7 +29,6 @@ qhp.QtXml.subprojects.examples.title = Qt XML Examples
qhp.QtXml.subprojects.examples.indexTitle = Qt XML Examples
qhp.QtXml.subprojects.examples.selectors = fake:example
outputdir = ../../../doc/qtxml
tagfile = ../../../doc/qtxml/qtxml.tags
depends += qtcore

View File

@ -6,11 +6,11 @@ QT = core-private
DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
QMAKE_DOCS = $$PWD/doc/qtxml.qdocconf
load(qt_module)
HEADERS += qtxmlglobal.h
QMAKE_DOCS = $$PWD/doc/qtxml.qdocconf
QMAKE_DOCS_INDEX = ../../doc
PRECOMPILED_HEADER = ../corelib/global/qt_pch.h

View File

@ -176,6 +176,13 @@ Configure::Configure(int& argc, char** argv)
dictionary["DONE"] = "error";
return;
}
buildDir.mkpath("doc");
if (!Environment::cpdir(sourcePath + "/doc/global", buildPath + "/doc/global")) {
cout << "Couldn't copy global documentation!" << sourcePath << " " << buildPath << endl;
dictionary["DONE"] = "error";
return;
}
}
defaultBuildParts << QStringLiteral("libs") << QStringLiteral("tools") << QStringLiteral("examples");