Add ddsconf to generate md, rnc and xsd configuration documentation

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
Jeroen Koekkoek 2020-06-09 19:36:14 +02:00
parent 9c04099937
commit b25f10ff33
20 changed files with 5596 additions and 5087 deletions

View file

@ -1,5 +1,5 @@
#
# Copyright(c) 2006 to 2019 ADLINK Technology Limited and others
# Copyright(c) 2020 ADLINK Technology Limited and others
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0 which is available at
@ -8,36 +8,28 @@
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
#
# These are all various expressions of the configuration schema
get_filename_component(config_c_PATH "../src/core/ddsi/src/q_config.c" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# although the following files are generated, we check them into source control for convenience
get_filename_component(config_rnc_PATH "../etc/cyclonedds.rnc" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
get_filename_component(config_xsd_PATH "../etc/cyclonedds.xsd" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
get_filename_component(config_md_PATH "./manual/options.md" REALPATH BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# although the following files are generated, they are checked into source
# control for convenience, but the user must copy them manually
set(cyclonedds_rnc "${CMAKE_CURRENT_BINARY_DIR}/cyclonedds.rnc")
set(cyclonedds_xsd "${CMAKE_CURRENT_BINARY_DIR}/cyclonedds.xsd")
set(options_md "${CMAKE_CURRENT_BINARY_DIR}/manual/options.md")
if(BUILD_SCHEMA OR BUILD_DOCS)
find_package(Perl REQUIRED)
add_custom_command(
OUTPUT
"${config_md_PATH}" "${config_rnc_PATH}"
COMMAND
${PERL_EXECUTABLE} -w "${CMAKE_CURRENT_SOURCE_DIR}/makernc.pl" "${config_c_PATH}" "${config_md_PATH}" "${config_rnc_PATH}"
COMMENT "Generating Relax NG schema and Markdown documentation for config options"
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/makernc.pl"
"${config_c_PATH}")
add_custom_target(options_doc ALL DEPENDS "${config_md_PATH}" "${config_rnc_PATH}")
find_package(Trang REQUIRED)
OUTPUT "${cyclonedds_rnc}" "${cyclonedds_xsd}"
COMMAND ddsconf ARGS -f rnc -o "${cyclonedds_rnc}"
COMMAND ddsconf ARGS -f xsd -o "${cyclonedds_xsd}"
DEPENDS ddsconf)
add_custom_target(schema DEPENDS "${cyclonedds_rnc}" "${cyclonedds_xsd}")
add_custom_command(
OUTPUT "${config_xsd_PATH}"
COMMAND ${Trang_TRANG_CMD} -I rnc -O xsd "${config_rnc_PATH}" "${config_xsd_PATH}"
COMMENT "Translating schema into XSD"
DEPENDS "${config_rnc_PATH}")
add_custom_target(options_xsd ALL DEPENDS "${config_xsd_PATH}")
OUTPUT "${options_md}"
COMMAND ${CMAKE_COMMAND} -E make_directory manual
COMMAND ddsconf ARGS -f md -o "${options_md}"
DEPENDS ddsconf)
add_custom_target(options_doc DEPENDS "${options_md}")
endif()
if(BUILD_DOCS)