]> sigrok.org Git - pulseview.git/blame_incremental - manual/CMakeLists.txt
manual: add cmake project() directive for standalone operation
[pulseview.git] / manual / CMakeLists.txt
... / ...
CommitLineData
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
20cmake_minimum_required(VERSION 2.8.12)
21
22project(PV_MANUAL)
23
24# External dependencies, required and optional tools.
25find_program(ASCIIDOCTOR_EXECUTABLE NAMES asciidoctor)
26find_program(ASCIIDOCTOR_PDF_EXECUTABLE NAMES asciidoctor-pdf)
27
28# Tunables.
29set(STYLES_DIR "asciidoctor-stylesheet-factory/stylesheets")
30set(STYLE_SHEET "readthedocs.css")
31
32# Input files.
33set(MANUAL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/manual.txt")
34
35# Output files, conversion results.
36set(MANUAL_OUT_HTML "${CMAKE_CURRENT_BINARY_DIR}/manual.html")
37set(MANUAL_OUT_PDF "${CMAKE_CURRENT_BINARY_DIR}/manual.pdf")
38
39# Manual related make(1) targets.
40add_custom_target(manual-html
41 COMMAND ${ASCIIDOCTOR_EXECUTABLE}
42 -a stylesheet=${STYLE_SHEET}
43 -a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
44 -a toc=left
45 --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
46 ${MANUAL_SRC}
47 BYPRODUCTS ${MANUAL_OUT_HTML}
48 DEPENDS ${MANUAL_SRC}
49 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
50 COMMENT "Generating manual, HTML output"
51)
52if (ASCIIDOCTOR_PDF_EXECUTABLE)
53 add_custom_target(manual-pdf
54 COMMAND ${ASCIIDOCTOR_PDF_EXECUTABLE}
55 -a stylesheet=${STYLE_SHEET}
56 -a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
57 --destination-dir=${CMAKE_CURRENT_BINARY_DIR}
58 ${MANUAL_SRC}
59 BYPRODUCTS ${MANUAL_OUT_PDF}
60 DEPENDS ${MANUAL_SRC}
61 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
62 COMMENT "Generating manual, HTML output"
63 )
64else ()
65 add_custom_target(manual-pdf
66 COMMAND ${CMAKE_COMMAND} -E echo
67 "asciidoctor-pdf executable is missing, NOT generating PDF output"
68 DEPENDS ${MANUAL_SRC}
69 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
70 )
71endif ()
72add_custom_target(manual)
73add_dependencies(manual manual-html manual-pdf)
74
75set(MANUAL_INST_SUBDIR "share/doc/pulseview")
76install(
77 FILES ${MANUAL_OUT_HTML} ${MANUAL_OUT_PDF}
78 DESTINATION ${MANUAL_INST_SUBDIR}
79 PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
80 OPTIONAL
81)
82if (ASCIIDOCTOR_EXECUTABLE)
83 install(
84 DIRECTORY images
85 DESTINATION ${MANUAL_INST_SUBDIR}
86 FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
87 PATTERN "*.xcf" EXCLUDE
88 )
89endif ()