Skip to content

Commit

Permalink
CMake: Update build rules to link Sphinx and Doxygen
Browse files Browse the repository at this point in the history
  • Loading branch information
sayerhs committed Oct 2, 2017
1 parent e5377a5 commit 78c3a82
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set(CMAKE_PREFIX_PATH ${Trilinos_DIR} ${CMAKE_PREFIX_PATH})
option(ENABLE_WRFTONALU "Enable WRF to Nalu Fortran conversion utility" off)
option(ENABLE_SPHINX_DOCS "Enable Sphinx-based user/developer manual" off)
option(ENABLE_DOXYGEN_DOCS "Enable API documentation using Doxygen" off)
option(ENABLE_SPHINX_API_DOCS "Enable linking Doxygen API documentation to Sphinx" off)

find_package(MPI REQUIRED)
find_package(Trilinos REQUIRED)
Expand Down
7 changes: 4 additions & 3 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

add_custom_target(docs)

if (ENABLE_DOXYGEN_DOCS)
add_subdirectory(doxygen)
endif()

if (ENABLE_SPHINX_DOCS)
add_subdirectory(manual)
endif()

if (ENABLE_DOXYGEN_DOCS)
add_subdirectory(doxygen)
endif()
8 changes: 8 additions & 0 deletions doc/doxygen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ else()
OPTIONAL_COMPONENTS dot)
endif()

if (ENABLE_SPHINX_API_DOCS)
set(DOXYGEN_GENERATE_XML "YES"
CACHE STRING "Create XML tags for Sphinx Breathe")
else()
set(DOXYGEN_GENERATE_XML "NO"
CACHE STRING "Create XML tags for Sphinx Breathe")
endif()

configure_file(Doxyfile.in Doxyfile @ONLY)
add_custom_target(api-docs
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
Expand Down
2 changes: 1 addition & 1 deletion doc/doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,7 @@ MAN_LINKS = NO
# captures the structure of the code including all documentation.
# The default value is: NO.

GENERATE_XML = NO
GENERATE_XML = @DOXYGEN_GENERATE_XML@

# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
Expand Down
12 changes: 10 additions & 2 deletions doc/manual/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ endif()

find_package(LATEX COMPONENTS PDFLATEX BIBTEX)

if (ENABLE_SPHINX_API_DOCS)
set(SPHINX_OPTS "-t" "use_breathe")
else()
set(SPHINX_OPTS " ")
endif()

add_custom_target(sphinx-html
COMMAND ${SPHINX_EXE} -M html
"${CMAKE_CURRENT_SOURCE_DIR}/source" "${CMAKE_CURRENT_BINARY_DIR}"
-c ${CMAKE_CURRENT_SOURCE_DIR}/source)
-c ${CMAKE_CURRENT_SOURCE_DIR}/source ${SPHINX_OPTS})
add_dependencies(sphinx-html api-docs)

if (LATEX_FOUND)
add_custom_target(sphinx-pdf
COMMAND ${SPHINX_EXE} -M latexpdf
"${CMAKE_CURRENT_SOURCE_DIR}/source" "${CMAKE_CURRENT_BINARY_DIR}"
-c ${CMAKE_CURRENT_SOURCE_DIR}/source)
-c ${CMAKE_CURRENT_SOURCE_DIR}/source ${SPHINX_OPTS})
add_dependencies(sphinx-pdf api-docs)
else()
message(WARNING "Disabling PDF generation because of missing pdflatex")
endif()
Expand Down
5 changes: 5 additions & 0 deletions doc/manual/source/user/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ previous section.

Boolean flag to enable extract source code documentation using Doxygen. Default: OFF.

.. cmakeval:: ENABLE_SPHINX_API_DOCS

Enable embedding API documentation generated from Doxygen within user and
developer manuals. Default: OFF.

Further fine-grained control of the build environment can be achieved by using
standard CMake flags, please see `CMake documentation
<https://cmake.org/cmake/help/v3.9/>`_ for details regarding these variables.
Expand Down

0 comments on commit 78c3a82

Please sign in to comment.