1 # |
1 # |
2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 # |
3 # |
4 # Copyright 2019 Mike Becker, Olaf Wintermann All rights reserved. |
4 # Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. |
5 # |
5 # |
6 # Redistribution and use in source and binary forms, with or without |
6 # Redistribution and use in source and binary forms, with or without |
7 # modification, are permitted provided that the following conditions are met: |
7 # modification, are permitted provided that the following conditions are met: |
8 # |
8 # |
9 # 1. Redistributions of source code must retain the above copyright |
9 # 1. Redistributions of source code must retain the above copyright |
26 # POSSIBILITY OF SUCH DAMAGE. |
26 # POSSIBILITY OF SUCH DAMAGE. |
27 # |
27 # |
28 |
28 |
29 set(PANDOC_DESTDIR ${CMAKE_BINARY_DIR}/docs/web) |
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') |
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 modules.md install.md) |
31 set(PANDOC_SRC index.md license.md install.md) |
32 set(LOGO_PATH ../../uaplogo.png) |
32 set(LOGO_PATH ../../uaplogo.png) |
33 |
33 |
34 if (NOT EXISTS ${PANDOC_EXECUTABLE}) |
34 if (NOT EXISTS ${PANDOC_EXECUTABLE}) |
35 find_program(PANDOC_EXECUTABLE pandoc) |
35 find_program(PANDOC_EXECUTABLE pandoc) |
36 if(NOT EXISTS ${PANDOC_EXECUTABLE}) |
36 if(NOT EXISTS ${PANDOC_EXECUTABLE}) |
40 endif() |
40 endif() |
41 |
41 |
42 message(STATUS "HTML Documentation will be generated at: ${PANDOC_DESTDIR}.") |
42 message(STATUS "HTML Documentation will be generated at: ${PANDOC_DESTDIR}.") |
43 file(MAKE_DIRECTORY ${PANDOC_DESTDIR}) |
43 file(MAKE_DIRECTORY ${PANDOC_DESTDIR}) |
44 |
44 |
|
45 # UCX 3.0 documentation |
45 foreach(source_file ${PANDOC_SRC}) |
46 foreach(source_file ${PANDOC_SRC}) |
46 string(REPLACE .md .html dest_file ${source_file}) |
47 string(REPLACE .md .html dest_file ${source_file}) |
47 string(PREPEND dest_file "${PANDOC_DESTDIR}/") |
48 string(PREPEND dest_file "${PANDOC_DESTDIR}/") |
48 list(APPEND PANDOC_DEST ${dest_file}) |
49 list(APPEND PANDOC_DEST ${dest_file}) |
49 add_custom_command( |
50 add_custom_command( |
52 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
53 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
53 MAIN_DEPENDENCY ${source_file} |
54 MAIN_DEPENDENCY ${source_file} |
54 ) |
55 ) |
55 endforeach() |
56 endforeach() |
56 |
57 |
|
58 # UCX 2.1 documentation |
|
59 add_custom_target(docs-html-21 |
|
60 COMMAND ${PANDOC_EXECUTABLE} -c ucx.css -B header-ucx2.html -A footer.html |
|
61 -T 'UAP Common Extensions' -o ${PANDOC_DESTDIR}/modules-ucx2.html modules-ucx2.md |
|
62 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
|
63 DEPENDS modules-ucx2.md |
|
64 COMMENT "Adding UCX 2.1 HTML documentation." |
|
65 ) |
|
66 |
|
67 # Collect all HTML documentation |
57 add_custom_target(docs-html |
68 add_custom_target(docs-html |
58 COMMAND ${CMAKE_COMMAND} -E copy ucx.css ${PANDOC_DESTDIR}/ucx.css |
69 COMMAND ${CMAKE_COMMAND} -E copy ucx.css ${PANDOC_DESTDIR}/ucx.css |
59 COMMAND ${CMAKE_COMMAND} -E copy ${LOGO_PATH} ${PANDOC_DESTDIR}/uaplogo.png |
70 COMMAND ${CMAKE_COMMAND} -E copy ${LOGO_PATH} ${PANDOC_DESTDIR}/uaplogo.png |
60 DEPENDS ${PANDOC_DEST} |
71 DEPENDS ${PANDOC_DEST} docs-html-21 |
61 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
72 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
62 COMMENT "Generating HTML documentation with pandoc." |
73 COMMENT "Generating HTML documentation with pandoc." |
63 ) |
74 ) |