extcap: Support for DisplayPort AUX channel monitors
[metze/wireshark/wip.git] / docbook / CMakeLists.txt
index 946411cf318aceb714c81c25928f5e07709f53d5..1ca527a840f0a0fcf77eacd576b46b55cdead8af 100644 (file)
@@ -4,26 +4,32 @@
 # By Gerald Combs <gerald@wireshark.org>
 # Copyright 1998 Gerald Combs
 #
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier: GPL-2.0-or-later
 #
 
-find_package( LYNX )
+# To do:
+# - Rename *.asciidoc to *.adoc
+# - Make the build targets top-level on Windows, similar to the NSIS,
+#   WiX, and PortableApps targets?
+
+find_package( Asciidoctor 1.5 )
 find_package( XSLTPROC )
-if(ENABLE_CHM_GUIDES)
+
+function(set_docbook_target_properties _target)
+       set_target_properties(${_target} PROPERTIES
+               FOLDER "Docbook"
+               EXCLUDE_FROM_DEFAULT_BUILD True
+               )
+endfunction(set_docbook_target_properties)
+
+if(WIN32)
        find_package( HTMLHelp )
        if(HTML_HELP_COMPILER)
                # We do not need the HTML Help headers and library, just the
                # compiler. To avoid confusion, report the package as found.
                # https://gitlab.kitware.com/cmake/cmake/issues/15886
                set(HTMLHelp_FOUND 1)
-       else()
-               message(FATAL_ERROR "HTML Help Compiler is not installed (required for ENABLE_CHM_GUIDES)")
        endif()
-endif()
-
-find_package( ASCIIDOC )
-
-if(WIN32)
        macro( HHP2CHM _hhpsource )
                get_filename_component( _source_base_name ${_hhpsource} NAME_WE )
 
