CMakeLists.txt 6.53 KB
Newer Older
1
2
3
#
# api documentation
#
Ralf Habacker's avatar
Ralf Habacker committed
4
5
find_package(Doxygen)

6
7
8
# build doc always
add_custom_target(doc ALL)

Ralf Habacker's avatar
Ralf Habacker committed
9
if(DOXYGEN_EXECUTABLE)
10
    option(DBUS_ENABLE_DOXYGEN_DOCS "build DOXYGEN documentation (requires Doxygen)" ON)
11
endif()
Ralf Habacker's avatar
Ralf Habacker committed
12

13
14
if(DBUS_ENABLE_DOXYGEN_DOCS)
    set(top_srcdir ${CMAKE_SOURCE_DIR})
15
    configure_file(../Doxyfile.in ${CMAKE_BINARY_DIR}/Doxyfile )
16
17
    add_custom_command(
        OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/api/html/index.html
Ralf Habacker's avatar
Ralf Habacker committed
18
        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
19
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
Ralf Habacker's avatar
Ralf Habacker committed
20
    )
21
22
23
24
25
26
    add_custom_target(apidoc
        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/Doxyfile
        WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
    )
    add_dependencies(doc apidoc)
    add_custom_target(devhelp2
27
28
        DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/api/html/index.html ${CMAKE_CURRENT_BINARY_DIR}/dbus.devhelp2
    )
29
    add_dependencies(doc devhelp2)
30
    install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/api/html/ DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus/api)
31
endif()
32

33
34
35
36
37
38
39
40
41
find_program(XSLTPROC_EXECUTABLE xsltproc)
if(XSLTPROC_EXECUTABLE)
    message(STATUS "${XSLTPROC_EXECUTABLE} found")
    set(DBUS_HAVE_XSLTPROC 1)
endif()

if(DBUS_HAVE_XSLTPROC)
    add_custom_command(
        OUTPUT dbus.devhelp2
42
43
        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
44
45
        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    )
46
    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus.devhelp2 DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus)
47
48
endif()

49
#
50
# docbook based documentation
51
# 
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
find_package(DocBookXSL)

if(DOCBOOKXSL_DIR AND XSLTPROC_EXECUTABLE)
    option(DBUS_ENABLE_XML_DOCS "build XML documentation" ON)
    set(DBUS_XML_DOCS_ENABLED 1)
    message(STATUS "xsltproc docbook generator found")
    add_custom_target(xmldoc)
    add_dependencies(doc xmldoc)
endif()

if(DBUS_ENABLE_XML_DOCS)

macro(DOCBOOK _sources _format)
    get_filename_component(_infile ${_sources} ABSOLUTE)
    get_filename_component(_name ${_infile} NAME)
    if(${_format} STREQUAL "man")
        string(REPLACE ".xml" "" _outname ${_name})
        set(STYLESHEET "${DOCBOOKXSL_DIR}/manpages/docbook.xsl")
    else()
        string(REPLACE ".xml" ".html" _outname ${_name})
        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}
            )
82
        endif()
83
        add_dependencies(xmldoc ${_outname})
84
        if(${_format} STREQUAL "man")
85
            install(FILES ${_outfile} DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man1)
86
        else()
87
            install(FILES ${_outfile} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus)
88
89
90
91
        endif()
    else()
        message(STATUS "skipping xml doc generating for ${_infile}, file not found")
    endif()
92
endmacro()
93
94
95
96

### copy tests to builddir so that generated tests and static tests 
### are all in one place.
### todo how to add more filetypes 
97
98
99
100
101
102
103
104
macro(COPYDIR _src _type)
    foreach(FILE_TYPE ${_type})
        foreach(DIR ${_src})
            file(GLOB FILES "${DIR}/${FILE_TYPE}" )
            file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
            foreach(FILE ${FILES})
                get_filename_component(FILENAME ${FILE} NAME)
                set(TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
105
                configure_file(${FILE} ${TARGET} COPYONLY)
106
107
                if(CONFIG_VERBOSE)
                    message("FROM: ${FILE}\nTO: ${TARGET}\n")
108
109
110
111
112
                endif()
            endforeach()
        endforeach()
    endforeach()
endmacro()
113
114
115
116

COPYDIR(doc *.png)
COPYDIR(doc *.svg)

117
118
119
120
121
122
123
124
125
126
127
128
129
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-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)
130
if(UNIX)
131
132
133
134
135
136
137
138
    docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-daemon.1.xml man)
    docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-monitor.1.xml man)
    docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-send.1.xml man)
    docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-test-tool.1.xml man)
    docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-launch.1.xml man)
    docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-uuidgen.1.xml man)
    docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-cleanup-sockets.1.xml man)
    docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-update-activation-environment.1.xml man)
139
endif()
140
141
142
143
144
145
146
147
docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-daemon.1.xml html)
docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-monitor.1.xml html)
docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-send.1.xml html)
docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-test-tool.1.xml html)
docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-launch.1.xml html)
docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-uuidgen.1.xml html)
docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-cleanup-sockets.1.xml html)
docbook(${CMAKE_CURRENT_BINARY_DIR}/dbus-update-activation-environment.1.xml html)
148

149
150
151
#
# handle html index file
#
152
configure_file(index.html.in ${CMAKE_CURRENT_BINARY_DIR}/index.html)
153
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/index.html DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus)
154

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#
# misc files
#
set(DTD_DATA
    diagram.png
    diagram.svg
)

install(FILES ${DTD_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus)

set(DOC_DATA
    system-activation.txt
)

install(FILES ${DOC_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/dbus)

171
set(EXTRA_DIST
172
173
174
    busconfig.dtd
    introspect.dtd
    introspect.xsl
175
176
)

177
install(FILES ${EXTRA_DIST} DESTINATION ${CMAKE_INSTALL_DATADIR}/xml/dbus-1)
178

179
endif()