refactor(doc): Enable only if sphinx is available

This commit is contained in:
patrick96 2018-12-14 16:16:20 +01:00 committed by Patrick Ziegler
parent 73de9257a1
commit 5b7bb2514e
3 changed files with 14 additions and 7 deletions

View File

@ -58,7 +58,9 @@ include(03-libs)
include(04-targets)
include(05-summary)
if(BUILD_DOC)
add_subdirectory(doc)
endif()
add_subdirectory(doc/bash)
add_subdirectory(doc/zsh)
add_subdirectory(include)

View File

@ -1,6 +1,7 @@
#
# Build options
#
checklib(BUILD_DOC "binary" sphinx-build)
checklib(ENABLE_ALSA "pkg-config" alsa)
checklib(ENABLE_CURL "pkg-config" libcurl)
@ -30,7 +31,7 @@ option(CXXLIB_GCC "Link against stdlibc++" OFF)
option(BUILD_IPC_MSG "Build ipc messager" ON)
option(BUILD_TESTS "Build testsuite" OFF)
option(BUILD_TESTS "Build documentation" ON)
option(BUILD_DOC "Build documentation" ON)
option(ENABLE_ALSA "Enable alsa support" ON)
option(ENABLE_CURL "Enable curl support" ON)

View File

@ -1,7 +1,3 @@
if(NOT BUILD_DOC)
return()
endif()
#
# Generate configuration file
#
@ -98,6 +94,14 @@ install(FILES config
# }}}
# Documentation {{{
find_program(SPHINX_EXECUTABLE
NAMES sphinx-build
DOC "Sphinx Documentation Builder")
if(NOT SPHINX_EXECUTABLE)
message_colored(FATAL_ERROR "Failed to locate sphinx-build" 31)
endif()
configure_file(conf.py.in conf.py @ONLY)
set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build")
@ -115,7 +119,7 @@ foreach(builder ${doc_builders})
set(doc_target "doc_${builder}")
set(builder_log "builder-${builder}.log")
add_custom_target(${doc_target}
COMMAND sphinx-build
COMMAND ${SPHINX_EXECUTABLE}
-b ${builder}
-c "${CMAKE_CURRENT_BINARY_DIR}"
-d "${CMAKE_CURRENT_BINARY_DIR}/doctrees"