4 OPTION(DBUS_ENABLE_DOXYGEN_DOCS "build DOXYGEN documentation (requires Doxygen)" ON)
5 endif(DOXYGEN_EXECUTABLE)
7 if (DBUS_ENABLE_DOXYGEN_DOCS)
8 set (top_srcdir ${CMAKE_SOURCE_DIR}/..)
9 configure_file(${CMAKE_SOURCE_DIR}/../Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile )
11 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
12 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
14 endif (DBUS_ENABLE_DOXYGEN_DOCS)
17 # find docbook generator
19 find_program(MEINPROC4_EXECUTABLE meinproc4)
21 find_program(XMLTO_EXECUTABLE xmlto)
23 find_program(CYGPATH_EXECUTABLE cygpath)
25 if (MEINPROC4_EXECUTABLE OR XMLTO_EXECUTABLE)
26 OPTION(DBUS_ENABLE_XML_DOCS "build XML documentation (requires xmlto or meinproc4)" ON)
27 ADD_CUSTOM_TARGET(xmldoc ALL)
28 endif (MEINPROC4_EXECUTABLE OR XMLTO_EXECUTABLE)
31 set (DOCBOOK_GENERATOR_NAME "xmlto" PARENT_SCOPE)
32 set(DBUS_XML_DOCS_ENABLED 1)
33 set(MEINPROC4_EXECUTABLE 0)
34 MESSAGE(STATUS "xmlto docbook generator found")
35 set(STYLESHEET_MAN "${DOCBOOKXSL_DIR}/manpages/docbook.xsl")
36 set(STYLESHEET_HTML "${DOCBOOKXSL_DIR}/html/docbook.xsl")
38 elseif (MEINPROC4_EXECUTABLE)
39 set(DOCBOOK_GENERATOR_NAME "meinproc4" PARENT_SCOPE)
40 set(DBUS_XML_DOCS_ENABLED 1)
42 get_filename_component(_a ${MEINPROC4_EXECUTABLE} PATH)
43 get_filename_component(_meinproc_install_path ${_a} PATH)
44 set(STYLESHEET_HTML "${_meinproc_install_path}/share/apps/ksgmltools2/docbook/xsl/html/docbook.xsl")
46 set(STYLESHEET_HTML file:///usr/share/kde4/apps/ksgmltools2/customization/kde-nochunk.xsl)
50 if (DBUS_ENABLE_XML_DOCS)
52 macro (DOCBOOK _sources _format)
53 get_filename_component(_infile ${_sources} ABSOLUTE)
54 get_filename_component(_name ${_infile} NAME)
55 set(_deps ${CMAKE_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
57 if (${_format} STREQUAL "man")
58 string(REPLACE ".xml" "" _outname ${_name})
59 set(STYLESHEET ${STYLESHEET_MAN})
61 string(REPLACE ".xml" ".html" _outname ${_name})
62 set(STYLESHEET ${STYLESHEET_HTML})
65 set(_outfile ${CMAKE_CURRENT_BINARY_DIR}/${_outname})
66 if (EXISTS ${_sources})
67 if (MEINPROC4_EXECUTABLE)
70 COMMAND ${MEINPROC4_EXECUTABLE} --stylesheet ${STYLESHEET} -o ${_outfile} ${_infile}
71 DEPENDS ${_infile} ${STYLESHEET} ${_deps}
72 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
77 if (CYGPATH_EXECUTABLE)
79 COMMAND cygpath ${_infile}
80 OUTPUT_VARIABLE _infile)
82 execute_process(COMMAND dirname ${_infile} OUTPUT_VARIABLE _path)
83 string(STRIP ${_path} _path)
84 execute_process(COMMAND sh -c "cd ${_path}; pwd -W" OUTPUT_VARIABLE _path)
85 string(STRIP ${_path} _path)
86 set(_infile "${_path}/${_name}")
87 endif(CYGPATH_EXECUTABLE)
91 COMMAND ${XMLTO_EXECUTABLE} -vv ${_format} ${_infile}
92 DEPENDS ${_infile} ${_deps}
93 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
96 if (${_format} STREQUAL "man")
97 install(FILES ${_outfile} DESTINATION share/man/man1)
99 install(FILES ${_outfile} DESTINATION share/doc/dbus)
102 MESSAGE(STATUS "skipping xml doc generating for ${_infile}, file not found")
104 ADD_CUSTOM_TARGET(${_outname} DEPENDS ${_outfile})
105 ADD_DEPENDENCIES(xmldoc ${_outname})
108 ### copy tests to builddir so that generated tests and static tests
109 ### are all in one place.
110 ### todo how to add more filetypes
111 MACRO (COPYDIR _src _type)
112 FOREACH(FILE_TYPE ${_type})
114 FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
115 FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
116 FOREACH(FILE ${FILES})
117 GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
118 SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
119 configure_file(${FILE} ${TARGET} COPYONLY)
121 MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
122 ENDIF (CONFIG_VERBOSE)
125 ENDFOREACH(FILE_TYPE)
131 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-test-plan.xml html-nochunks)
132 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-tutorial.xml html-nochunks)
133 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-specification.xml html-nochunks)
134 DOCBOOK(${CMAKE_SOURCE_DIR}/../doc/dbus-faq.xml html-nochunks)
135 configure_file(${CMAKE_SOURCE_DIR}/../doc/dbus-cleanup-sockets.1.xml.in ${CMAKE_BINARY_DIR}/doc/dbus-cleanup-sockets.1.xml)
136 configure_file(${CMAKE_SOURCE_DIR}/../doc/dbus-daemon.1.xml.in ${CMAKE_BINARY_DIR}/doc/dbus-daemon.1.xml)
137 configure_file(${CMAKE_SOURCE_DIR}/../doc/dbus-launch.1.xml.in ${CMAKE_BINARY_DIR}/doc/dbus-launch.1.xml)
138 configure_file(${CMAKE_SOURCE_DIR}/../doc/dbus-monitor.1.xml.in ${CMAKE_BINARY_DIR}/doc/dbus-monitor.1.xml)
139 configure_file(${CMAKE_SOURCE_DIR}/../doc/dbus-send.1.xml.in ${CMAKE_BINARY_DIR}/doc/dbus-send.1.xml)
140 configure_file(${CMAKE_SOURCE_DIR}/../doc/dbus-test-tool.1.xml.in ${CMAKE_BINARY_DIR}/doc/dbus-test-tool.1.xml)
141 configure_file(${CMAKE_SOURCE_DIR}/../doc/dbus-update-activation-environment.1.xml.in ${CMAKE_BINARY_DIR}/doc/dbus-update-activation-environment.1.xml)
142 configure_file(${CMAKE_SOURCE_DIR}/../doc/dbus-uuidgen.1.xml.in ${CMAKE_BINARY_DIR}/doc/dbus-uuidgen.1.xml)
143 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-cleanup-sockets.1.xml html-nochunks)
144 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-daemon.1.xml html-nochunks)
145 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-launch.1.xml html-nochunks)
146 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-monitor.1.xml html-nochunks)
147 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-send.1.xml html-nochunks)
148 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-test-tool.1.xml html-nochunks)
149 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-uuidgen.1.xml html-nochunks)
150 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-update-activation-environment.1.xml html-nochunks)
152 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-daemon.1.xml man)
153 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-monitor.1.xml man)
154 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-send.1.xml man)
155 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-test-tool.1.xml man)
156 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-launch.1.xml man)
157 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-uuidgen.1.xml man)
158 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-cleanup-sockets.1.xml man)
159 DOCBOOK(${CMAKE_BINARY_DIR}/doc/dbus-update-activation-environment.1.xml man)
162 # handle html index file
164 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/index.html.cmake ${CMAKE_CURRENT_BINARY_DIR}/index.html )
165 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/index.html DESTINATION share/doc/dbus)
168 ${CMAKE_SOURCE_DIR}/../doc/busconfig.dtd
169 ${CMAKE_SOURCE_DIR}/../doc/introspect.dtd
170 ${CMAKE_SOURCE_DIR}/../doc/introspect.xsl
173 install(FILES ${EXTRA_DIST} DESTINATION share/doc/dbus)
175 endif(DBUS_ENABLE_XML_DOCS)