2 ## This file is part of the PulseView project.
4 ## Copyright (C) 2018 Gerhard Sittig <gerhard.sittig@gmx.net>
6 ## This program is free software: you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation, either version 2 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # External dependencies, required and optional tools.
21 find_program(ASCIIDOCTOR_EXECUTABLE NAMES asciidoctor)
22 find_program(ASCIIDOCTOR_PDF_EXECUTABLE NAMES asciidoctor-pdf)
25 set(STYLES_DIR "asciidoctor-stylesheet-factory/stylesheets")
26 set(STYLE_SHEET "readthedocs.css")
29 set(MANUAL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/manual.txt")
31 # Output files, conversion results.
32 set(MANUAL_OUT_HTML "${CMAKE_CURRENT_BINARY_DIR}/manual.html")
33 set(MANUAL_OUT_PDF "${CMAKE_CURRENT_BINARY_DIR}/manual.pdf")
35 # Manual related make(1) targets.
36 add_custom_target(manual-html
37 COMMAND ${ASCIIDOCTOR_EXECUTABLE}
38 -a stylesheet=${STYLE_SHEET}
39 -a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
41 --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
43 BYPRODUCTS ${MANUAL_OUT_HTML}
45 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
46 COMMENT "Generating manual, HTML output"
48 if (ASCIIDOCTOR_PDF_EXECUTABLE)
49 add_custom_target(manual-pdf
50 COMMAND ${ASCIIDOCTOR_PDF_EXECUTABLE}
51 -a stylesheet=${STYLE_SHEET}
52 -a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
53 --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
55 BYPRODUCTS ${MANUAL_OUT_PDF}
57 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
58 COMMENT "Generating manual, HTML output"
61 add_custom_target(manual-pdf
62 COMMAND ${CMAKE_COMMAND} -E echo
63 "asciidoctor-pdf executable is missing, NOT generating HTML output"
65 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
68 add_custom_target(manual)
69 add_dependencies(manual manual-html manual-pdf)
71 set(MANUAL_INST_SUBDIR "share/doc/pulseview")
73 FILES ${MANUAL_OUT_HTML} ${MANUAL_OUT_PDF}
74 DESTINATION ${MANUAL_INST_SUBDIR}
75 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
78 if (ASCIIDOCTOR_EXECUTABLE)
81 DESTINATION ${MANUAL_INST_SUBDIR}
82 FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
83 PATTERN "*.xcf" EXCLUDE