-
Notifications
You must be signed in to change notification settings - Fork 206
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
105 lines (96 loc) · 3.38 KB
/
CMakeLists.txt
File metadata and controls
105 lines (96 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
##
## This file is part of the PulseView project.
##
## Copyright (C) 2018 Gerhard Sittig <gerhard.sittig@gmx.net>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
cmake_minimum_required(VERSION 3.5)
project(PV_MANUAL)
# External dependencies, required and optional tools.
find_program(ASCIIDOCTOR_EXECUTABLE NAMES asciidoctor)
find_program(ASCIIDOCTOR_PDF_EXECUTABLE NAMES asciidoctor-pdf)
# Tunables.
set(STYLES_DIR "asciidoctor-stylesheet-factory/stylesheets")
set(STYLE_SHEET "readthedocs.css")
# Input files.
set(MANUAL_SRC "${CMAKE_CURRENT_SOURCE_DIR}/manual.txt")
# Output files, conversion results.
set(MANUAL_OUT_HTML "${CMAKE_CURRENT_BINARY_DIR}/manual.html")
set(MANUAL_OUT_PDF "${CMAKE_CURRENT_BINARY_DIR}/manual.pdf")
# Make in-source images/ content available to the output hierarchy for
# the inspection of created output documents during development in the
# case of out-of-source build configurations.
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/images")
message(STATUS "creating symlink for manual's images/ subdirectory")
execute_process(
COMMAND ${CMAKE_COMMAND} -E create_symlink
"${CMAKE_CURRENT_SOURCE_DIR}/images"
"${CMAKE_CURRENT_BINARY_DIR}/images"
RESULT_VARIABLE IMAGES_LINK_RESULT
)
if (NOT IMAGES_LINK_RESULT EQUAL 0)
message(WARNING "manual rendering will lack images")
endif ()
endif ()
# Manual related make(1) targets.
add_custom_target(manual-html
COMMAND ${ASCIIDOCTOR_EXECUTABLE}
-a stylesheet=${STYLE_SHEET}
-a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
-a toc=left
--destination-dir=${CMAKE_CURRENT_BINARY_DIR}
${MANUAL_SRC}
BYPRODUCTS ${MANUAL_OUT_HTML}
DEPENDS ${MANUAL_SRC}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating manual, HTML output"
)
if (ASCIIDOCTOR_PDF_EXECUTABLE)
add_custom_target(manual-pdf
COMMAND ${ASCIIDOCTOR_PDF_EXECUTABLE}
-a stylesheet=${STYLE_SHEET}
-a stylesdir=${CMAKE_CURRENT_SOURCE_DIR}/${STYLES_DIR}
--destination-dir=${CMAKE_CURRENT_BINARY_DIR}
${MANUAL_SRC}
BYPRODUCTS ${MANUAL_OUT_PDF}
DEPENDS ${MANUAL_SRC}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating manual, PDF output"
)
else ()
add_custom_target(manual-pdf
COMMAND ${CMAKE_COMMAND} -E echo
"asciidoctor-pdf executable is missing, NOT generating PDF output"
DEPENDS ${MANUAL_SRC}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
endif ()
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}
DESTINATION ${MANUAL_INST_SUBDIR}
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 ()