From 66bcbdb44bd7a67e7f0260f7a3efb02b83e8a1ac Mon Sep 17 00:00:00 2001 From: David Fillmore Date: Wed, 13 Mar 2024 13:37:13 -0600 Subject: [PATCH] Added docs/CMakeLists.txt from MICM, with doxygen sections removed. --- CMakeLists.txt | 6 ++++++ docs/CMakeLists.txt | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 docs/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 0df69e45..a801b058 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,8 @@ message(STATUS "Making MUSICA-Fortran sources installable : ${MAKE_MUSICA_FORTRA ################################################################################ # Projet wide setup options +option(MUSICA_BUILD_DOCS "Build the documentation" OFF) + cmake_dependent_option( ENABLE_TESTS "Builds tests that ensures each enabled MUSICA component can be used" ON "USE_MUSICA" OFF) message(STATUS "Build tests for MUSICA : ${ENABLE_TESTS}") @@ -109,6 +111,10 @@ if(USE_MUSICA_FORTRAN) add_subdirectory(musica-fortran) endif() +if(MUSICA_BUILD_DOCS) + add_subdirectory(docs) +endif() + ################################################################################ # Tests if(ENABLE_TESTS) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt new file mode 100644 index 00000000..5e14eef1 --- /dev/null +++ b/docs/CMakeLists.txt @@ -0,0 +1,20 @@ +################################################################################ +# Sphinx + +set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/source) +set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/sphinx) +set(SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html) + +add_custom_command( + OUTPUT ${SPHINX_INDEX_FILE} __fake_file_to_ensure_this_always_run + COMMAND + ${SPHINX_EXECUTABLE} -b html + ${SPHINX_SOURCE} ${SPHINX_BUILD} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py + COMMENT "Generating documentation with Sphinx" + # run this command each time. This way we don't have to keep track of each individual rst file + BuildDocs +) + +add_custom_target(docs ALL DEPENDS ${SPHINX_INDEX_FILE} Doxygen)