forked from OSGeo/OSGeoLive-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
407 lines (322 loc) · 13.2 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
message(FATAL_ERROR "In-source builds not allowed.
Please make a new directory (called a build directory) and run CMake from there.
You may need to remove CMakeCache.txt." )
endif()
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
project(OSGeoLiveDoc LANGUAGES NONE)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
# Setting the version number
#---------------------------------------------
set(OSGeoLiveDoc_VERSION_MAJOR "15")
set(OSGeoLiveDoc_VERSION_MINOR "0")
set(OSGeoLiveDoc_VERSION_PATCH "0")
set(OSGeoLiveDoc_VERSION_DEV "-dev")
set(OSGeoLiveDoc_VERSION "${OSGeoLiveDoc_VERSION_MAJOR}.${OSGeoLiveDoc_VERSION_MINOR}.${OSGeoLiveDoc_VERSION_MINOR}${OSGeoLiveDoc_VERSION_DEV}")
set(OSGeoLiveDoc_NAME "OSGeoLive")
#---------------------------------------------
# minimum versions
#---------------------------------------------
set(SPHINX_MINIMUM_VERSION "4.0")
#---------------------------------------------
# Fining sphinx
#---------------------------------------------
find_package(Sphinx ${SPHINX_MINIMUM_VERSION} REQUIRED)
if (NOT SPHINX_FOUND)
message(WARNING "Sphinx not found. Cannot generate documentation!")
#elseif (SPHINX_VERSION VERSION_LESS SPHINX_MINIMUM_VERSION)
# message(WARNING "Your Sphinx version is too old!
# This project requires Sphinx v1.0 or above to produce
# proper documentation (you have v${SPHINX_VERSION}).
# You will get output but it will have errors.")
endif()
option(OSGeoLiveDoc_DEBUG
"Set ON|OFF (default=OFF) to display basic DEBUG" OFF)
option(OSGeoLiveDoc_VERBOSE_DEBUG
"Set ON|OFF (default=OFF) to display detailed DEBUG" OFF)
#---------------------------------------------
#---------------------------------------------
# Perl
#---------------------------------------------
#---------------------------------------------
include(FindPerl)
if(NOT PERL_EXECUTABLE)
message(FATAL_ERROR " Please check your Perl installation.")
endif(NOT PERL_EXECUTABLE)
execute_process(
COMMAND ${PERL_EXECUTABLE} -MDateTime -e ""
ERROR_QUIET RESULT_VARIABLE DATETIME_STAUS
)
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
# Kind of output
# http://www.sphinx-doc.org/en/stable/builders.html
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
option(ALL_DOC
"Set ON|OFF (default=OFF) to build all documentation styles (exept LOCALE)" OFF)
option(HTML
"Set ON|OFF (default=OFF) to build Documentation library tree as HTML" OFF)
option(DIRHTML
"Set ON|OFF (default=OFF) to build Documentation library tree as DIRHTML
STATUS: the navigation does not work " OFF
)
option(SINGLEHTML
"Set ON|OFF (default=OFF) to build Documentation library tree as a single HTML file" OFF
)
option(PICKLE
"Set ON|OFF (default=OFF) to build Documentation library tree as PICKLE" OFF)
option(JSON
"Set ON|OFF (default=OFF) to build Documentation library tree as JSON page" OFF)
option(HTMLHELP
"Set ON|OFF (default=OFF) to build Documentation library tree as HTMLHELP page" OFF)
option(DUMMY
"Set ON|OFF (default=OFF) to build Documentation library tree as DUMMY page" OFF)
option(LATEX
"Set ON|OFF (default=OFF) to build Documentation library tree as LATEX page" OFF)
option(LINKCHECK
"Set ON|OFF (default=OFF) to build Documentation library tree as LINKCHECK page" OFF)
option(LOCALE
"Set ON|OFF (default=OFF) to build the locale files of all languages.
All other options are ignored
All supported languages are considered" OFF
)
foreach(opt HTML DIRHTML SINGLEHTML PICKLE JSON HTMLHELP LATEX LINKCHECK)
if (${${opt}} OR ALL_DOC)
string(TOLOWER ${opt} val)
list(APPEND OSGeoLiveDoc_DOC_TARGETS ${val})
endif()
endforeach()
message(STATUS "OSGeoLiveDoc_DOC_TARGETS = ${OSGeoLiveDoc_DOC_TARGETS}")
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
# LANGUAGES SETINGS
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
# Avaliable Languages
# English is allways built
# list of sphinx languges support
# http://www.sphinx-doc.org/en/stable/config.html#confval-language
# TODO: figure out how to support this
# "el" "hu" "id" "zh")
#---------------------------------------------
set(OSGeoLiveDoc_SUPPORTED_LANGUAGES "de" "es" "fi" "fr" "hu" "it" "ja")
set(OSGeoLiveDoc_ENGLISH "en")
#---------------------------------------------
# Language options
#---------------------------------------------
option(ALL_LANG
"Set ON|OFF (default=OFF) to build all documentation supported languages
${OSGeoLiveDoc_SUPPORTED_LANGUAGES}" OFF)
foreach(lang ${OSGeoLiveDoc_SUPPORTED_LANGUAGES})
string(TOUPPER ${lang} val)
option(${val}
"Set ON|OFF (default=OFF) build ${lang} Documentation" OFF)
endforeach()
#---------------------------------------------
# Catching the language options to be build
#---------------------------------------------
list(APPEND OSGeoLiveDoc_BUILD_LANGUAGES ${OSGeoLiveDoc_ENGLISH})
foreach(lang ${OSGeoLiveDoc_SUPPORTED_LANGUAGES})
string(TOUPPER ${lang} opt)
if (${opt} OR ALL_LANG)
list(APPEND OSGeoLiveDoc_BUILD_LANGUAGES ${lang})
endif()
endforeach()
#---------------------------------------------
# All languages po files are to be generated
#---------------------------------------------
set (SPHINXINTL_LANGUAGE ${OSGeoLiveDoc_ENGLISH})
if(LOCALE)
foreach(lang ${OSGeoLiveDoc_SUPPORTED_LANGUAGES})
set(SPHINXINTL_LANGUAGE "${SPHINXINTL_LANGUAGE},${lang}")
endforeach()
set(OSGeoLiveDoc_LANGUAGES ${OSGeoLiveDoc_ENGLISH})
endif()
#------------------------------------------
# Used to generate the languages bar
#------------------------------------------
MACRO(INSERT_INTO_MAP _KEY _VALUE)
SET("LangMap_${_KEY}" "${_VALUE}")
ENDMACRO(INSERT_INTO_MAP)
INSERT_INTO_MAP("ca" "Català")
INSERT_INTO_MAP("de" "Deutsch")
INSERT_INTO_MAP("el" "Ελληνικά")
INSERT_INTO_MAP("en" "English")
INSERT_INTO_MAP("es" "Español")
INSERT_INTO_MAP("fr" "Français")
INSERT_INTO_MAP("fi" "Suomen kieli")
INSERT_INTO_MAP("hu" "Hungarian")
INSERT_INTO_MAP("id" "Bahasa Indonesia")
INSERT_INTO_MAP("it" "Italiano")
INSERT_INTO_MAP("ja" "日本語")
INSERT_INTO_MAP("ko" "한국어")
INSERT_INTO_MAP("pl" "Polski")
INSERT_INTO_MAP("pt" "Portugus")
INSERT_INTO_MAP("ru" "Русский")
INSERT_INTO_MAP("zh" "中文")
message(STATUS "OSGeoLiveDoc_BUILD_LANGUAGES = ${OSGeoLiveDoc_BUILD_LANGUAGES}")
message(STATUS "SPHINXINTL_LANGUAGE = ${SPHINXINTL_LANGUAGE}")
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
# The list of projects to be documented
#---------------------------------------------
#---------------------------------------------
#---------------------------------------------
# Y = to document | name | version | q = has quickstart | o = has overview
file(STRINGS projects_info.csv OSGeoLiveDoc_PROJECTS_VERSIONS_FILE)
MACRO(INSERT_INTO_MAP_KIND _KEY _TARGET)
if ("${_TARGET}" STREQUAL "")
set(_TRGT "")
else ()
set(_TRGT
".. image:: /images/logos/${_TARGET}.png
:align: right
:target: https://www.osgeo.org
")
endif()
SET("OSGEO_KIND_${_KEY}" "${_TRGT}")
ENDMACRO(INSERT_INTO_MAP_KIND)
MACRO(INSERT_INTO_MAP_LOGO _KEY _TARGET)
if ("${_TARGET}" STREQUAL "")
set(_TRGT ${_TARGET})
else()
set(_TRGT ":target: ${_TARGET}")
endif()
SET("LOGO_${_KEY}"
".. image:: /images/projects/${_KEY}/logo_${_KEY}.png
:align: right
${_TRGT}
")
ENDMACRO(INSERT_INTO_MAP_LOGO)
MACRO(INSERT_INTO_MAP_SCREENSHOT _KEY _TARGET)
SET("SCREENSHOT_${_KEY}"
".. image:: /images/projects/${_KEY}/${_KEY}_screenshot.png
:width: 500px
:alt: ${_KEY} screenshot
:align: right
")
ENDMACRO(INSERT_INTO_MAP_SCREENSHOT)
MACRO(INSERT_INTO_MAP_QUICK _KEY _TARGET)
if ("${_TARGET}" STREQUAL "Y")
set(_QUICK "
Quickstart
--------------------------------------------------------------------------------
* :doc:`Quickstart documentation <../quickstart/${_KEY}_quickstart>`
")
else()
set(_QUICK " ")
endif()
SET("QUICKSTART_${_KEY}" "${_QUICK}")
ENDMACRO(INSERT_INTO_MAP_QUICK)
MACRO(INSERT_INTO_MAP_VMDK _KEY _TARGET)
if ("${_TARGET}" STREQUAL "Y")
set(_NOTE " ")
else()
set(_NOTE ".. note:: This project is only included on the OSGeoLive virtual machine disk (VMDK)")
endif()
SET("VMDK_${_KEY}" "${_NOTE}")
ENDMACRO(INSERT_INTO_MAP_VMDK)
MACRO(INSERT_INTO_MAP_NAME _KEY _TARGET)
SET("NAME_${_KEY}" "${_TARGET}")
ENDMACRO(INSERT_INTO_MAP_NAME)
MACRO(INSERT_INTO_MAP_WEB _KEY _TARGET)
SET("WEB_${_KEY}" "${_TARGET}")
ENDMACRO()
set (OSGeoLiveDoc_PROJECTS_NAMES "")
set (OSGeoLiveDoc_PROJECTS_LOGOS "")
set (OSGeoLiveDoc_CONFIGURATION_REGEXP "^(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|.*\\|.*\\|.*\\|.*\\|(.*)\\|(.*)\\|(.*)\\|(.*)")
foreach(line ${OSGeoLiveDoc_PROJECTS_VERSIONS_FILE})
#Skipping comments
string(REGEX REPLACE "^(#).*" "\\1" is_comment ${line})
string(STRIP ${is_comment} is_comment)
if (${is_comment} MATCHES "#")
continue()
endif()
# TODO define what is usefull at this moment
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\1" wantDoc ${line})
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\2" project_page ${line})
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\3" project_version ${line})
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\4" want_quickstart ${line})
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\5" want_overview ${line})
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\6" url_target ${line})
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\7" osgeo_kind ${line})
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\8" project_name ${line})
string(REGEX REPLACE "${OSGeoLiveDoc_CONFIGURATION_REGEXP}" "\\9" on_iso ${line})
string(STRIP "${wantDoc}" wantDoc)
string(STRIP "${project_page}" project_page)
string(STRIP "${project_version}" project_version)
if ("${project_version}" STREQUAL "")
set(project_version "NA")
endif()
string(STRIP "${want_quickstart}" want_quickstart)
string(STRIP "${want_overview}" want_overview)
if (NOT "${wantDoc}" MATCHES "Y|y")
continue()
endif()
string(STRIP "${url_target}" url_target)
string(STRIP "${osgeo_kind}" osgeo_kind)
string(STRIP "${project_name}" project_name)
string(STRIP "${on_iso}" on_iso)
if (OSGeoLiveDoc_DEBUG)
message(STATUS "wantDoc:${wantDoc} \tpage:${project_page} \tversion:${project_version} \twant_quickstart:${want_quickstart} \twant_overview:${want_overview}\turl:${url_target} \tkind:${osgeo_kind}\tname:${project_name}")
endif()
list(APPEND OSGeoLiveDoc_PROJECTS_NAMES "${project_page}")
string(CONCAT OSGeoLiveDoc_PROJECTS_VERSIONS ${OSGeoLiveDoc_PROJECTS_VERSIONS} ".. |version-${project_page}| replace:: ${project_version}\n")
INSERT_INTO_MAP_LOGO("${project_page}" "${url_target}")
INSERT_INTO_MAP_SCREENSHOT("${project_page}" "${url_target}")
INSERT_INTO_MAP_KIND("${project_page}" "${osgeo_kind}")
INSERT_INTO_MAP_NAME("${project_page}" "${project_name}")
INSERT_INTO_MAP_WEB("${project_page}" "${url_target}")
INSERT_INTO_MAP_QUICK("${project_page}" "${want_quickstart}")
INSERT_INTO_MAP_VMDK("${project_page}" "${on_iso}")
if ("${want_quickstart}" MATCHES "Y")
list(APPEND OSGeoLiveDoc_QUICKSTART "${project_page}")
endif()
if ("${want_overview}" MATCHES "Y")
list(APPEND OSGeoLiveDoc_OVERVIEW "${project_page}")
endif()
endforeach()
if (OSGeoLiveDoc_VERBOSE_DEBUG)
message(STATUS "OSGeoLiveDoc_OVERVIEW=${OSGeoLiveDoc_OVERVIEW}")
message(STATUS "OSGeoLiveDoc_QUICKSTART=${OSGeoLiveDoc_QUICKSTART}")
message(STATUS "OSGeoLiveDoc_PROJECTS_NAMES=${OSGeoLiveDoc_QUICKSTART}")
endif()
set(OSGeoLiveDoc_STANDARDS
"csw" "gml" "sld" "wcs" "wms"
"fe" "kml" "sensorml" "sos" "wfs" "wps"
)
if(FALSE)
# Quickstart only
set(OSGeoLiveDoc_QUICKSTART
${OSGeoLiveDoc_PROJECTS}
"internationalisation"
"osgeolive_install"
"osgeolive"
"usb"
"virtualbox"
"virtualization"
"vmware"
)
endif()
configure_file("licenses.csv" "licenses.csv")
configure_file("contributors.csv" "contributors.csv")
configure_file("translators.csv" "translators.csv")
set(SPHINX_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/_build")
add_subdirectory(doc)
add_subdirectory(presentation)