From 08ea3efb06dbd703088a81e232d2d59e1bbe3ca2 Mon Sep 17 00:00:00 2001 From: Alex Cunningham Date: Sat, 14 Jul 2012 21:39:59 +0000 Subject: [PATCH] Improved configurability of doxygen output - can choose output via cmake varialbles --- CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++-------- doc/Doxyfile.in | 4 ++-- 2 files changed, 35 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f87dff186..d11fc8e73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,12 +36,13 @@ else() set(GTSAM_UNSTABLE_AVAILABLE 0) endif() +# Check for doxygen availability +find_package(Doxygen) # Configurable Options option(GTSAM_BUILD_TESTS "Enable/Disable building of tests" ON) option(GTSAM_BUILD_TIMING "Enable/Disable building of timing scripts" ON) option(GTSAM_BUILD_EXAMPLES "Enable/Disable building of examples" ON) -option(GTSAM_BUILD_DOCS "Enable/Disable building of doxygen docs" OFF) if(GTSAM_UNSTABLE_AVAILABLE) option(GTSAM_BUILD_UNSTABLE "Enable/Disable libgtsam_unstable" ON) endif() @@ -155,18 +156,40 @@ endif(GTSAM_BUILD_UNSTABLE) GtsamMakeConfigFile(GTSAM) export(TARGETS ${GTSAM_EXPORTED_TARGETS} FILE GTSAM-exports.cmake) -# add a target to generate API documentation with Doxygen -if (GTSAM_BUILD_DOCS) - find_package(Doxygen) - if(DOXYGEN_FOUND) +# Doxygen documentation configuration +if (DOXYGEN_FOUND) + option(GTSAM_BUILD_DOCS "Enable/Disable building of doxygen docs" OFF) + + # configure doxygen + option(GTSAM_BUILD_DOC_HTML "Enable/Disable doxygen HTML output" ON) + option(GTSAM_BUILD_DOC_LATEX "Enable/Disable doxygen LaTeX output" OFF) + + # add a target to generate API documentation with Doxygen + if (GTSAM_BUILD_DOCS) + # Convert configuration to YES/NO variables + if (GTSAM_BUILD_DOC_HTML) + set(GTSAM_BUILD_DOC_HTML_YN "YES") + else() + set(GTSAM_BUILD_DOC_HTML_YN "NO") + endif() + + if (GTSAM_BUILD_DOC_LATEX) + set(GTSAM_BUILD_DOC_LATEX_YN "YES") + else() + set(GTSAM_BUILD_DOC_LATEX_YN "NO") + endif() + + # Generate Doxyfile configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + + # Add target to actually build documentation as configured add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc COMMENT "Generating API documentation with Doxygen" VERBATIM ) - endif(DOXYGEN_FOUND) -endif (GTSAM_BUILD_DOCS) + endif() +endif () # Set up CPack set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTSAM") @@ -191,7 +214,9 @@ message(STATUS "Build flags ") print_config_flag(${GTSAM_BUILD_TIMING} "Build Timing scripts ") print_config_flag(${GTSAM_BUILD_EXAMPLES} "Build Examples ") print_config_flag(${GTSAM_BUILD_TESTS} "Build Tests ") -print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ") +if (DOXYGEN_FOUND) + print_config_flag(${GTSAM_BUILD_DOCS} "Build Docs ") +endif() if(NOT MSVC) print_config_flag(${GTSAM_BUILD_SHARED_LIBRARY} "Build shared GTSAM Library ") print_config_flag(${GTSAM_BUILD_STATIC_LIBRARY} "Build static GTSAM Library ") diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 1c767e584..b6030a567 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -880,7 +880,7 @@ IGNORE_PREFIX = # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. -GENERATE_HTML = YES +GENERATE_HTML = @GTSAM_BUILD_DOC_HTML_YN@ # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be @@ -1234,7 +1234,7 @@ SERVER_BASED_SEARCH = NO # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. -GENERATE_LATEX = NO +GENERATE_LATEX = @GTSAM_BUILD_DOC_LATEX_YN@ # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be