manual: also install images/*.png with the HTML output
authorGerhard Sittig <gerhard.sittig@gmx.net>
Sun, 14 Oct 2018 15:06:16 +0000 (17:06 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 27 Oct 2018 19:25:22 +0000 (21:25 +0200)
Extend the CMake rules for the manual. Do install the images/ subdir but
omit the *.xcf files. Prepare the CSS file although this seems to be not
strictly necessary (gets inlined, but we are prepared if it's external).
Only install these additional files when the asciidoctor(1) tool is
available, and thus the .html file can get generated (to not install
some questionable combination of a .pdf and unrelated .png files, or to
not install the resources when none of the manual files got created).

This approach was tested with the following command sequence:
  $ make manual
  $ make install
  $ xdg-open ~/share/doc/pulseview/*.html

manual/CMakeLists.txt

index 2cfd263f6185060d574f6f1bf6db48722ddfc30e..25a26e995a22b050ec70893fde49cf8660f9fbd6 100644 (file)
@@ -20,7 +20,7 @@
 find_program(ASCIIDOCTOR_EXECUTABLE NAMES asciidoctor)
 find_program(ASCIIDOCTOR_PDF_EXECUTABLE NAMES asciidoctor-pdf)
 
 find_program(ASCIIDOCTOR_EXECUTABLE NAMES asciidoctor)
 find_program(ASCIIDOCTOR_PDF_EXECUTABLE NAMES asciidoctor-pdf)
 
-set(STYLES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/asciidoctor-stylesheet-factory/stylesheets")
+set(STYLES_DIR "asciidoctor-stylesheet-factory/stylesheets")
 set(STYLE_SHEET "readthedocs.css")
 set(MANUAL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/pulseview_manual.txt")
 set(MANUAL_OUT_HTML "${CMAKE_CURRENT_BINARY_DIR}/pulseview_manual.html")
 set(STYLE_SHEET "readthedocs.css")
 set(MANUAL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/pulseview_manual.txt")
 set(MANUAL_OUT_HTML "${CMAKE_CURRENT_BINARY_DIR}/pulseview_manual.html")
@@ -29,7 +29,7 @@ set(MANUAL_OUT_PDF "${CMAKE_CURRENT_BINARY_DIR}/pulseview_manual.pdf")
 add_custom_target(manual-html
        COMMAND ${ASCIIDOCTOR_EXECUTABLE}
                -a stylesheet=${STYLE_SHEET}
 add_custom_target(manual-html
        COMMAND ${ASCIIDOCTOR_EXECUTABLE}
                -a stylesheet=${STYLE_SHEET}
-               -a stylesdir=${STYLES_DIR}
+               -a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
                -a toc=left
                --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
                ${MANUAL_SRC}
                -a toc=left
                --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
                ${MANUAL_SRC}
@@ -42,7 +42,7 @@ if (ASCIIDOCTOR_PDF_EXECUTABLE)
        add_custom_target(manual-pdf
                COMMAND ${ASCIIDOCTOR_PDF_EXECUTABLE}
                        -a stylesheet=${STYLE_SHEET}
        add_custom_target(manual-pdf
                COMMAND ${ASCIIDOCTOR_PDF_EXECUTABLE}
                        -a stylesheet=${STYLE_SHEET}
-                       -a stylesdir=${STYLES_DIR}
+                       -a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
                        --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
                        ${MANUAL_SRC}
                BYPRODUCTS ${MANUAL_OUT_PDF}
                        --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
                        ${MANUAL_SRC}
                BYPRODUCTS ${MANUAL_OUT_PDF}
@@ -61,9 +61,18 @@ endif ()
 add_custom_target(manual)
 add_dependencies(manual manual-html manual-pdf)
 
 add_custom_target(manual)
 add_dependencies(manual manual-html manual-pdf)
 
+set(MANUAL_INST_SUBDIR "share/doc/pulseview")
 install(
        FILES ${MANUAL_OUT_HTML} ${MANUAL_OUT_PDF}
 install(
        FILES ${MANUAL_OUT_HTML} ${MANUAL_OUT_PDF}
-       DESTINATION "share/doc/pulseview"
+       DESTINATION ${MANUAL_INST_SUBDIR}
        PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
        OPTIONAL
 )
        PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
        OPTIONAL
 )
+if (ASCIIDOCTOR_EXECUTABLE)
+       install(
+               DIRECTORY images
+               DESTINATION ${MANUAL_INST_SUBDIR}
+               FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+               PATTERN "*.xcf" EXCLUDE
+       )
+endif ()