docs/src/CMakeLists.txt

changeset 753
24dc84788dee
parent 716
bab81cf591a5
equal deleted inserted replaced
752:aaad6674a1a3 753:24dc84788dee
1 #
2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 #
4 # Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 #
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 # POSSIBILITY OF SUCH DAMAGE.
27 #
28
29 set(PANDOC_DESTDIR ${CMAKE_BINARY_DIR}/docs/web)
30 set(PANDOC_ARGS -c ucx.css -B header.html -A footer.html -T 'UAP Common Extensions')
31 set(PANDOC_SRC index.md license.md install.md features.md)
32 set(LOGO_PATH ../../uaplogo.png)
33
34 if (NOT EXISTS ${PANDOC_EXECUTABLE})
35 find_program(PANDOC_EXECUTABLE pandoc)
36 if(NOT EXISTS ${PANDOC_EXECUTABLE})
37 message(STATUS "Pandoc not found, docs-html target will not be generated.")
38 return()
39 endif()
40 endif()
41
42 message(STATUS "HTML Documentation will be generated at: ${PANDOC_DESTDIR}.")
43 file(MAKE_DIRECTORY ${PANDOC_DESTDIR})
44
45 # UCX 3.0 documentation
46 foreach(source_file ${PANDOC_SRC})
47 string(REPLACE .md .html dest_file ${source_file})
48 string(PREPEND dest_file "${PANDOC_DESTDIR}/")
49 list(APPEND PANDOC_DEST ${dest_file})
50 add_custom_command(
51 OUTPUT ${dest_file}
52 COMMAND ${PANDOC_EXECUTABLE} ${PANDOC_ARGS} -o ${dest_file} ${source_file}
53 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
54 MAIN_DEPENDENCY ${source_file}
55 DEPENDS header.html footer.html
56 )
57 endforeach()
58
59 # UCX 2.1 documentation
60 add_custom_target(docs-html-21
61 COMMAND ${PANDOC_EXECUTABLE} -c ucx.css -B header-ucx2.html -A footer.html
62 -T 'UAP Common Extensions' -o ${PANDOC_DESTDIR}/modules-ucx2.html modules-ucx2.md
63 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
64 DEPENDS modules-ucx2.md header-ucx2.html footer.html
65 COMMENT "Adding UCX 2.1 HTML documentation."
66 )
67
68 # Collect all HTML documentation
69 add_custom_target(docs-html
70 COMMAND ${CMAKE_COMMAND} -E copy ucx.css ${PANDOC_DESTDIR}/ucx.css
71 COMMAND ${CMAKE_COMMAND} -E copy ${LOGO_PATH} ${PANDOC_DESTDIR}/uaplogo.png
72 DEPENDS ${PANDOC_DEST} docs-html-21
73 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
74 COMMENT "Generating HTML documentation with pandoc."
75 )

mercurial