Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / docs / CMakeLists.txt
blob5e420a2696329eb20e763a89c816b235845a55c6
2 if (DOXYGEN_FOUND)
3 if (LLVM_ENABLE_DOXYGEN)
4   set(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
5   set(abs_top_builddir ${CMAKE_CURRENT_BINARY_DIR})
7   if (HAVE_DOT)
8     set(DOT ${LLVM_PATH_DOT})
9   endif()
11   if (LLVM_DOXYGEN_EXTERNAL_SEARCH)
12     set(enable_searchengine "YES")
13     set(searchengine_url "${LLVM_DOXYGEN_SEARCHENGINE_URL}")
14     set(enable_server_based_search "YES")
15     set(enable_external_search "YES")
16     set(extra_search_mappings "${LLVM_DOXYGEN_SEARCH_MAPPINGS}")
17   else()
18     set(enable_searchengine "NO")
19     set(searchengine_url "")
20     set(enable_server_based_search "NO")
21     set(enable_external_search "NO")
22     set(extra_search_mappings "")
23   endif()
25   # If asked, configure doxygen for the creation of a Qt Compressed Help file.
26   option(LLVM_ENABLE_DOXYGEN_QT_HELP
27     "Generate a Qt Compressed Help file." OFF)
28   if (LLVM_ENABLE_DOXYGEN_QT_HELP)
29     set(LLVM_DOXYGEN_QCH_FILENAME "org.llvm.qch" CACHE STRING
30       "Filename of the Qt Compressed help file")
31     set(LLVM_DOXYGEN_QHP_NAMESPACE "org.llvm" CACHE STRING
32       "Namespace under which the intermediate Qt Help Project file lives")
33     set(LLVM_DOXYGEN_QHP_CUST_FILTER_NAME "${PACKAGE_STRING}" CACHE STRING
34       "See http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-filters")
35     set(LLVM_DOXYGEN_QHP_CUST_FILTER_ATTRS "${PACKAGE_NAME},${PACKAGE_VERSION}" CACHE STRING
36       "See http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes")
37     find_program(LLVM_DOXYGEN_QHELPGENERATOR_PATH qhelpgenerator
38       DOC "Path to the qhelpgenerator binary")
39     if (NOT LLVM_DOXYGEN_QHELPGENERATOR_PATH)
40       message(FATAL_ERROR "Failed to find qhelpgenerator binary")
41     endif()
43     set(llvm_doxygen_generate_qhp "YES")
44     set(llvm_doxygen_qch_filename "${LLVM_DOXYGEN_QCH_FILENAME}")
45     set(llvm_doxygen_qhp_namespace "${LLVM_DOXYGEN_QHP_NAMESPACE}")
46     set(llvm_doxygen_qhelpgenerator_path "${LLVM_DOXYGEN_QHELPGENERATOR_PATH}")
47     set(llvm_doxygen_qhp_cust_filter_name "${LLVM_DOXYGEN_QHP_CUST_FILTER_NAME}")
48     set(llvm_doxygen_qhp_cust_filter_attrs "${LLVM_DOXYGEN_QHP_CUST_FILTER_ATTRS}")
50   else()
51     set(llvm_doxygen_generate_qhp "NO")
52     set(llvm_doxygen_qch_filename "")
53     set(llvm_doxygen_qhp_namespace "")
54     set(llvm_doxygen_qhelpgenerator_path "")
55     set(llvm_doxygen_qhp_cust_filter_name "")
56     set(llvm_doxygen_qhp_cust_filter_attrs "")
57   endif()
59   option(LLVM_DOXYGEN_SVG
60     "Use svg instead of png files for doxygen graphs." OFF)
61   if (LLVM_DOXYGEN_SVG)
62     set(DOT_IMAGE_FORMAT "svg")
63   else()
64     set(DOT_IMAGE_FORMAT "png")
65   endif()
67   configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in
68     ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY)
70   set(abs_top_srcdir)
71   set(abs_top_builddir)
72   set(DOT)
73   set(enable_searchengine)
74   set(searchengine_url)
75   set(enable_server_based_search)
76   set(enable_external_search)
77   set(extra_search_mappings)
78   set(llvm_doxygen_generate_qhp)
79   set(llvm_doxygen_qch_filename)
80   set(llvm_doxygen_qhp_namespace)
81   set(llvm_doxygen_qhelpgenerator_path)
82   set(llvm_doxygen_qhp_cust_filter_name)
83   set(llvm_doxygen_qhp_cust_filter_attrs)
84   set(DOT_IMAGE_FORMAT)
86   add_custom_target(doxygen-llvm
87     COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg
88     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
89     COMMENT "Generating llvm doxygen documentation." VERBATIM)
91   if (LLVM_BUILD_DOCS)
92     add_dependencies(doxygen doxygen-llvm)
93   endif()
95   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
96     # ./ suffix is needed to copy the contents of html directory without
97     # appending html/ into LLVM_INSTALL_DOXYGEN_HTML_DIR.
98     install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html/.
99       COMPONENT doxygen-html
100       DESTINATION "${LLVM_INSTALL_DOXYGEN_HTML_DIR}")
101   endif()
102 endif()
103 endif()
105 if (LLVM_ENABLE_SPHINX)
106   include(AddSphinxTarget)
107   if (SPHINX_FOUND)
108     if (${SPHINX_OUTPUT_HTML})
109       add_sphinx_target(html llvm)
110     endif()
113     if (${SPHINX_OUTPUT_MAN})
114       add_sphinx_target(man llvm)
115       add_sphinx_target(man llvm-dwarfdump)
116       add_sphinx_target(man dsymutil)
117     endif()
119   endif()
120 endif()
122 list(FIND LLVM_BINDINGS_LIST ocaml uses_ocaml)
123 if( NOT uses_ocaml LESS 0 AND LLVM_ENABLE_OCAMLDOC )
124   set(doc_targets
125         ocaml_llvm
126         ocaml_llvm_all_backends
127         ocaml_llvm_analysis
128         ocaml_llvm_bitreader
129         ocaml_llvm_bitwriter
130         ocaml_llvm_executionengine
131         ocaml_llvm_irreader
132         ocaml_llvm_linker
133         ocaml_llvm_target
134         ocaml_llvm_transform_utils
135       )
137   foreach(llvm_target ${LLVM_TARGETS_TO_BUILD})
138     list(APPEND doc_targets ocaml_llvm_${llvm_target})
139   endforeach()
141   set(odoc_files)
142   foreach( doc_target ${doc_targets} )
143     get_target_property(odoc_file ${doc_target} OCAML_ODOC)
144     list(APPEND odoc_files -load ${odoc_file})
145   endforeach()
147   add_custom_target(ocaml_doc
148     COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html
149     COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html
150     COMMAND ${OCAMLFIND} ocamldoc -d ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html
151                                   -sort -colorize-code -html ${odoc_files}
152     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/_ocamldoc/style.css
153                                      ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html)
155   add_dependencies(ocaml_doc ${doc_targets})
157   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
158     # ./ suffix is needed to copy the contents of html directory without
159     # appending html/ into LLVM_INSTALL_OCAMLDOC_HTML_DIR.
160     install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html/.
161       COMPONENT ocamldoc-html
162       DESTINATION "${LLVM_INSTALL_OCAMLDOC_HTML_DIR}")
163   endif()
164 endif()