Add IgnoreOnIsolate=yes to dbus.service
[platform/upstream/dbus.git] / cmake / doc / CMakeLists.txt
1 find_package(Doxygen)
2
3 if(DOXYGEN_EXECUTABLE)
4   OPTION(DBUS_ENABLE_DOXYGEN_DOCS "build DOXYGEN documentation (requires Doxygen)" ON)
5 endif(DOXYGEN_EXECUTABLE)
6
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 )
10     add_custom_target(doc 
11         COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
12         WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
13     )
14 endif (DBUS_ENABLE_DOXYGEN_DOCS)
15
16 #
17 # find docbook generator
18
19 find_program(MEINPROC4_EXECUTABLE meinproc4)
20
21 find_program(XMLTO_EXECUTABLE xmlto)
22
23 find_program(CYGPATH_EXECUTABLE cygpath)
24
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)
29
30 if (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")
37
38 elseif (MEINPROC4_EXECUTABLE)
39         set(DOCBOOK_GENERATOR_NAME "meinproc4" PARENT_SCOPE)
40         set(DBUS_XML_DOCS_ENABLED 1)
41         if(WIN32)
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")
45         else(WIN32)
46                 set(STYLESHEET_HTML file:///usr/share/kde4/apps/ksgmltools2/customization/kde-nochunk.xsl)
47         endif(WIN32)
48 endif ()
49
50 if (DBUS_ENABLE_XML_DOCS)
51
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)
56
57   if (${_format} STREQUAL "man")
58     string(REPLACE ".xml" "" _outname ${_name})
59     set(STYLESHEET ${STYLESHEET_MAN})
60   else()
61     string(REPLACE ".xml" ".html" _outname ${_name})
62     set(STYLESHEET ${STYLESHEET_HTML})
63   endif ()
64
65   set(_outfile ${CMAKE_CURRENT_BINARY_DIR}/${_outname})
66   if (EXISTS ${_sources})
67           if (MEINPROC4_EXECUTABLE)
68                     ADD_CUSTOM_COMMAND(
69                         OUTPUT ${_outfile}
70                         COMMAND ${MEINPROC4_EXECUTABLE} --stylesheet ${STYLESHEET} -o ${_outfile} ${_infile}
71                         DEPENDS ${_infile} ${STYLESHEET} ${_deps}
72                         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
73                 )
74           endif ()
75           if (XMLTO_EXECUTABLE)
76                     if (MSYS)
77                         if (CYGPATH_EXECUTABLE)
78                             execute_process(
79                                 COMMAND cygpath ${_infile}
80                                 OUTPUT_VARIABLE _infile)
81                         else ()
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)
88                     endif (MSYS)
89                     ADD_CUSTOM_COMMAND(
90                         OUTPUT ${_outfile}
91                         COMMAND ${XMLTO_EXECUTABLE} -vv ${_format} ${_infile}
92                         DEPENDS ${_infile} ${_deps}
93                         WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
94                 )
95           endif ()
96           if (${_format} STREQUAL "man")
97                   install(FILES ${_outfile} DESTINATION share/man/man1)
98           else ()
99                   install(FILES ${_outfile} DESTINATION share/doc/dbus)
100           endif ()
101   else ()
102           MESSAGE(STATUS "skipping xml doc generating for ${_infile}, file not found")
103   endif ()
104   ADD_CUSTOM_TARGET(${_outname} DEPENDS ${_outfile})
105   ADD_DEPENDENCIES(xmldoc ${_outname})
106 endmacro (DOCBOOK)
107
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})
113         FOREACH(DIR ${_src})
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)
120                         IF (CONFIG_VERBOSE)
121                                 MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
122                         ENDIF (CONFIG_VERBOSE)
123                 ENDFOREACH(FILE)
124         ENDFOREACH(DIR)
125     ENDFOREACH(FILE_TYPE)
126 ENDMACRO (COPYDIR)
127
128 COPYDIR(doc *.png)
129 COPYDIR(doc *.svg)
130
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)
151 if (UNIX)
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)
160 endif()
161 #
162 # handle html index file
163 #
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)
166
167 set (EXTRA_DIST         
168         ${CMAKE_SOURCE_DIR}/../doc/busconfig.dtd                        
169         ${CMAKE_SOURCE_DIR}/../doc/introspect.dtd                       
170         ${CMAKE_SOURCE_DIR}/../doc/introspect.xsl
171 )
172
173 install(FILES ${EXTRA_DIST} DESTINATION share/doc/dbus)
174
175 endif(DBUS_ENABLE_XML_DOCS)