From 0d40958347ad0b60fb1ccd15ab7a59e1407e945d Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 30 Nov 2012 21:07:47 +0100 Subject: centralize doc target related code Change-Id: I710a7f2fc3422ec8ba5b8e90bfd92e7931092ad0 Reviewed-by: Lars Knoll Reviewed-by: hjk Reviewed-by: Oswald Buddenhagen --- mkspecs/features/default_pre.prf | 5 ---- mkspecs/features/qt_docs.prf | 45 ++++++++++++++++++++++++++++++++++++ mkspecs/features/qt_docs_targets.prf | 19 ++------------- mkspecs/features/qt_installs.prf | 19 --------------- mkspecs/features/qt_module.prf | 13 +---------- 5 files changed, 48 insertions(+), 53 deletions(-) create mode 100644 mkspecs/features/qt_docs.prf (limited to 'mkspecs') diff --git a/mkspecs/features/default_pre.prf b/mkspecs/features/default_pre.prf index 8f8916ae19..0dd82ee072 100644 --- a/mkspecs/features/default_pre.prf +++ b/mkspecs/features/default_pre.prf @@ -1,7 +1,2 @@ load(exclusive_builds) CONFIG = lex yacc warn_on debug exceptions depend_includepath $$CONFIG - -# Populate the installdir which will be passed to qdoc in the default_post.prf -# This allows a project to remove the installdir if need be, to trigger building online docs, -# which Qt Creator does. -QMAKE_DOCS_INSTALLDIR = $$[QT_INSTALL_DOCS] diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf new file mode 100644 index 0000000000..3eb138b96d --- /dev/null +++ b/mkspecs/features/qt_docs.prf @@ -0,0 +1,45 @@ +!exists($$QMAKE_DOCS): error("Cannot find documentation specification file $$QMAKE_DOCS") + +load(qt_build_paths) +QMAKE_DOCS_BASE_OUTDIR = $$MODULE_BASE_OUTDIR/doc + +QMAKE_DOCS_TARGET = $$replace(QMAKE_DOCS, ^(.*/)?(.*)\\.qdocconf$, \\2) +isEmpty(QMAKE_DOCS_TARGETDIR): QMAKE_DOCS_TARGETDIR = $$QMAKE_DOCS_TARGET +QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR + +qtPrepareTool(QDOC, qdoc) +for(qmod, QMAKEMODULES): \ + QDOC += -indexdir $$section(qmod, /, 0, -3)/doc +QDOC += -outputdir $$QMAKE_DOCS_OUTPUTDIR +!build_online_docs: \ + QDOC += -installdir $$[QT_INSTALL_DOCS] +doc_command = $$QDOC $$QMAKE_DOCS +prepare_docs { + prepare_docs.commands += $$doc_command -prepare -no-link-errors + generate_docs.commands += $$doc_command -generate + html_docs.depends += generate_docs +} else { + html_docs.commands += $$doc_command +} + +!build_online_docs { + qtPrepareTool(QHELPGENERATOR, qhelpgenerator) + qch_docs.commands = $$QHELPGENERATOR $$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp -o $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch + + inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR + inst_html_docs.path = $$[QT_INSTALL_DOCS] + inst_html_docs.CONFIG += no_check_exist directory no_default_install + INSTALLS += inst_html_docs + + inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch + inst_qch_docs.path = $$[QT_INSTALL_DOCS] + inst_qch_docs.CONFIG += no_check_exist no_default_install + INSTALLS += inst_qch_docs + + install_html_docs.depends = install_inst_html_docs + uninstall_html_docs.depends = uninstall_inst_html_docs + install_qch_docs.depends = install_inst_qch_docs + uninstall_qch_docs.depends = uninstall_inst_qch_docs + install_docs.depends = install_html_docs install_qch_docs + uninstall_docs.depends = uninstall_html_docs uninstall_qch_docs +} diff --git a/mkspecs/features/qt_docs_targets.prf b/mkspecs/features/qt_docs_targets.prf index 69eefe9285..0d9f90bce2 100644 --- a/mkspecs/features/qt_docs_targets.prf +++ b/mkspecs/features/qt_docs_targets.prf @@ -12,23 +12,8 @@ } else { # apps and libs only generate docs if QMAKE_DOCS is set !isEmpty(QMAKE_DOCS) { - !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 - doc_command = $$QDOC $$QMAKE_DOCS_OPTIONS $$QDOC_INDEX $$QMAKE_DOCS - prepare_docs { - prepare_docs.commands += $$doc_command -prepare -no-link-errors - generate_docs.commands += $$doc_command -generate - html_docs.depends += generate_docs - } else { - html_docs.commands += $$doc_command - } - - qtPrepareTool(QHELPGENERATOR, qhelpgenerator) - isEmpty(QMAKE_DOCS_TARGET): QMAKE_DOCS_TARGET = $$basename(QMAKE_DOCS_OUTPUTDIR) - qch_docs.commands = $$QHELPGENERATOR $$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp -o $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch + # backwards compat hack + load(qt_docs) } } docs.commands = $(MAKE) -f $(MAKEFILE) html_docs && $(MAKE) -f $(MAKEFILE) qch_docs diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf index bebf918c26..0e860cccca 100644 --- a/mkspecs/features/qt_installs.prf +++ b/mkspecs/features/qt_installs.prf @@ -37,22 +37,3 @@ 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 { - inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR - inst_html_docs.path = $$[QT_INSTALL_DOCS] - inst_html_docs.CONFIG += no_check_exist directory no_default_install - INSTALLS += inst_html_docs - - inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch - inst_qch_docs.path = $$[QT_INSTALL_DOCS] - inst_qch_docs.CONFIG += no_check_exist no_default_install - INSTALLS += inst_qch_docs - - install_html_docs.depends = install_inst_html_docs - uninstall_html_docs.depends = uninstall_inst_html_docs - install_qch_docs.depends = install_inst_qch_docs - uninstall_qch_docs.depends = uninstall_inst_qch_docs - install_docs.depends = install_html_docs install_qch_docs - uninstall_docs.depends = uninstall_html_docs uninstall_qch_docs -} diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index eeb8f7be53..eb46481c70 100644 --- a/mkspecs/features/qt_module.prf +++ b/mkspecs/features/qt_module.prf @@ -113,18 +113,7 @@ win32:!wince*:exists($$[QT_INSTALL_PREFIX]/.qmake.cache): DLLDESTDIR = $$eval(QT CONFIG += qt warn_on depend_includepath CONFIG += qmake_cache target_qt -!isEmpty(QMAKE_DOCS) { - doc_subdir = doc - - unset(QMAKE_DOCS_INDEX) - QMAKE_DOCS_BASE_OUTDIR = $$MODULE_BASE_OUTDIR/$$doc_subdir - QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/qt$${MODULE} - QMAKE_DOCS_TARGET = $$replace(QMAKE_DOCS, ^(.*/)?(.*)\\.qdocconf$, \\2) - for(qmod, QMAKEMODULES): \ - QMAKE_DOCS_INDEX += $$section(qmod, /, 0, -3)/$$doc_subdir - - CONFIG += qt_install_module_docs -} +QMAKE_DOCS_TARGETDIR = qt$${MODULE} # If Qt was configured with -debug-and-release then build the module the same way # - unless this is a host library -- cgit v1.2.3