]> sigrok.org Git - pulseview.git/blame - manual/CMakeLists.txt
manual: expand the protocol decoder troubleshooting subsection
[pulseview.git] / manual / CMakeLists.txt
CommitLineData
f2f536aa
GS
1##
2## This file is part of the PulseView project.
3##
4## Copyright (C) 2018 Gerhard Sittig <gerhard.sittig@gmx.net>
5##
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.
10##
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.
15##
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/>.
18##
19
4596756f 20# External dependencies, required and optional tools.
f2f536aa
GS
21find_program(ASCIIDOCTOR_EXECUTABLE NAMES asciidoctor)
22find_program(ASCIIDOCTOR_PDF_EXECUTABLE NAMES asciidoctor-pdf)
23
4596756f 24# Tunables.
e6bc4b9d 25set(STYLES_DIR "asciidoctor-stylesheet-factory/stylesheets")
f2f536aa 26set(STYLE_SHEET "readthedocs.css")
4596756f
GS
27
28# Input files.
f2f536aa 29set(MANUAL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/pulseview_manual.txt")
4596756f
GS
30
31# Output files, conversion results.
f2f536aa
GS
32set(MANUAL_OUT_HTML "${CMAKE_CURRENT_BINARY_DIR}/pulseview_manual.html")
33set(MANUAL_OUT_PDF "${CMAKE_CURRENT_BINARY_DIR}/pulseview_manual.pdf")
34
4596756f 35# Manual related make(1) targets.
f2f536aa
GS
36add_custom_target(manual-html
37 COMMAND ${ASCIIDOCTOR_EXECUTABLE}
38 -a stylesheet=${STYLE_SHEET}
e6bc4b9d 39 -a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
f2f536aa
GS
40 -a toc=left
41 --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
42 ${MANUAL_SRC}
43 BYPRODUCTS ${MANUAL_OUT_HTML}
44 DEPENDS ${MANUAL_SRC}
45 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
46 COMMENT "Generating manual, HTML output"
47)
6bbbf1f8
GS
48if (ASCIIDOCTOR_PDF_EXECUTABLE)
49 add_custom_target(manual-pdf
50 COMMAND ${ASCIIDOCTOR_PDF_EXECUTABLE}
51 -a stylesheet=${STYLE_SHEET}
e6bc4b9d 52 -a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
6bbbf1f8
GS
53 --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
54 ${MANUAL_SRC}
55 BYPRODUCTS ${MANUAL_OUT_PDF}
56 DEPENDS ${MANUAL_SRC}
57 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
58 COMMENT "Generating manual, HTML output"
59 )
60else ()
61 add_custom_target(manual-pdf
62 COMMAND ${CMAKE_COMMAND} -E echo
63 "asciidoctor-pdf executable is missing, NOT generating HTML output"
64 DEPENDS ${MANUAL_SRC}
65 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
66 )
67endif ()
f2f536aa
GS
68add_custom_target(manual)
69add_dependencies(manual manual-html manual-pdf)
7305c218 70
e6bc4b9d 71set(MANUAL_INST_SUBDIR "share/doc/pulseview")
7305c218
GS
72install(
73 FILES ${MANUAL_OUT_HTML} ${MANUAL_OUT_PDF}
e6bc4b9d 74 DESTINATION ${MANUAL_INST_SUBDIR}
7305c218
GS
75 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
76 OPTIONAL
77)
e6bc4b9d
GS
78if (ASCIIDOCTOR_EXECUTABLE)
79 install(
80 DIRECTORY images
81 DESTINATION ${MANUAL_INST_SUBDIR}
82 FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
83 PATTERN "*.xcf" EXCLUDE
84 )
85endif ()