universe@372: # universe@372: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. universe@372: # universe@390: # Copyright 2021 Mike Becker, Olaf Wintermann All rights reserved. universe@372: # universe@372: # Redistribution and use in source and binary forms, with or without universe@372: # modification, are permitted provided that the following conditions are met: universe@372: # universe@372: # 1. Redistributions of source code must retain the above copyright universe@372: # notice, this list of conditions and the following disclaimer. universe@372: # universe@372: # 2. Redistributions in binary form must reproduce the above copyright universe@372: # notice, this list of conditions and the following disclaimer in the universe@372: # documentation and/or other materials provided with the distribution. universe@372: # universe@372: # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@372: # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@372: # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE universe@372: # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE universe@372: # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR universe@372: # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF universe@372: # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS universe@372: # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN universe@372: # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) universe@372: # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE universe@372: # POSSIBILITY OF SUCH DAMAGE. universe@372: # universe@372: universe@372: set(PANDOC_DESTDIR ${CMAKE_BINARY_DIR}/docs/web) universe@372: set(PANDOC_ARGS -c ucx.css -B header.html -A footer.html -T 'UAP Common Extensions') universe@390: set(PANDOC_SRC index.md license.md install.md) universe@372: set(LOGO_PATH ../../uaplogo.png) universe@372: universe@372: if (NOT EXISTS ${PANDOC_EXECUTABLE}) universe@372: find_program(PANDOC_EXECUTABLE pandoc) universe@372: if(NOT EXISTS ${PANDOC_EXECUTABLE}) universe@372: message(WARNING Pandoc not found, docs-html target will not be generated.) universe@372: return() universe@372: endif() universe@372: endif() universe@372: universe@372: message(STATUS "HTML Documentation will be generated at: ${PANDOC_DESTDIR}.") universe@372: file(MAKE_DIRECTORY ${PANDOC_DESTDIR}) universe@372: universe@390: # UCX 3.0 documentation universe@372: foreach(source_file ${PANDOC_SRC}) universe@372: string(REPLACE .md .html dest_file ${source_file}) universe@372: string(PREPEND dest_file "${PANDOC_DESTDIR}/") universe@372: list(APPEND PANDOC_DEST ${dest_file}) universe@372: add_custom_command( universe@372: OUTPUT ${dest_file} universe@372: COMMAND ${PANDOC_EXECUTABLE} ${PANDOC_ARGS} -o ${dest_file} ${source_file} universe@372: WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} universe@372: MAIN_DEPENDENCY ${source_file} universe@372: ) universe@372: endforeach() universe@372: universe@390: # UCX 2.1 documentation universe@390: add_custom_target(docs-html-21 universe@390: COMMAND ${PANDOC_EXECUTABLE} -c ucx.css -B header-ucx2.html -A footer.html universe@390: -T 'UAP Common Extensions' -o ${PANDOC_DESTDIR}/modules-ucx2.html modules-ucx2.md universe@390: WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} universe@390: DEPENDS modules-ucx2.md universe@390: COMMENT "Adding UCX 2.1 HTML documentation." universe@390: ) universe@390: universe@390: # Collect all HTML documentation universe@372: add_custom_target(docs-html universe@372: COMMAND ${CMAKE_COMMAND} -E copy ucx.css ${PANDOC_DESTDIR}/ucx.css universe@372: COMMAND ${CMAKE_COMMAND} -E copy ${LOGO_PATH} ${PANDOC_DESTDIR}/uaplogo.png universe@390: DEPENDS ${PANDOC_DEST} docs-html-21 universe@372: WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} universe@372: COMMENT "Generating HTML documentation with pandoc." universe@372: )