b95afd865c1ffb7eead5dca834a9a8669ba8cea1
[platform/upstream/doxygen.git] / doc / CMakeLists.txt
1 # vim:ts=4:sw=4:expandtab:autoindent:
2 #
3 # Copyright (C) 1997-2015 by Dimitri van Heesch.
4 #
5 # Permission to use, copy, modify, and distribute this software and its
6 # documentation under the terms of the GNU General Public License is hereby
7 # granted. No representations are made about the suitability of this software
8 # for any purpose. It is provided "as is" without express or implied warranty.
9 # See the GNU General Public License for more details.
10 #
11 # Documents produced by Doxygen are derivative works derived from the
12 # input used in their production; they are not affected by this license.
13
14 include (${TOP}/cmake/version.cmake)
15 string(TIMESTAMP DATE "%d-%m-%Y")
16
17 find_package(PythonInterp REQUIRED)
18 find_program(EPSTOPDF NAMES epstopdf )
19 find_program(PDFLATEX NAMES pdflatex )
20 find_program(MAKEINDEX NAMES makeindex )
21 include(GNUInstallDirs)
22
23 if (doxygen_BINARY_DIR)
24     set(DOXYGEN_EXECUTABLE ${doxygen_BINARY_DIR}/bin/doxygen)
25 else()
26     # when building only the doxygen_doc, from the doc/ directory, the
27     # doxygen project variables are unknown so look for doxygen in PATH
28     find_package(Doxygen)
29 endif()
30
31 set(DOC_INSTALL_DIR "share/doc/packages/doxygen" CACHE STRING "Relative path where to install the documentation")
32 set(DOC_FILES
33         arch.doc
34         archoverview.eps
35         archoverview.gif
36         autolink.doc
37         changelog.doc
38         commands.doc
39         custcmd.doc
40         customize.doc
41         diagrams.doc
42         docblocks.doc
43         Doxyfile
44         doxygen_manual.css
45         doxygen_usage.doc
46         doxywizard_expert.png
47         doxywizard.gif
48         doxywizard_main.png
49         doxywizard_menu.png
50         doxywizard_page1.png
51         doxywizard_page2.png
52         doxywizard_page3.png
53         doxywizard_page4.png
54         doxywizard_usage.doc
55         external.doc
56         extsearch.doc
57         extsearch_flow.dot
58         extsearch_flow.eps
59         extsearch_flow.png
60         faq.doc
61         features.doc
62         formulas.doc
63         tables.doc
64         grouping.doc
65         htmlcmds.doc
66         index.doc
67         index.hhp.txt
68         infoflow.eps
69         infoflow.fig
70         infoflow.png
71         install.doc
72         install_prefix
73         lists.doc
74         markdown.doc
75         output.doc
76         perlmod.doc
77         perlmod_tree.doc
78         preprocessing.doc
79         searching.doc
80         starting.doc
81         trouble.doc
82         xmlcmds.doc
83         language.tpl
84         maintainers.txt
85         translator.py
86 )
87 file(GLOB LANG_FILES "${TOP}/src/translator_??.h")
88
89 file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/man
90                     ${PROJECT_BINARY_DIR}/src
91                     ${PROJECT_BINARY_DIR}/doc)
92
93 file(COPY ${TOP}/VERSION                  DESTINATION ${PROJECT_BINARY_DIR}/)
94 file(COPY ${TOP}/src/translator.h         DESTINATION ${PROJECT_BINARY_DIR}/src/)
95 file(COPY ${TOP}/src/translator_adapter.h DESTINATION ${PROJECT_BINARY_DIR}/src/)
96 file(COPY ${LANG_FILES}                   DESTINATION ${PROJECT_BINARY_DIR}/src/)
97
98 foreach (f  ${DOC_FILES})
99 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/${f}
100     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/
101     DEPENDS ${CMAKE_SOURCE_DIR}/doc/${f}
102     )
103 set_source_files_properties(${PROJECT_BINARY_DIR}/doc/${f} PROPERTIES GENERATED 1)
104 list(APPEND OUT_DOC_FILES "${PROJECT_BINARY_DIR}/doc/${f}")
105 endforeach()
106
107 configure_file(${CMAKE_SOURCE_DIR}/doc/manual.sty         ${PROJECT_BINARY_DIR}/doc/manual.sty)
108 configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen_manual.tex ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex)
109 configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen.1          ${PROJECT_BINARY_DIR}/man/doxygen.1)
110 configure_file(${CMAKE_SOURCE_DIR}/doc/doxywizard.1       ${PROJECT_BINARY_DIR}/man/doxywizard.1)
111 configure_file(${CMAKE_SOURCE_DIR}/doc/doxysearch.1       ${PROJECT_BINARY_DIR}/man/doxysearch.1)
112 configure_file(${CMAKE_SOURCE_DIR}/doc/doxyindexer.1      ${PROJECT_BINARY_DIR}/man/doxyindexer.1)
113
114 # doc/language.doc (see tag Doxyfile:INPUT)
115 add_custom_command(
116         COMMAND ${PYTHON_EXECUTABLE} translator.py
117         DEPENDS ${PROJECT_BINARY_DIR}/doc/maintainers.txt ${PROJECT_BINARY_DIR}/doc/language.tpl ${PROJECT_BINARY_DIR}/doc/translator.py
118         OUTPUT language.doc
119         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc
120 )
121 set_source_files_properties(language.doc PROPERTIES GENERATED 1)
122
123 # doc/config.doc (see tag Doxyfile:INPUT)
124 add_custom_command(
125         COMMAND ${PYTHON_EXECUTABLE}  ${TOP}/src/configgen.py -doc ${TOP}/src/config.xml > config.doc
126         DEPENDS ${TOP}/src/config.xml ${TOP}/src/configgen.py
127         OUTPUT config.doc
128         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc/
129 )
130 set_source_files_properties(config.doc PROPERTIES GENERATED 1)
131 ################################################################################
132 add_custom_target(run_doxygen
133         COMMENT "Generating Latex and HTML documentation."
134         COMMAND ${DOXYGEN_EXECUTABLE}
135         DEPENDS ${PROJECT_BINARY_DIR}/doc/language.doc ${PROJECT_BINARY_DIR}/doc/config.doc
136         DEPENDS ${OUT_DOC_FILES}
137         DEPENDS examples
138         DEPENDS doxygen
139         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc/
140 )
141
142 add_custom_target(doxygen_pdf
143         COMMENT "Generating Doxygen Manual PDF."
144         COMMAND ${CMAKE_COMMAND} -E remove refman.tex
145         COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex  .
146         COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/manual.sty  .
147         COMMAND ${EPSTOPDF} ${CMAKE_SOURCE_DIR}/doc/doxygen_logo.eps --outfile=doxygen_logo.pdf
148         COMMAND ${PDFLATEX}  -shell-escape doxygen_manual.tex
149         COMMAND ${MAKEINDEX} doxygen_manual.idx
150         COMMAND ${PDFLATEX}  -shell-escape doxygen_manual.tex
151         DEPENDS run_doxygen
152         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/latex
153 )
154 add_custom_target(docs
155         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/doxygen_logo.gif      ${PROJECT_BINARY_DIR}/html/
156         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/doxygen_logo_low.gif  ${PROJECT_BINARY_DIR}/html/
157         DEPENDS ${PROJECT_BINARY_DIR}/man/doxygen.1
158                 ${PROJECT_BINARY_DIR}/man/doxywizard.1
159                 ${PROJECT_BINARY_DIR}/man/doxysearch.1
160                 ${PROJECT_BINARY_DIR}/man/doxyindexer.1
161                 doxygen_pdf
162         VERBATIM
163         )
164
165 ################################################################################
166 install(FILES
167         "${PROJECT_BINARY_DIR}/man/doxygen.1"
168         "${PROJECT_BINARY_DIR}/man/doxywizard.1"
169         "${PROJECT_BINARY_DIR}/man/doxysearch.1"
170         "${PROJECT_BINARY_DIR}/man/doxyindexer.1"
171         DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
172 )
173
174 install(FILES
175         "${PROJECT_BINARY_DIR}/latex/doxygen_manual.pdf"
176         DESTINATION "${CMAKE_INSTALL_PREFIX}/${DOC_INSTALL_DIR}"
177 )
178
179 install(DIRECTORY
180         "${PROJECT_BINARY_DIR}/html"
181         DESTINATION "${CMAKE_INSTALL_PREFIX}/${DOC_INSTALL_DIR}"
182 )