From 4d35b909ad3d144c7a33ff1b229c49bf1dc5cae4 Mon Sep 17 00:00:00 2001 From: Michael Gottesman Date: Sat, 24 Aug 2013 07:25:21 +0000 Subject: [PATCH] [autotools->cmake] Enable generation of doxygen documentation via cmake. I am going to add in a subsequent patch support for generating the llvm manpage. llvm-svn: 189164 --- llvm/CMakeLists.txt | 10 ++++++++-- llvm/cmake/config-ix.cmake | 7 +++++++ llvm/docs/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 llvm/docs/CMakeLists.txt diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 1b5cc731883e..3e56a3c03649 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -231,6 +231,10 @@ option(LLVM_BUILD_TESTS "Build LLVM unit tests. If OFF, just generate build targets." OFF) option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON) +option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF) +option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON) +option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm documentation." OFF) + # All options referred to from HandleLLVMOptions have to be specified # BEFORE this include, otherwise options will not be correctly set on # first cmake run @@ -465,6 +469,10 @@ if( LLVM_INCLUDE_TESTS ) ) endif() +if (LLVM_INCLUDE_DOCS) + add_subdirectory(docs) +endif() + add_subdirectory(cmake/modules) if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) @@ -497,8 +505,6 @@ if( NOT WIN32 ) endif() -# TODO: make and install documentation. - set(CPACK_PACKAGE_VENDOR "LLVM") set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR}) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 93046fe1b51d..681a4d629fe5 100755 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -460,3 +460,10 @@ if (LLVM_ENABLE_ZLIB ) endif() set(LLVM_PREFIX ${CMAKE_INSTALL_PREFIX}) + +if (LLVM_ENABLE_DOXYGEN) + message(STATUS "Doxygen enabled.") + find_package(Doxygen) +else() + message(STATUS "Doxygen disabled.") +endif() diff --git a/llvm/docs/CMakeLists.txt b/llvm/docs/CMakeLists.txt new file mode 100644 index 000000000000..505b5dbe939a --- /dev/null +++ b/llvm/docs/CMakeLists.txt @@ -0,0 +1,31 @@ + +if (LLVM_BUILD_DOCS) + set(LLVM_DOCS_ADD_TO_ALL ALL) +endif() + +if (DOXYGEN_FOUND) +if (LLVM_ENABLE_DOXYGEN) + set(abs_top_srcdir ${LLVM_MAIN_SRC_DIR}) + set(abs_top_builddir ${LLVM_BINARY_DIR}) + + if (HAVE_DOT) + set(DOT ${LLVM_PATH_DOT}) + endif() + + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxygen.cfg.in + ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg @ONLY) + set(abs_top_srcdir) + set(abs_top_builddir) + set(DOT) + + add_custom_target(doxygen ${LLVM_DOCS_ADD_TO_ALL} + COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating doxygen documentation." VERBATIM) + + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doxygen/html + DESTINATION docs/html) + endif() +endif() +endif()