Imported Upstream version 1.8.15
[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 output directory for some extra HTML files
32 #
33 file(STRINGS Doxyfile DOXY_HTML_OUTPUT REGEX "HTML_OUTPUT.*")
34 string(LENGTH "${DOXY_HTML_OUTPUT}" DOXY_HTML_OUTPUT_LEN)
35 if (${DOXY_HTML_OUTPUT_LEN})
36   string(REGEX REPLACE ".*HTML_OUTPUT *= *\([^ ]*\)" "\\1" DOXY_HTML_OUTPUT ${DOXY_HTML_OUTPUT})
37 else()
38   set(DOXY_HTML_OUTPUT "html")
39 endif()
40 set(PROJECT_BINARY_HTML_DIR ${PROJECT_BINARY_DIR}/${DOXY_HTML_OUTPUT}/)
41
42 set(DOC_INSTALL_DIR "share/doc/packages/doxygen" CACHE STRING "Relative path where to install the documentation")
43 set(DOC_FILES
44         arch.doc
45         archoverview.eps
46         archoverview.gif
47         autolink.doc
48         changelog.doc
49         commands.doc
50         custcmd.doc
51         customize.doc
52         diagrams.doc
53         docblocks.doc
54         Doxyfile
55         doxygen_manual.css
56         doxygen_usage.doc
57         doxywizard_expert.png
58         doxywizard.gif
59         doxywizard_main.png
60         doxywizard_menu.png
61         doxywizard_page1.png
62         doxywizard_page2.png
63         doxywizard_page3.png
64         doxywizard_page4.png
65         doxywizard_usage.doc
66         external.doc
67         extsearch.doc
68         extsearch_flow.dot
69         extsearch_flow.eps
70         extsearch_flow.png
71         faq.doc
72         features.doc
73         formulas.doc
74         tables.doc
75         grouping.doc
76         htmlcmds.doc
77         index.doc
78         index.hhp.txt
79         infoflow.eps
80         infoflow.fig
81         infoflow.png
82         install.doc
83         install_prefix
84         lists.doc
85         markdown.doc
86         output.doc
87         perlmod.doc
88         perlmod_tree.doc
89         preprocessing.doc
90         searching.doc
91         starting.doc
92         trouble.doc
93         xmlcmds.doc
94         emojisup.doc
95         language.tpl
96         maintainers.txt
97         translator.py
98         smile.png
99 )
100 file(GLOB LANG_FILES "${TOP}/src/translator_??.h")
101
102 file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/man
103                     ${PROJECT_BINARY_DIR}/src
104                     ${PROJECT_BINARY_DIR}/doc)
105
106 file(COPY ${TOP}/VERSION                  DESTINATION ${PROJECT_BINARY_DIR}/)
107 file(COPY ${TOP}/src/translator.h         DESTINATION ${PROJECT_BINARY_DIR}/src/)
108 file(COPY ${TOP}/src/translator_adapter.h DESTINATION ${PROJECT_BINARY_DIR}/src/)
109 file(COPY ${LANG_FILES}                   DESTINATION ${PROJECT_BINARY_DIR}/src/)
110
111 foreach (f  ${DOC_FILES})
112 add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/${f}
113     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/
114     DEPENDS ${CMAKE_SOURCE_DIR}/doc/${f}
115     )
116 set_source_files_properties(${PROJECT_BINARY_DIR}/doc/${f} PROPERTIES GENERATED 1)
117 list(APPEND OUT_DOC_FILES "${PROJECT_BINARY_DIR}/doc/${f}")
118 endforeach()
119
120 configure_file(${CMAKE_SOURCE_DIR}/doc/manual.sty         ${PROJECT_BINARY_DIR}/doc/manual.sty)
121 configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen_manual.tex ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex)
122 configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen.1          ${PROJECT_BINARY_DIR}/man/doxygen.1)
123 configure_file(${CMAKE_SOURCE_DIR}/doc/doxywizard.1       ${PROJECT_BINARY_DIR}/man/doxywizard.1)
124 configure_file(${CMAKE_SOURCE_DIR}/doc/doxysearch.1       ${PROJECT_BINARY_DIR}/man/doxysearch.1)
125 configure_file(${CMAKE_SOURCE_DIR}/doc/doxyindexer.1      ${PROJECT_BINARY_DIR}/man/doxyindexer.1)
126
127 # doc/language.doc (see tag Doxyfile:INPUT)
128 add_custom_command(
129         COMMAND ${PYTHON_EXECUTABLE} translator.py ${CMAKE_SOURCE_DIR}
130         DEPENDS ${PROJECT_BINARY_DIR}/doc/maintainers.txt ${PROJECT_BINARY_DIR}/doc/language.tpl ${PROJECT_BINARY_DIR}/doc/translator.py
131         OUTPUT language.doc
132         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc
133 )
134 set_source_files_properties(language.doc PROPERTIES GENERATED 1)
135
136 # doc/config.doc (see tag Doxyfile:INPUT)
137 add_custom_command(
138         COMMAND ${PYTHON_EXECUTABLE}  ${TOP}/src/configgen.py -doc ${TOP}/src/config.xml > config.doc
139         DEPENDS ${TOP}/src/config.xml ${TOP}/src/configgen.py
140         OUTPUT config.doc
141         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc/
142 )
143 set_source_files_properties(config.doc PROPERTIES GENERATED 1)
144 ################################################################################
145 add_custom_target(run_doxygen
146         COMMENT "Generating Latex and HTML documentation."
147         COMMAND ${CMAKE_COMMAND} -E env VERSION=${VERSION} ${DOXYGEN_EXECUTABLE}
148         DEPENDS ${PROJECT_BINARY_DIR}/doc/language.doc ${PROJECT_BINARY_DIR}/doc/config.doc
149         DEPENDS ${OUT_DOC_FILES}
150         DEPENDS examples
151         DEPENDS doxygen
152         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc/
153 )
154
155 add_custom_target(doxygen_pdf
156         COMMENT "Generating Doxygen Manual PDF."
157         COMMAND ${CMAKE_COMMAND} -E remove refman.tex
158         COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex  .
159         COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/manual.sty  .
160         COMMAND ${EPSTOPDF} ${CMAKE_SOURCE_DIR}/doc/doxygen_logo.eps --outfile=doxygen_logo.pdf
161         COMMAND ${PDFLATEX}  -shell-escape doxygen_manual.tex
162         COMMAND ${MAKEINDEX} doxygen_manual.idx
163         COMMAND ${PDFLATEX}  -shell-escape doxygen_manual.tex
164         DEPENDS run_doxygen
165         WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/latex
166 )
167 add_custom_target(docs
168     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/doxygen_logo.gif      ${PROJECT_BINARY_HTML_DIR}
169     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/doxygen_logo_low.gif  ${PROJECT_BINARY_HTML_DIR}
170         DEPENDS ${PROJECT_BINARY_DIR}/man/doxygen.1
171                 ${PROJECT_BINARY_DIR}/man/doxywizard.1
172                 ${PROJECT_BINARY_DIR}/man/doxysearch.1
173                 ${PROJECT_BINARY_DIR}/man/doxyindexer.1
174                 doxygen_pdf
175         VERBATIM
176         )
177
178 ################################################################################
179 install(FILES
180         "${PROJECT_BINARY_DIR}/man/doxygen.1"
181         "${PROJECT_BINARY_DIR}/man/doxywizard.1"
182         "${PROJECT_BINARY_DIR}/man/doxysearch.1"
183         "${PROJECT_BINARY_DIR}/man/doxyindexer.1"
184         DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
185 )
186
187 install(FILES
188         "${PROJECT_BINARY_DIR}/latex/doxygen_manual.pdf"
189         DESTINATION "${CMAKE_INSTALL_PREFIX}/${DOC_INSTALL_DIR}"
190 )
191
192 install(DIRECTORY
193         "${PROJECT_BINARY_DIR}/html"
194         DESTINATION "${CMAKE_INSTALL_PREFIX}/${DOC_INSTALL_DIR}"
195 )