mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
Help: Add option to generate docs with latexpdf
This commit is contained in:
@@ -133,6 +133,9 @@ if(CMake_INSTALL_COMPONENTS)
|
|||||||
if(SPHINX_QTHELP)
|
if(SPHINX_QTHELP)
|
||||||
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
|
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-qthelp)
|
||||||
endif()
|
endif()
|
||||||
|
if(SPHINX_LATEXPDF)
|
||||||
|
list(APPEND _CPACK_IFW_COMPONENTS_ALL sphinx-latexpdf)
|
||||||
|
endif()
|
||||||
if(CMake_BUILD_DEVELOPER_REFERENCE)
|
if(CMake_BUILD_DEVELOPER_REFERENCE)
|
||||||
if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
|
if(CMake_BUILD_DEVELOPER_REFERENCE_HTML)
|
||||||
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-html)
|
list(APPEND _CPACK_IFW_COMPONENTS_ALL cmake-developer-reference-html)
|
||||||
|
@@ -22,6 +22,7 @@ option(SPHINX_MAN "Build man pages with Sphinx" OFF)
|
|||||||
option(SPHINX_HTML "Build html help with Sphinx" OFF)
|
option(SPHINX_HTML "Build html help with Sphinx" OFF)
|
||||||
option(SPHINX_SINGLEHTML "Build html single page help with Sphinx" OFF)
|
option(SPHINX_SINGLEHTML "Build html single page help with Sphinx" OFF)
|
||||||
option(SPHINX_QTHELP "Build Qt help with Sphinx" OFF)
|
option(SPHINX_QTHELP "Build Qt help with Sphinx" OFF)
|
||||||
|
option(SPHINX_LATEXPDF "Build PDF help with Sphinx using LaTeX" OFF)
|
||||||
option(SPHINX_TEXT "Build text help with Sphinx (not installed)" OFF)
|
option(SPHINX_TEXT "Build text help with Sphinx (not installed)" OFF)
|
||||||
find_program(SPHINX_EXECUTABLE
|
find_program(SPHINX_EXECUTABLE
|
||||||
NAMES sphinx-build
|
NAMES sphinx-build
|
||||||
@@ -33,7 +34,7 @@ separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}")
|
|||||||
mark_as_advanced(SPHINX_TEXT)
|
mark_as_advanced(SPHINX_TEXT)
|
||||||
mark_as_advanced(SPHINX_FLAGS)
|
mark_as_advanced(SPHINX_FLAGS)
|
||||||
|
|
||||||
if(NOT SPHINX_INFO AND NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_SINGLEHTML AND NOT SPHINX_QTHELP AND NOT SPHINX_TEXT)
|
if(NOT SPHINX_INFO AND NOT SPHINX_MAN AND NOT SPHINX_HTML AND NOT SPHINX_SINGLEHTML AND NOT SPHINX_QTHELP AND NOT SPHINX_TEXT AND NOT SPHINX_LATEXPDF)
|
||||||
return()
|
return()
|
||||||
elseif(NOT SPHINX_EXECUTABLE)
|
elseif(NOT SPHINX_EXECUTABLE)
|
||||||
message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!")
|
message(FATAL_ERROR "SPHINX_EXECUTABLE (sphinx-build) is not found!")
|
||||||
@@ -117,28 +118,51 @@ if(SPHINX_QTHELP)
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp
|
${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qhcp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
if(SPHINX_LATEXPDF)
|
||||||
|
list(APPEND doc_formats latexpdf)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(doc_format_outputs "")
|
set(doc_format_outputs "")
|
||||||
set(doc_format_last "")
|
set(doc_format_last "")
|
||||||
foreach(format ${doc_formats})
|
foreach(format ${doc_formats})
|
||||||
set(doc_format_output "doc_format_${format}")
|
set(doc_format_output "doc_format_${format}")
|
||||||
set(doc_format_log "build-${format}.log")
|
set(doc_format_log "build-${format}.log")
|
||||||
add_custom_command(
|
if(format STREQUAL "latexpdf")
|
||||||
OUTPUT ${doc_format_output}
|
# This format does not use builder (-b) but make_mode (-M) which expects
|
||||||
COMMAND ${SPHINX_EXECUTABLE}
|
# arguments in peculiar order
|
||||||
-c ${CMAKE_CURRENT_BINARY_DIR}
|
add_custom_command(
|
||||||
-d ${CMAKE_CURRENT_BINARY_DIR}/doctrees
|
OUTPUT ${doc_format_output}
|
||||||
-b ${format}
|
COMMAND ${SPHINX_EXECUTABLE}
|
||||||
${sphinx_flags}
|
-M ${format}
|
||||||
${CMake_SOURCE_DIR}/Help
|
${CMake_SOURCE_DIR}/Help
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${format}
|
${CMAKE_CURRENT_BINARY_DIR}/${format}
|
||||||
> ${doc_format_log} # log stdout, pass stderr
|
-c ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${${format}_extra_commands}
|
-d ${CMAKE_CURRENT_BINARY_DIR}/doctrees
|
||||||
DEPENDS ${doc_format_last}
|
${sphinx_flags}
|
||||||
COMMENT "sphinx-build ${format}: see Utilities/Sphinx/${doc_format_log}"
|
> ${doc_format_log} # log stdout, pass stderr
|
||||||
VERBATIM
|
${${format}_extra_commands}
|
||||||
)
|
DEPENDS ${doc_format_last}
|
||||||
|
COMMENT "sphinx-build ${format}: see Utilities/Sphinx/${doc_format_log}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
# other formats use standard builder (-b) mode
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${doc_format_output}
|
||||||
|
COMMAND ${SPHINX_EXECUTABLE}
|
||||||
|
-c ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
-d ${CMAKE_CURRENT_BINARY_DIR}/doctrees
|
||||||
|
-b ${format}
|
||||||
|
${sphinx_flags}
|
||||||
|
${CMake_SOURCE_DIR}/Help
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${format}
|
||||||
|
> ${doc_format_log} # log stdout, pass stderr
|
||||||
|
${${format}_extra_commands}
|
||||||
|
DEPENDS ${doc_format_last}
|
||||||
|
COMMENT "sphinx-build ${format}: see Utilities/Sphinx/${doc_format_log}"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
endif()
|
||||||
set_property(SOURCE ${doc_format_output} PROPERTY SYMBOLIC 1)
|
set_property(SOURCE ${doc_format_output} PROPERTY SYMBOLIC 1)
|
||||||
list(APPEND doc_format_outputs ${doc_format_output})
|
list(APPEND doc_format_outputs ${doc_format_output})
|
||||||
set(doc_format_last ${doc_format_output})
|
set(doc_format_last ${doc_format_output})
|
||||||
@@ -219,3 +243,10 @@ if(SPHINX_QTHELP)
|
|||||||
DESTINATION ${CMAKE_DOC_DIR} ${COMPONENT}
|
DESTINATION ${CMAKE_DOC_DIR} ${COMPONENT}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(SPHINX_LATEXPDF)
|
||||||
|
CMake_OPTIONAL_COMPONENT(sphinx-latexpdf)
|
||||||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/latexpdf/latex/CMake.pdf
|
||||||
|
DESTINATION ${CMAKE_DOC_DIR} ${COMPONENT}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
@@ -84,6 +84,7 @@ cmake_sphinx_info=""
|
|||||||
cmake_sphinx_man=""
|
cmake_sphinx_man=""
|
||||||
cmake_sphinx_html=""
|
cmake_sphinx_html=""
|
||||||
cmake_sphinx_qthelp=""
|
cmake_sphinx_qthelp=""
|
||||||
|
cmake_sphinx_latexpdf=""
|
||||||
cmake_sphinx_build=""
|
cmake_sphinx_build=""
|
||||||
cmake_sphinx_flags=""
|
cmake_sphinx_flags=""
|
||||||
|
|
||||||
@@ -662,6 +663,7 @@ Configuration:
|
|||||||
--sphinx-man build man pages with Sphinx
|
--sphinx-man build man pages with Sphinx
|
||||||
--sphinx-html build html help with Sphinx
|
--sphinx-html build html help with Sphinx
|
||||||
--sphinx-qthelp build qch help with Sphinx
|
--sphinx-qthelp build qch help with Sphinx
|
||||||
|
--sphinx-latexpdf build PDF with Sphinx using LaTeX
|
||||||
--sphinx-build=<sb> use <sb> as the sphinx-build executable
|
--sphinx-build=<sb> use <sb> as the sphinx-build executable
|
||||||
--sphinx-flags=<flags> pass <flags> to sphinx-build executable
|
--sphinx-flags=<flags> pass <flags> to sphinx-build executable
|
||||||
|
|
||||||
@@ -926,6 +928,7 @@ while test $# != 0; do
|
|||||||
--sphinx-man) cmake_sphinx_man="1" ;;
|
--sphinx-man) cmake_sphinx_man="1" ;;
|
||||||
--sphinx-html) cmake_sphinx_html="1" ;;
|
--sphinx-html) cmake_sphinx_html="1" ;;
|
||||||
--sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
|
--sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
|
||||||
|
--sphinx-latexpdf) cmake_sphinx_latexpdf="1" ;;
|
||||||
--sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
|
--sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
|
||||||
--sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
|
--sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
|
||||||
--help) cmake_usage ;;
|
--help) cmake_usage ;;
|
||||||
@@ -1917,6 +1920,11 @@ if test "x${cmake_sphinx_qthelp}" != "x"; then
|
|||||||
set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
|
set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE)
|
||||||
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
|
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
|
||||||
fi
|
fi
|
||||||
|
if test "x${cmake_sphinx_latexpdf}" != "x"; then
|
||||||
|
echo '
|
||||||
|
set (SPHINX_LATEXPDF "'"${cmake_sphinx_latexpdf}"'" CACHE BOOL "Build PDF help with Sphinx using LaTeX" FORCE)
|
||||||
|
' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
|
||||||
|
fi
|
||||||
if test "x${cmake_sphinx_build}" != "x"; then
|
if test "x${cmake_sphinx_build}" != "x"; then
|
||||||
echo '
|
echo '
|
||||||
set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
|
set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE)
|
||||||
|
Reference in New Issue
Block a user