-
Notifications
You must be signed in to change notification settings - Fork 256
/
CMakeLists.txt
142 lines (127 loc) · 5.06 KB
/
CMakeLists.txt
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2019-2019 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
# License as published by the Free Software Foundation and included
# in the file LICENSE.
#
# 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
# Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
cmake_minimum_required(VERSION 3.0)
project(bareos-docs NONE)
# commands building json files ######
add_custom_command(
OUTPUT
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-dir-config-schema.json
COMMAND bareos-dir -xs >/dev/null
COMMAND
bareos-dir -xs
>${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-dir-config-schema.json
COMMAND
sed --in-place --expression="/\\\"version\\\":/d"
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-dir-config-schema.json
DEPENDS $<$<BOOL:${docs-build-json}>:bareos-dir>
)
add_custom_command(
OUTPUT
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-sd-config-schema.json
COMMAND bareos-sd -xs >/dev/null
COMMAND
bareos-sd -xs
>${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-sd-config-schema.json
COMMAND
sed --in-place --expression="/\\\"version\\\":/d"
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-sd-config-schema.json
DEPENDS $<$<BOOL:${docs-build-json}>:bareos-sd>
)
add_custom_command(
OUTPUT
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-fd-config-schema.json
COMMAND bareos-fd -xs >/dev/null
COMMAND
bareos-fd -xs
>${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-fd-config-schema.json
COMMAND
sed --in-place --expression="/\\\"version\\\":/d"
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-fd-config-schema.json
DEPENDS $<$<BOOL:${docs-build-json}>:bareos-fd>
)
add_custom_command(
OUTPUT
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bconsole-config-schema.json
COMMAND bconsole -xs >/dev/null
COMMAND
bconsole -xs
>${PROJECT_SOURCE_DIR}/source/include/autogenerated/bconsole-config-schema.json
COMMAND
sed --in-place --expression="/\\\"version\\\":/d"
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bconsole-config-schema.json
DEPENDS $<$<BOOL:${docs-build-json}>:bconsole>
)
add_custom_command(
OUTPUT
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-tray-monitor-config-schema.json
COMMAND bareos-tray-monitor -xs >/dev/null
COMMAND
bareos-tray-monitor -xs
>${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-tray-monitor-config-schema.json
COMMAND
sed --in-place --expression="/\\\"version\\\":/d"
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-tray-monitor-config-schema.json
DEPENDS $<$<BOOL:${docs-build-json}>:bareos-tray-monitor>
)
set(AUTOGENERATED_RESOURCE_DESCRIPTION_JSON_FILES
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-dir-config-schema.json
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-sd-config-schema.json
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-fd-config-schema.json
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bconsole-config-schema.json
${PROJECT_SOURCE_DIR}/source/include/autogenerated/bareos-tray-monitor-config-schema.json
)
if(${docs-build-json})
set(CLEAN_JSON_FILES
rm -f ${PROJECT_SOURCE_DIR}/source/include/autogenerated/*.json
)
endif()
# target: clean-docs ######
add_custom_target(
clean-docs
COMMAND ${CLEAN_JSON_FILES}
COMMAND rm -f ${PROJECT_SOURCE_DIR}/source/include/autogenerated/*.inc
COMMAND rm -rf ${PROJECT_BINARY_DIR}/BareosMainReference
)
# target: check-git ###### To prevent documentation to be built out of sync with
# the actual binaries, this target checks if the generated json files differ
# from the ones in the repository.
add_custom_target(
check-git
COMMAND git diff --exit-code --stat=80
${PROJECT_SOURCE_DIR}/source/include/autogenerated
DEPENDS ${AUTOGENERATED_RESOURCE_DESCRIPTION_JSON_FILES}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT
"Comparing json files in \"${PROJECT_SOURCE_DIR}/source/include/autogenerated\" with git repo"
)
set(SPHINX_OPTS $ENV{SPHINX_OPTS})
set(SPHINX_COMMAND sphinx-build)
set(SPHINX_BUILDDIR ${PROJECT_BINARY_DIR}/BareosMainReference)
set(SPHINX_SOURCE_DIR ${PROJECT_SOURCE_DIR}/source)
if(${docs-only})
set(DOCS_ALL ALL) # this enables "make docs" by just typing "make"
endif()
# target: docs ######
add_custom_target(
docs ${DOCS_ALL}
COMMAND ${SPHINX_COMMAND} -M html "${SPHINX_SOURCE_DIR}" "${SPHINX_BUILDDIR}"
"${SPHINX_OPTS}"
DEPENDS $<$<BOOL:${docs-build-json}>:clean-docs>
DEPENDS check-git
)