diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2019-03-13 10:04:03 +0000 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2019-03-13 10:04:03 +0000 |
commit | 77dec25007df726bebf06a3a4a12db5380c41016 (patch) | |
tree | 3077cd8d9a803367c81e8497267f2e084ca49141 /doc | |
parent | 30b9cc540c26b973b7c703b9a2e8dbf42263d296 (diff) | |
parent | f04e611a46d7bac2fdbf63586882ac9e55a77a0b (diff) | |
download | dbus-77dec25007df726bebf06a3a4a12db5380c41016.tar.gz |
Merge branch 'fix-cmake-doc-deps' into 'master'
Fixes rebuilding of dbus documentation at every make call
See merge request dbus/dbus!94
Diffstat (limited to 'doc')
-rw-r--r-- | doc/CMakeLists.txt | 102 |
1 files changed, 65 insertions, 37 deletions
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 5a5eb85a..6c268c99 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -3,7 +3,7 @@ # find_package(Doxygen) -# build doc always +# always check doc target add_custom_target(doc ALL) if(DOXYGEN_EXECUTABLE) @@ -12,26 +12,27 @@ endif() if(DBUS_ENABLE_DOXYGEN_DOCS) set(top_srcdir ${CMAKE_SOURCE_DIR}) + set(top_builddir ${CMAKE_BINARY_DIR}) if(WIN32) set(DBUS_GENERATE_MAN NO) else() set(DBUS_GENERATE_MAN YES) endif() configure_file(../Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile ) + file(GLOB dbus_files "${CMAKE_SOURCE_DIR}/dbus/*.[ch]*") add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/api/html/index.html + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp + DEPENDS ${CMAKE_SOURCE_DIR}/Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile ${dbus_files} + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/api/html COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" ) add_custom_target(apidoc - COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp ) add_dependencies(doc apidoc) - add_custom_target(devhelp2 - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/api/html/index.html ${CMAKE_CURRENT_BINARY_DIR}/dbus.devhelp2 - ) - add_dependencies(doc devhelp2) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api/html/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus/api) endif() @@ -43,11 +44,19 @@ endif() if(DBUS_HAVE_XSLTPROC) add_custom_command( - OUTPUT dbus.devhelp2 - COMMAND ${XSLTPROC_EXECUTABLE} -o dbus.devhelp2 ${CMAKE_CURRENT_SOURCE_DIR}/doxygen_to_devhelp.xsl api/xml/index.xml - DEPENDS doxygen_to_devhelp.xsl api/html/index.html - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dbus.devhelp2 + COMMAND ${XSLTPROC_EXECUTABLE} + -o ${CMAKE_CURRENT_BINARY_DIR}/dbus.devhelp2 + ${CMAKE_CURRENT_SOURCE_DIR}/doxygen_to_devhelp.xsl + ${CMAKE_CURRENT_BINARY_DIR}/api/xml/index.xml + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/doxygen_to_devhelp.xsl + ${CMAKE_CURRENT_BINARY_DIR}/doxygen.stamp + ) + add_custom_target(devhelp2 + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dbus.devhelp2 ) + add_dependencies(doc devhelp2) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus.devhelp2 DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus) endif() @@ -65,6 +74,28 @@ if(DOCBOOKXSL_DIR AND XSLTPROC_EXECUTABLE) endif() if(DBUS_ENABLE_XML_DOCS) +# +# generate docbook file from template +# +macro(generate_docbook_file a b) + get_filename_component(outname ${b} NAME) + set(srcfile ${CMAKE_CURRENT_SOURCE_DIR}/${a}) + set(tmpfile ${CMAKE_CURRENT_BINARY_DIR}/${outname}.tmp.cmake) + file(WRITE ${tmpfile} " +set(EXPANDED_SYSCONFDIR ${CMAKE_INSTALL_FULL_SYSCONFDIR}) +set(EXPANDED_DATADIR ${CMAKE_INSTALL_FULL_DATADIR}) +set(DBUS_VERSION ${DBUS_VERSION}) +configure_file(${srcfile} ${b}) + ") + add_custom_command(OUTPUT ${b} + COMMAND ${CMAKE_COMMAND} -E remove ${b} + COMMAND ${CMAKE_COMMAND} -P ${tmpfile} + DEPENDS ${srcfile} ${CMAKE_BINARY_DIR}/CMakeCache.txt + COMMENT "Generating ${outname}" + ) + add_custom_target(${outname} DEPENDS ${b}) + add_dependencies(doc ${outname}) +endmacro() macro(DOCBOOK _sources _format) get_filename_component(_infile ${_sources} ABSOLUTE) @@ -77,22 +108,18 @@ macro(DOCBOOK _sources _format) set(STYLESHEET "${DOCBOOKXSL_DIR}/html/docbook.xsl") endif() set(_outfile ${CMAKE_CURRENT_BINARY_DIR}/${_outname}) - if(EXISTS ${_sources}) - if(XSLTPROC_EXECUTABLE) - add_custom_target(${_outname} - ${XSLTPROC_EXECUTABLE} --output ${_outfile} --nonet --xinclude --param passivetex.extensions '1' ${STYLESHEET} ${_infile} - DEPENDS ${_infile} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - endif() - add_dependencies(xmldoc ${_outname}) - if(${_format} STREQUAL "man") - install(FILES ${_outfile} DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man1) - else() - install(FILES ${_outfile} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus) - endif() + add_custom_command( + OUTPUT ${_outfile} + COMMAND ${XSLTPROC_EXECUTABLE} --output ${_outfile} --nonet --xinclude --param passivetex.extensions '1' ${STYLESHEET} ${_infile} + DEPENDS ${XSLTPROC_EXECUTABLE} ${_infile} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + add_custom_target(${_outname} DEPENDS ${_outfile}) + add_dependencies(xmldoc ${_outname}) + if(${_format} STREQUAL "man") + install(FILES ${_outfile} DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man1) else() - message(STATUS "skipping xml doc generating for ${_infile}, file not found") + install(FILES ${_outfile} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus) endif() endmacro() @@ -119,20 +146,21 @@ endmacro() COPYDIR(doc *.png) COPYDIR(doc *.svg) +generate_docbook_file(dbus-cleanup-sockets.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-cleanup-sockets.1.xml) +generate_docbook_file(dbus-daemon.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-daemon.1.xml) +generate_docbook_file(dbus-launch.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-launch.1.xml) +generate_docbook_file(dbus-monitor.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-monitor.1.xml) +generate_docbook_file(dbus-run-session.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-run-session.1.xml) +generate_docbook_file(dbus-send.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-send.1.xml) +generate_docbook_file(dbus-test-tool.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-test-tool.1.xml) +generate_docbook_file(dbus-update-activation-environment.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-update-activation-environment.1.xml) +generate_docbook_file(dbus-uuidgen.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-uuidgen.1.xml) + docbook(${CMAKE_CURRENT_SOURCE_DIR}/dbus-test-plan.xml html) docbook(${CMAKE_CURRENT_SOURCE_DIR}/dbus-tutorial.xml html) docbook(${CMAKE_CURRENT_SOURCE_DIR}/dbus-specification.xml html) docbook(${CMAKE_CURRENT_SOURCE_DIR}/dbus-faq.xml html) -configure_file(dbus-cleanup-sockets.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-cleanup-sockets.1.xml) -configure_file(dbus-daemon.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-daemon.1.xml) -configure_file(dbus-launch.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-launch.1.xml) -configure_file(dbus-monitor.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-monitor.1.xml) -configure_file(dbus-run-session.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-run-session.1.xml) -configure_file(dbus-send.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-send.1.xml) -configure_file(dbus-test-tool.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-test-tool.1.xml) -configure_file(dbus-update-activation-environment.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-update-activation-environment.1.xml) -configure_file(dbus-uuidgen.1.xml.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-uuidgen.1.xml) if(UNIX) docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-daemon.1.xml man) docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-monitor.1.xml man) |