1 2if (DOXYGEN_FOUND) 3if (LLVM_ENABLE_DOXYGEN) 4 set(abs_top_srcdir ${LLVM_MAIN_SRC_DIR}) 5 set(abs_top_builddir ${LLVM_BINARY_DIR}) 6 7 if (HAVE_DOT) 8 set(DOT ${LLVM_PATH_DOT}) 9 endif() 10 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() 24 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() 42 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}") 49 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() 58 59 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in 60 ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY) 61 62 set(abs_top_srcdir) 63 set(abs_top_builddir) 64 set(DOT) 65 set(enable_searchengine) 66 set(searchengine_url) 67 set(enable_server_based_search) 68 set(enable_external_search) 69 set(extra_search_mappings) 70 set(llvm_doxygen_generate_qhp) 71 set(llvm_doxygen_qch_filename) 72 set(llvm_doxygen_qhp_namespace) 73 set(llvm_doxygen_qhelpgenerator_path) 74 set(llvm_doxygen_qhp_cust_filter_name) 75 set(llvm_doxygen_qhp_cust_filter_attrs) 76 77 add_custom_target(doxygen-llvm 78 COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg 79 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} 80 COMMENT "Generating llvm doxygen documentation." VERBATIM) 81 82 if (LLVM_BUILD_DOCS) 83 add_dependencies(doxygen doxygen-llvm) 84 endif() 85 86 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 87 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html 88 DESTINATION docs/html) 89 endif() 90endif() 91endif() 92 93if (LLVM_ENABLE_SPHINX) 94 if (SPHINX_FOUND) 95 include(AddSphinxTarget) 96 if (${SPHINX_OUTPUT_HTML}) 97 add_sphinx_target(html llvm) 98 endif() 99 100 101 if (${SPHINX_OUTPUT_MAN}) 102 add_sphinx_target(man llvm) 103 endif() 104 105 endif() 106endif() 107 108list(FIND LLVM_BINDINGS_LIST ocaml uses_ocaml) 109if( NOT uses_ocaml LESS 0 ) 110 set(doc_targets 111 ocaml_llvm 112 ocaml_llvm_all_backends 113 ocaml_llvm_analysis 114 ocaml_llvm_bitreader 115 ocaml_llvm_bitwriter 116 ocaml_llvm_executionengine 117 ocaml_llvm_irreader 118 ocaml_llvm_linker 119 ocaml_llvm_target 120 ocaml_llvm_ipo 121 ocaml_llvm_passmgr_builder 122 ocaml_llvm_scalar_opts 123 ocaml_llvm_transform_utils 124 ocaml_llvm_vectorize 125 ) 126 127 foreach(llvm_target ${LLVM_TARGETS_TO_BUILD}) 128 list(APPEND doc_targets ocaml_llvm_${llvm_target}) 129 endforeach() 130 131 set(odoc_files) 132 foreach( doc_target ${doc_targets} ) 133 get_target_property(odoc_file ${doc_target} OCAML_ODOC) 134 list(APPEND odoc_files -load ${odoc_file}) 135 endforeach() 136 137 add_custom_target(ocaml_doc 138 COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html 139 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html 140 COMMAND ${OCAMLFIND} ocamldoc -d ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html 141 -sort -colorize-code -html ${odoc_files}) 142 143 add_dependencies(ocaml_doc ${doc_targets}) 144 145 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) 146 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ocamldoc/html 147 DESTINATION docs/ocaml/html) 148 endif() 149endif() 150