@@ -72,6 +78,7 @@ set(WSUG_TOOLS_HELP_COMMANDS
 # being able to build our documentation.
 set(WSUG_TOOLS_HELP_FILES)
 set(WSUG_TOOLS_PHONY_DEPS)
+set(GUIDE_INSTALL_DIRS)
 
 # General help output
 foreach(th_command ${WSUG_TOOLS_HELP_COMMANDS})
@@ -111,6 +118,7 @@ add_custom_command(
 add_custom_target(update_tools_help
        DEPENDS ${WSUG_TOOLS_PHONY_DEPS}
 )
+set_docbook_target_properties(update_tools_help)
 
 set(WSUG_FILES
        wsug_src/WSUG_app_files.asciidoc
@@ -147,13 +155,22 @@ set(WSUG_GRAPHICS
        wsug_graphics/ws-bytes-pane-tabs.png
        wsug_graphics/ws-bytes-pane.png
        wsug_graphics/ws-capture-info.png
+       wsug_graphics/ws-capture-interface-details.png
        wsug_graphics/ws-capture-interfaces.png
        wsug_graphics/ws-capture-interfaces-win32.png
        wsug_graphics/ws-capture-menu.png
        wsug_graphics/ws-capture-options.png
+       wsug_graphics/ws-capture-options-compile-selected-bpfs.png
+       wsug_graphics/ws-capture-options-manage-interfaces-local.png
+       wsug_graphics/ws-capture-options-manage-interfaces-pipes.png
+       wsug_graphics/ws-capture-options-manage-interfaces-remote-plus.png
+       wsug_graphics/ws-capture-options-manage-interfaces-remote.png
+       wsug_graphics/ws-capture-options-manage-interfaces.png
+       wsug_graphics/ws-capture-options-output.png
        wsug_graphics/ws-capture-options-remote-capture.png
        wsug_graphics/ws-capture-options-remote-interface.png
        wsug_graphics/ws-capture-options-remote-settings.png
+       wsug_graphics/ws-capture-options-settings.png
        wsug_graphics/ws-capture-preferences.png
        wsug_graphics/ws-choose-color-rule.png
        wsug_graphics/ws-coloring-fields.png
@@ -161,7 +178,6 @@ set(WSUG_GRAPHICS
        wsug_graphics/ws-column-header-popup-menu.png
        wsug_graphics/ws-decode-as-show.png
        wsug_graphics/ws-decode-as.png
-       wsug_graphics/ws-column-header-popup-menu.png
        wsug_graphics/ws-details-pane-popup-menu.png
        wsug_graphics/ws-details-pane.png
        wsug_graphics/ws-display-filter-tcp.png
@@ -190,6 +206,7 @@ set(WSUG_GRAPHICS
        wsug_graphics/ws-gui-columns-preferences.png
        wsug_graphics/ws-gui-config-profiles.png
        wsug_graphics/ws-gui-font-preferences.png
+       wsug_graphics/ws-gui-interface-options.png
        wsug_graphics/ws-gui-layout-preferences.png
        wsug_graphics/ws-gui-preferences.png
        wsug_graphics/ws-help-menu.png
@@ -214,6 +231,7 @@ set(WSUG_GRAPHICS
        wsug_graphics/ws-save-as-gtk24.png
        wsug_graphics/ws-save-as-win32.png
        wsug_graphics/ws-statistics-menu.png
+       wsug_graphics/ws-stats-compare.png
        wsug_graphics/ws-stats-conversations.png
        wsug_graphics/ws-stats-endpoints.png
        wsug_graphics/ws-stats-hierarchy.png
@@ -225,8 +243,12 @@ set(WSUG_GRAPHICS
        wsug_graphics/ws-stats-lte-rlc-traffic.png
        wsug_graphics/ws-stats-wlan-traffic.png
        wsug_graphics/ws-statusbar-empty.png
+       wsug_graphics/ws-statusbar-filter.png
        wsug_graphics/ws-statusbar-loaded.png
+       wsug_graphics/ws-statusbar-profile.png
        wsug_graphics/ws-statusbar-selected.png
+       wsug_graphics/ws-tcp-analysis.png
+       wsug_graphics/ws-tel-rtpstream-analysis.png
        wsug_graphics/ws-telephony-menu.png
        wsug_graphics/ws-time-reference.png
        wsug_graphics/ws-tools-menu.png
@@ -347,11 +369,6 @@ set(WSLUA_MODULES
        ${CMAKE_SOURCE_DIR}/epan/wslua/wslua_struct.c
 )
 
-if(NOT ASCIIDOC_FOUND)
-       message(WARNING "AsciiDoc not found, cannot build documentation.")
-       return()
-endif()
-
 # Empty file to trigger wsluarm generation.
 ADD_CUSTOM_COMMAND(
        OUTPUT
@@ -370,36 +387,35 @@ ADD_CUSTOM_COMMAND(
 set( WSDG_BUILT_DEPS ws.css wsluarm )
 
 set( ASCIIDOC_CONF_FILES
-       asciidoc.conf
-       asciidoctor-asciidoc.conf
        attributes.asciidoc
+       # XXX Add macros
 )
 
-if(ENABLE_HTML_GUIDES OR ENABLE_PDF_GUIDES OR ENABLE_CHM_GUIDES)
+if(ASCIIDOCTOR_EXECUTABLE)
        # Generate the DocBook sources of user and developer guides
 
-       ASCIIDOC2DOCBOOK(user-guide.asciidoc ASCIIDOC_CONF_FILES WSUG_SOURCE WSUG_BUILT_DEPS)
+       ASCIIDOCTOR2DOCBOOK(user-guide.asciidoc ${ASCIIDOC_CONF_FILES} ${WSUG_SOURCE} ${WSUG_BUILT_DEPS})
        add_custom_target(user_guide_docbook DEPENDS generate_user-guide.xml)
-       set_target_properties(user_guide_docbook PROPERTIES FOLDER "Docbook")
+       set_docbook_target_properties(user_guide_docbook)
 
-       ASCIIDOC2DOCBOOK(developer-guide.asciidoc ASCIIDOC_CONF_FILES WSDG_SOURCE WSDG_BUILT_DEPS)
+       ASCIIDOCTOR2DOCBOOK(developer-guide.asciidoc ${ASCIIDOC_CONF_FILES} ${WSDG_SOURCE} ${WSDG_BUILT_DEPS})
        add_custom_target(developer_guide_docbook DEPENDS generate_developer-guide.xml)
-       set_target_properties(developer_guide_docbook PROPERTIES FOLDER "Docbook")
+       set_docbook_target_properties(developer_guide_docbook)
 
        # Top-level guide targets.
 
        add_custom_target(user_guides DEPENDS user_guide_docbook)
-       set_target_properties(user_guides PROPERTIES FOLDER "Docbook")
+       set_docbook_target_properties(user_guides)
 
        add_custom_target(developer_guides DEPENDS developer_guide_docbook)
-       set_target_properties(developer_guides PROPERTIES FOLDER "Docbook")
+       set_docbook_target_properties(developer_guides)
 
-       add_custom_target(all_guides ALL DEPENDS user_guides developer_guides )
-       set_target_properties(all_guides PROPERTIES FOLDER "Docbook")
+       add_custom_target(all_guides DEPENDS user_guides developer_guides )
+       set_docbook_target_properties(all_guides)
 endif()
 
 # User's Guide chain.
-if(ENABLE_HTML_GUIDES)
+if(ASCIIDOCTOR_EXECUTABLE AND XSLTPROC_EXECUTABLE)
        XML2HTML(
                user_guide
                wsug
@@ -421,48 +437,24 @@ if(ENABLE_HTML_GUIDES)
                        wsug_html/index.html
                        wsug_html_chunked/index.html
        )
-       set_target_properties(user_guide_html PROPERTIES FOLDER "Docbook")
+       set_docbook_target_properties(user_guide_html)
        add_dependencies(user_guides user_guide_html)
+       list(APPEND GUIDE_INSTALL_DIRS ${CMAKE_CURRENT_BINARY_DIR}/wsug_html_chunked)
 endif()
 
-if(ENABLE_PDF_GUIDES)
-       # To do:
-       # - Merge A4 and letter into the smallest dimension of each format.
-       #   Use   --stringparam  page.height <letter-height>mm --stringparam  page.width <at-width>mm
-       #   Test the effect of this on letter and a4 printers first (ps and non-ps).
-       # - Generate PDFs using AsciiDoc.
-
-       XML2PDF(
-               user_guide
-               user-guide-a4.pdf
-               user-guide.xml
-               custom_layer_pdf.xsl
-               A4
-       )
+if(ASCIIDOCTOR_EXECUTABLE)
+       ASCIIDOCTOR2PDF(user-guide.asciidoc ${WSUG_SOURCE} ${WSUG_BUILT_DEPS})
 
-       XML2PDF(
-               user_guide
-               user-guide-us.pdf
-               user-guide.xml
-               custom_layer_pdf.xsl
-               letter
-       )
-       add_custom_target(
-               user_guide_pdf_a4
-               DEPENDS
-                       user-guide-a4.pdf
-       )
-       set_target_properties(user_guide_pdf_a4 PROPERTIES FOLDER "Docbook")
        add_custom_target(
-               user_guide_pdf_us
+               user_guide_pdf
                DEPENDS
-                       user-guide-us.pdf
+                       user-guide.pdf
        )
-       set_target_properties(user_guide_pdf_us PROPERTIES FOLDER "Docbook")
-       add_dependencies(user_guides user_guide_pdf_a4 user_guide_pdf_us)
+       set_docbook_target_properties(user_guide_pdf)
+       add_dependencies(user_guides user_guide_pdf)
 endif()
 
-if(ENABLE_CHM_GUIDES)
+if(WIN32 AND ASCIIDOCTOR_EXECUTABLE)
        XML2HHP(user_guide wsug user-guide.xml)
        HHP2CHM(user-guide.hhp)
        add_custom_target(
@@ -470,12 +462,12 @@ if(ENABLE_CHM_GUIDES)
                DEPENDS
                        user-guide.chm
        )
-       set_target_properties(user_guide_chm PROPERTIES FOLDER "Docbook")
+       set_docbook_target_properties(user_guide_chm)
        add_dependencies(user_guides user_guide_chm)
 endif()
 
 # Developer's Guide chain.
-if(ENABLE_HTML_GUIDES)
+if(ASCIIDOCTOR_EXECUTABLE AND XSLTPROC_EXECUTABLE)
        XML2HTML(
                developer_guide
                wsdg
@@ -497,42 +489,24 @@ if(ENABLE_HTML_GUIDES)
                        wsdg_html/index.html
                        wsdg_html_chunked/index.html
        )
-       set_target_properties(developer_guide_html PROPERTIES FOLDER "Docbook")
+       set_docbook_target_properties(developer_guide_html)
        add_dependencies(developer_guides developer_guide_html)
+       list(APPEND GUIDE_INSTALL_DIRS ${CMAKE_CURRENT_BINARY_DIR}/wsdg_html_chunked)
 endif()
 
-if(ENABLE_PDF_GUIDES)
-       XML2PDF(
-               developer_guide
-               developer-guide-a4.pdf
-               developer-guide.xml
-               custom_layer_pdf.xsl
-               A4
-       )
+if(ASCIIDOCTOR_EXECUTABLE)
+       ASCIIDOCTOR2PDF(developer-guide.asciidoc ${WSDG_SOURCE} ${WSDG_BUILT_DEPS})
 
-       XML2PDF(
-               developer_guide
-               developer-guide-us.pdf
-               developer-guide.xml
-               custom_layer_pdf.xsl
-               letter
-       )
-       add_custom_target(
-               developer_guide_pdf_a4
-               DEPENDS
-                       developer-guide-a4.pdf
-       )
-       set_target_properties(developer_guide_pdf_a4 PROPERTIES FOLDER "Docbook")
        add_custom_target(
-               developer_guide_pdf_us
+               developer_guide_pdf
                DEPENDS
-                       developer-guide-us.pdf
+                       developer-guide.pdf
        )
-       set_target_properties(developer_guide_pdf_us PROPERTIES FOLDER "Docbook")
-       add_dependencies(developer_guides developer_guide_pdf_a4 developer_guide_pdf_us)
+       set_docbook_target_properties(developer_guide_pdf)
+       add_dependencies(developer_guides developer_guide_pdf)
 endif()
 
-if(ENABLE_CHM_GUIDES)
+if(WIN32 AND ASCIIDOCTOR_EXECUTABLE)
        XML2HHP(developer_guide wsdg developer-guide.xml)
        HHP2CHM(developer-guide.hhp)
        add_custom_target(
@@ -540,22 +514,37 @@ if(ENABLE_CHM_GUIDES)
                DEPENDS
                        developer-guide.chm
        )
-       set_target_properties(developer_guide_chm PROPERTIES FOLDER "Docbook")
+       set_docbook_target_properties(developer_guide_chm)
        add_dependencies(developer_guides developer_guide_chm)
 endif()
 
-# release_notes: release-notes.html release-notes.txt release-notes-a4.pdf release-notes-us.pdf
+if (GUIDE_INSTALL_DIRS)
+       # The installation location and DOC_DIR in ui/help_url.c must
+       # match.
+       add_custom_target(install_guides
+               COMMAND ${CMAKE_COMMAND} -P
+                       ${CMAKE_SOURCE_DIR}/cmake/modules/FileInstall.cmake
+                       ${GUIDE_INSTALL_DIRS}
+                       ${CMAKE_INSTALL_FULL_DOCDIR}
+               DEPENDS
+                       user_guide_html developer_guide_html
+       )
+       set_docbook_target_properties(install_guides)
+endif()
+
+# release_notes: release-notes.html release-notes.txt
 
-add_custom_target( release_notes_html DEPENDS ws.css release-notes.html )
-set_target_properties(release_notes_html PROPERTIES FOLDER "Docbook")
+add_custom_target( release_notes_html DEPENDS release-notes.html )
+set_docbook_target_properties(release_notes_html)
 add_custom_target( release_notes_txt DEPENDS release-notes.txt )
-set_target_properties(release_notes_txt PROPERTIES FOLDER "Docbook")
+set_docbook_target_properties(release_notes_txt)
 
-# Force serial execution so that separate a2x instances don't trip on each other
-add_dependencies ( release_notes_txt release_notes_html )
+# Force serial execution so that separate asciidoctor instances don't
+# trip on each other
+# add_dependencies ( release_notes_txt release_notes_html )
 
 add_custom_target( release_notes )
-set_target_properties(release_notes PROPERTIES FOLDER "Docbook")
+set_docbook_target_properties(release_notes)
 add_dependencies ( release_notes release_notes_txt release_notes_html )
 
 add_custom_target(
@@ -566,33 +555,12 @@ add_custom_target(
        DEPENDS
                ${CMAKE_CURRENT_BINARY_DIR}/release-notes.txt
 )
-set_target_properties(news PROPERTIES FOLDER "Docbook")
+set_docbook_target_properties(news)
 
-ASCIIDOC2HTML(
-       release-notes.html
-       release-notes.asciidoc
-       "${ASCIIDOC_CONF_FILES}"
-)
-
-ASCIIDOC2TXT(
-       release-notes.txt
-       release-notes.asciidoc
-       "${ASCIIDOC_CONF_FILES}"
-)
-
-#ASCIIDOC2PDF(
-#      release-notes-a4.pdf
-#      release-notes.asciidoc
-#      "${ASCIIDOC_CONF_FILES}"
-#      A4
-#)
-
-#ASCIIDOC2PDF(
-#      release-notes-us.pdf
-#      release-notes.asciidoc
-#      "${ASCIIDOC_CONF_FILES}"
-#      letter
-#)
+if( ASCIIDOCTOR_FOUND )
+       ASCIIDOCTOR2HTML( release-notes.asciidoc ws.css )
+       ASCIIDOCTOR2TXT( release-notes.asciidoc )
+endif()
 
 #
 # Editor modelines  -  http://www.wireshark.org/tools/modelines.html