summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt10
-rwxr-xr-xcmake/config-ix.cmake7
-rw-r--r--docs/CMakeLists.txt31
3 files changed, 46 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b5cc73..3e56a3c 100644
--- a/CMakeLists.txt
+++ b/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/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 93046fe..681a4d6 100755
--- a/cmake/config-ix.cmake
+++ b/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/docs/CMakeLists.txt b/docs/CMakeLists.txt
new file mode 100644
index 0000000..505b5db
--- /dev/null
+++ b/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()