diff options
author | Julian Andres Klode <jak@debian.org> | 2016-08-08 21:53:46 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-08-10 16:17:18 +0200 |
commit | 10ec2d23f14cf5d3e4835d9bcb57d0937f803e6a (patch) | |
tree | 6b94f158da77f56a59099078a178bb5832f2d9a7 /doc | |
parent | 0d04a4987feb9ec45ddfa03270e20f76cae02a84 (diff) |
CMake: Rewrite existing Documentation support and add doxygen
This can now build all documentation. It should also be fairly
reusable for other projects, as long as they follow the same
naming scheme for the po4a output files and set the PACKAGE_*
variables used here.
We could have done all translations in a single call to po4a
like the makefile based buildsystem does. While that would
have made the output slightly nicer, this solution offers a
huge performance gain because it can translate the documents
in parallel, which also means that the xsltproc stage does not
have to wait for all translations to be done first.
You might think that the add_custom_command() should list the
actual output files as BYPRODUCTS. This is not true however:
Because the files are not always generated, Ninja will think
missing byproducts mean that the target is out of date - which
is not what we want.
Finally, also add the missing doxygen support. Note that the
packaging script cleans up some md5 and map files created by
doxygen, otherwise it is fairly boring.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/CMakeLists.txt | 86 | ||||
-rw-r--r-- | doc/Doxyfile.in | 12 |
2 files changed, 81 insertions, 17 deletions
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index bbf5fb046..d54303deb 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,21 +1,85 @@ include(Documentation) -file(GLOB_RECURSE debiandoc-apt guide*.dbk offline*.dbk) -file(GLOB_RECURSE debiandoc-libapt cache*.dbk design*.dbk dpkg-tech*.dbk - files*.dbk method*.dbk) +set(LINGUAS + de + es + fr + it + ja + nl + pl + pt_BR + pt +) +set(ENTITIES + apt.ent + apt-verbatim.ent + ../vendor/${CURRENT_VENDOR}/apt-vendor.ent +) -set(manpages apt.8 apt-cache.8 apt-get.8 apt-cdrom.8 apt.conf.5 sources.list.5 - apt-config.8 apt_preferences.5 apt-sortpkgs.1 apt-ftparchive.1 - apt-extracttemplates.1 apt-key.8 apt-secure.8 apt-mark.8) +if(WITH_DOC) +add_docbook(apt-doc HTML TEXT ALL + DOCUMENTS + guide.dbk + offline.dbk + INSTALL ${CMAKE_INSTALL_DOCDIR}/../apt-doc + LINGUAS ${LINGUAS} + DEPENDS ${ENTITIES} +) + +add_docbook(libapt-pkg-doc HTML TEXT ALL + DOCUMENTS + design.dbk + dpkg-tech.dbk + files.dbk + method.dbk + INSTALL ${CMAKE_INSTALL_DOCDIR}/../libapt-pkg-doc + LINGUAS ${LINGUAS} + DEPENDS ${ENTITIES} +) + +find_package(Doxygen) + +file(GLOB_RECURSE apt_pkg "../apt-pkg/*.h" "../apt-pkg/*.cc") +configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp + COMMAND doxygen ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp + DEPENDS ${apt_pkg} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile +) + +add_custom_target(apt-doxygen ALL + DEPENDS ${PROJECT_BINARY_DIR}/doc/doxygen.stamp +) + +install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/doxygen/html + DESTINATION ${CMAKE_INSTALL_DOCDIR}/../libapt-pkg-doc) -if (WITH_DOC) -add_docbook(debiandoc-apt "${debiandoc-apt}" share/doc/apt-doc) -add_docbook(debiandoc-libapt "${debiandoc-libapt}" share/doc/libapt-pkg-doc) endif() -# Build the manpages, and add translations (ja only for now, others broken) -add_xml_manpages(doc-man "${manpages}" "de;es;fr;it;ja;nl;pl;pt_BR;pt" "apt.ent;apt-verbatim.ent") +add_docbook(apt-man MANPAGE ALL + DOCUMENTS + apt.8.xml + apt-cache.8.xml + apt-cdrom.8.xml + apt.conf.5.xml + apt-config.8.xml + apt-extracttemplates.1.xml + apt-ftparchive.1.xml + apt-get.8.xml + apt-key.8.xml + apt-mark.8.xml + apt_preferences.5.xml + apt-secure.8.xml + apt-sortpkgs.1.xml + sources.list.5.xml + DEPENDS ${ENTITIES} + LINGUAS ${LINGUAS} +) +add_update_po4a(update-po4a po/${PROJECT_NAME}-doc.pot "po/header.pot.txt") add_subdirectory(examples) diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index ab3fc0a7c..b6521feb8 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ../build/doc/doxygen +OUTPUT_DIRECTORY = @PROJECT_BINARY_DIR@/doc/doxygen # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -152,7 +152,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = @top_srcdir@ +STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -161,7 +161,7 @@ STRIP_FROM_PATH = @top_srcdir@ # specify the list of include paths that are normally passed to the compiler # using the -I flag. -STRIP_FROM_INC_PATH = @top_srcdir@ +STRIP_FROM_INC_PATH = @PROJECT_SOURCE_DIR@ # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but # less readable) file names. This can be useful is your file systems doesn't @@ -754,7 +754,7 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = ../apt-pkg +INPUT = ${PROJECT_SOURCE_DIR}/apt-pkg # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -2057,7 +2057,7 @@ HIDE_UNDOC_RELATIONS = YES # set to NO # The default value is: YES. -HAVE_DOT = @HAVE_DOT@ +HAVE_DOT = @DOXYGEN_DOT_FOUND@ # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of @@ -2231,7 +2231,7 @@ INTERACTIVE_SVG = YES # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = @DOTDIR@ +DOT_PATH = @DOXYGEN_DOT_PATH@ # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile |