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