[autotools->cmake] Enable generation of doxygen documentation via cmake.

I am going to add in a subsequent patch support for generating the llvm
manpage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael Gottesman 2013-08-24 07:25:21 +00:00
parent 4a48389b27
commit 5b83d0c092
3 changed files with 46 additions and 2 deletions

View File

@ -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})

View File

@ -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()

31
docs/CMakeLists.txt Normal file
View File

@ -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()