diff --git a/iceoryx_binding_c/CMakeLists.txt b/iceoryx_binding_c/CMakeLists.txt index b654e678c1..d4ab6c6d27 100644 --- a/iceoryx_binding_c/CMakeLists.txt +++ b/iceoryx_binding_c/CMakeLists.txt @@ -22,6 +22,7 @@ find_package(iceoryx_utils REQUIRED) include(IceoryxPackageHelper) include(IceoryxPlatform) +include(IceoryxDoxygen) # ########## set variables for export ########## diff --git a/iceoryx_dds/CMakeLists.txt b/iceoryx_dds/CMakeLists.txt index 6321985d3b..f5b3bba957 100644 --- a/iceoryx_dds/CMakeLists.txt +++ b/iceoryx_dds/CMakeLists.txt @@ -23,6 +23,7 @@ find_package(iceoryx_utils REQUIRED) include(IceoryxPackageHelper) include(IceoryxPlatform) +include(IceoryxDoxygen) # ########## set variables for export ########## diff --git a/iceoryx_meta/build_options.cmake b/iceoryx_meta/build_options.cmake index efcdfc907e..3e568a57c2 100644 --- a/iceoryx_meta/build_options.cmake +++ b/iceoryx_meta/build_options.cmake @@ -19,6 +19,7 @@ option(TOML_CONFIG "Activates or deactivates TOML support - without TOML RouDi w option(ONE_TO_MANY_ONLY "Restricts communication to 1:n pattern" OFF) option(BUILD_STRICT "Build is performed with '-Werror'" OFF) option(BUILD_TEST "Build all tests" OFF) +option(BUILD_DOC "Build and generate documentation" OFF) option(COVERAGE "Build iceoryx with gcov flags" OFF) option(EXAMPLES "Build all iceoryx examples" OFF) option(INTROSPECTION "Builds the introspection client which requires the ncurses library with an activated terminfo feature" ON) @@ -38,6 +39,11 @@ if(BUILD_ALL) set(DDS_GATEWAY ON) endif() +if(BUILD_DOC) + set(BUILD_TEST ON) + find_package(Doxygen REQUIRED) +endif() + if(COVERAGE) set(BUILD_TEST ON) endif() @@ -72,3 +78,4 @@ message(" CLANG_TIDY...........................: " ${CLANG_TIDY}) message(" ROUDI_ENVIRONMENT....................: " ${ROUDI_ENVIRONMENT}) message(" CMAKE_EXPORT_COMPILE_COMMANDS........: " ${CMAKE_EXPORT_COMPILE_COMMANDS}) message(" ONE_TO_MANY_ONLY ....................: " ${ONE_TO_MANY_ONLY}) +message(" BUILD_DOC............................: " ${BUILD_DOC}) diff --git a/iceoryx_posh/CMakeLists.txt b/iceoryx_posh/CMakeLists.txt index 93baa2b55b..6c3df64fb4 100644 --- a/iceoryx_posh/CMakeLists.txt +++ b/iceoryx_posh/CMakeLists.txt @@ -26,6 +26,7 @@ include(cmake/iceoryxversions.cmake) include(cmake/install_help_and_config.cmake) include(IceoryxPackageHelper) include(IceoryxPlatform) +include(IceoryxDoxygen) include(cmake/iceoryx_posh_deployment.cmake) diff --git a/iceoryx_utils/CMakeLists.txt b/iceoryx_utils/CMakeLists.txt index b5bed14752..960c66e7b4 100644 --- a/iceoryx_utils/CMakeLists.txt +++ b/iceoryx_utils/CMakeLists.txt @@ -19,6 +19,7 @@ project(iceoryx_utils VERSION ${iceoryx_utils_VERSION}) include("${CMAKE_CURRENT_LIST_DIR}/cmake/IceoryxPackageHelper.cmake") include("${CMAKE_CURRENT_LIST_DIR}/cmake/IceoryxPlatform.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/cmake/IceoryxDoxygen.cmake") if(CLANG_TIDY) find_program( @@ -257,6 +258,7 @@ install( FILES cmake/IceoryxPackageHelper.cmake cmake/IceoryxPlatform.cmake + cmake/IceoryxDoxygen.cmake DESTINATION ${DESTINATION_CONFIGDIR} ) diff --git a/iceoryx_utils/cmake/IceoryxDoxygen.cmake b/iceoryx_utils/cmake/IceoryxDoxygen.cmake new file mode 100644 index 0000000000..ce9b7de14a --- /dev/null +++ b/iceoryx_utils/cmake/IceoryxDoxygen.cmake @@ -0,0 +1,47 @@ +# Copyright (c) 2020 by Apex.AI Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +cmake_minimum_required(VERSION 3.5) + +if(BUILD_DOC) + + set(DOXYGEN_GENERATE_HTML YES) + set(DOXYGEN_GENERATE_LATEX YES) + set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/doc/${PROJECT_NAME}) + + if(EXISTS "/usr/share/plantuml/plantuml.jar") + set(DOXYGEN_PLANTUML_JAR_PATH /usr/share/plantuml/plantuml.jar) + else() + message(WARNING "plantuml.jar not found at '/usr/share/plantuml/', please set environment variable PLANTUML_JAR_PATH to the correct location.") + set(PLANTUML_JAR_PATH "$ENV{PLANTUML_JAR_PATH}" CACHE STRING "PLANTUML location." ) + endif() + + set(DOXYGEN_ALIASES + [["concurrent=\xrefitem concurrent \"Concurrent\" \"Concurrency\" " \ + "req=\xrefitem req \"Requirement\" \"Requirements\" " \ + "link=\xrefitem link \"Link\" \"Links\" " \ + swcomponent="@par Software Component:" \ + error="@par Error Handling:" \ + generatedcode="@par Generated by:"]] + ) + + doxygen_add_docs( + doxygen_${PROJECT_NAME} + ${PROJECT_SOURCE_DIR}/include + ${PROJECT_SOURCE_DIR}/source + ${PROJECT_SOURCE_DIR}/test + ALL + ) + +endif()