CMake: Try to make our man page builds faster.

Depend on our generator targets instead of the generated files, which
allows parallel builds outside of Ninja. Don't reserve JRE memory when
building HTML and man page targets. This reduces the "docs" target build
time on my Windows VM here from over two minutes to under one.
pespin/rlcmac
Gerald Combs 2021-10-13 14:03:31 -07:00 committed by Wireshark GitLab Utility
parent 1e18f79373
commit 74747c4d2f
2 changed files with 21 additions and 13 deletions

View File

@ -50,6 +50,12 @@ if(ASCIIDOCTOR_EXECUTABLE)
)
set(_asciidoctor_common_command
${CMAKE_COMMAND} -E env TZ=UTC
${ASCIIDOCTOR_EXECUTABLE}
${_asciidoctor_common_args}
)
set(_asciidoctor_docbook_common_command
${CMAKE_COMMAND} -E env TZ=UTC ASCIIDOCTORJ_OPTS=${_asciidoctorj_opts}
${ASCIIDOCTOR_EXECUTABLE}
${_asciidoctor_common_args}
@ -62,7 +68,7 @@ if(ASCIIDOCTOR_EXECUTABLE)
add_custom_command(
OUTPUT
${_output_xml}
COMMAND ${_asciidoctor_common_command}
COMMAND ${_asciidoctor_docbook_common_command}
--backend docbook
--out-file ${_output_xml}
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
@ -112,12 +118,12 @@ if(ASCIIDOCTOR_EXECUTABLE)
set( _output_txt ${_source_base_name}.txt )
ADD_CUSTOM_COMMAND(
OUTPUT
OUTPUT
${_output_txt}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/html2text.py
${_output_html}
> ${_output_txt}
DEPENDS
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource}
${_output_html}
${ARGN}

View File

@ -20,16 +20,19 @@ add_custom_command(
${CMAKE_SOURCE_DIR}/AUTHORS
)
set(MAN_TARGETS)
set(HTML_TARGETS)
set(MAN1_INSTALL_FILES)
set(MAN4_INSTALL_FILES)
set(HTML_INSTALL_FILES)
macro (ASCIIDOCTOR2MANHTML _page_name _man_section)
if(ASCIIDOCTOR_FOUND)
ASCIIDOCTOR2HTML(${_page_name}.adoc)
ASCIIDOCTOR2MAN(${_page_name}.adoc ${_man_section})
list(APPEND HTML_INSTALL_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_page_name}.html)
list(APPEND HTML_TARGETS generate_${_page_name}.html)
list(APPEND MAN_TARGETS generate_${_page_name}.${_man_section})
if (${_man_section} EQUAL 1)
list(APPEND MAN1_INSTALL_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_page_name}.${_man_section})
elseif (${_man_section} EQUAL 4)
@ -83,21 +86,20 @@ if (BUILD_xxx2deb)
ASCIIDOCTOR2MANHTML(idl2deb 1)
endif()
set(BUNDLE_RESOURCE_SHARE_MAN1_FILES ${MAN1_INSTALL_FILES} PARENT_SCOPE)
set(BUNDLE_RESOURCE_SHARE_MAN4_FILES ${MAN4_INSTALL_FILES} PARENT_SCOPE)
set(BUNDLE_RESOURCE_SHARE_MAN1_FILES ${MAN_TARGETS} PARENT_SCOPE)
set(BUNDLE_RESOURCE_SHARE_MAN4_FILES ${MAN4_INSTALL_TARGETS} PARENT_SCOPE)
add_custom_target(manpages DEPENDS
${MAN1_INSTALL_FILES}
${MAN4_INSTALL_FILES}
${MAN_TARGETS}
${MAN4_INSTALL_TARGETS}
)
add_custom_target(
docs ALL
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/AUTHORS-SHORT
${MAN1_INSTALL_FILES}
${MAN4_INSTALL_FILES}
${HTML_INSTALL_FILES}
${MAN_TARGETS}
${HTML_TARGETS}
)
set_target_properties(docs PROPERTIES FOLDER "Docs")