diff options
author | Gerald Combs <gerald@wireshark.org> | 2021-07-28 10:23:50 -0700 |
---|---|---|
committer | Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org> | 2021-07-30 21:05:37 +0000 |
commit | b58edf3cb8bc56f09b2011df931a3fa5e40c66ce (patch) | |
tree | 8780eb97263db07a4de4468bfdce2c3389d71797 /cmake | |
parent | d886837df96a15a0af5bc1c6955e2bddb1cff8ea (diff) |
Docs: Add epub targets for the guides.
Add user_guide_epub and developer_guide_epub targets that generate
EPUB versions of the User's Guide and Developer's Guide.
Ping #17494.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/FindAsciidoctor.cmake | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/cmake/modules/FindAsciidoctor.cmake b/cmake/modules/FindAsciidoctor.cmake index a452d4af22..f9d61e5c80 100644 --- a/cmake/modules/FindAsciidoctor.cmake +++ b/cmake/modules/FindAsciidoctor.cmake @@ -177,6 +177,53 @@ if(ASCIIDOCTOR_EXECUTABLE) endif(ASCIIDOCTOR_PDF_EXECUTABLE) + FIND_PROGRAM(ASCIIDOCTOR_EPUB_EXECUTABLE + NAMES + asciidoctorj + asciidoctor-epub3 + PATHS + /bin + /usr/bin + /usr/local/bin + ${CHOCOLATEY_BIN_PATH} + DOC "Path to Asciidoctor EPUB3 or AsciidoctorJ" + ) + + if(ASCIIDOCTOR_EPUB_EXECUTABLE) + + set(_asciidoctor_epub_common_command + ${CMAKE_COMMAND} -E env TZ=UTC ASCIIDOCTORJ_OPTS="${_asciidoctorj_opts}" + ${ASCIIDOCTOR_EPUB_EXECUTABLE} + --backend epub3 + ${_asciidoctor_common_args} + ) + + MACRO(ASCIIDOCTOR2EPUB _asciidocsource) + GET_FILENAME_COMPONENT(_source_base_name ${_asciidocsource} NAME_WE ) + set(_output_epub ${_source_base_name}.epub) + + ADD_CUSTOM_COMMAND( + OUTPUT + ${_output_epub} + COMMAND ${_asciidoctor_epub_common_command} + --out-file ${_output_epub} + ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource} + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/${_asciidocsource} + ${ARGN} + ) + add_custom_target(generate_${_output_epub} DEPENDS ${_output_epub}) + set_asciidoctor_target_properties(generate_${_output_epub}) + unset(_output_epub) + ENDMACRO() + + else(ASCIIDOCTOR_EPUB_EXECUTABLE) + + MACRO(ASCIIDOCTOR2EPUB _asciidocsource) + ENDMACRO() + + endif(ASCIIDOCTOR_EPUB_EXECUTABLE) + endif(ASCIIDOCTOR_EXECUTABLE) include( FindPackageHandleStandardArgs ) |