1# 2# Arm SCP/MCP Software 3# Copyright (c) 2022, Arm Limited and Contributors. All rights reserved. 4# 5# SPDX-License-Identifier: BSD-3-Clause 6# 7 8# cmake-lint: disable=C0301 9 10find_package(Doxygen OPTIONAL_COMPONENTS dot mscgen dia) 11 12if(NOT DOXYGEN_FOUND OR DOXYGEN_VERSION VERSION_LESS 1.8.13) 13 return() 14endif() 15# 16# This fairly monstrous block of code actually does a deceptively simple 17# operation: it collects all the sources, include directories and definitions 18# given to each target that we are building, and surrounds them in quotes. 19# 20# The complexity comes in the fact that we do not know all of these until 21# generation time, at which point it is much harder to do even simple string 22# manipulation on them. Still, it can be done, and this allows us to mirror (to 23# the extent that we can) precisely what has been compiled and how to Doxygen. 24# 25 26# cmake-format: off 27 28set(scp_sources "\"$<JOIN:${scp_sources},\" \">\"") 29set(scp_includes "\"$<JOIN:${scp_includes},\" \">\"") 30set(scp_defines $<JOIN:${scp_defines}, >) 31 32list(APPEND scp_sources "${SCP_SOURCE_DIR}/change_log.md") 33list(APPEND scp_sources "${SCP_SOURCE_DIR}/license.md") 34list(APPEND scp_sources "${SCP_SOURCE_DIR}/readme.md") 35list(APPEND scp_sources "${SCP_SOURCE_DIR}/user_guide.md") 36 37list(APPEND scp_sources "$(CMAKE_CURRENT_SOURCE_DIR)/architecture_support.md") 38list(APPEND scp_sources "$(CMAKE_CURRENT_SOURCE_DIR)/cmsis.md") 39list(APPEND scp_sources "$(CMAKE_CURRENT_SOURCE_DIR)/code_rules.md") 40list(APPEND scp_sources "$(CMAKE_CURRENT_SOURCE_DIR)/code_style.md") 41list(APPEND scp_sources "$(CMAKE_CURRENT_SOURCE_DIR)/deferred_response_architecture.md") 42list(APPEND scp_sources "$(CMAKE_CURRENT_SOURCE_DIR)/framework.md") 43list(APPEND scp_sources "$(CMAKE_CURRENT_SOURCE_DIR)/glossary.md") 44list(APPEND scp_sources "${CMAKE_CURRENT_SOURCE_DIR}/build_system.md") 45list(APPEND scp_sources "${CMAKE_CURRENT_SOURCE_DIR}/cmake_readme.md") 46 47# cmake-format: on 48 49# 50# Configure the Doxyfile. 51# 52 53# cmake-lint: disable=C0103 54# cmake-format: off 55 56set(DOXYGEN_PREDEFINED "${scp_defines}") 57 58set(DOXYGEN_PROJECT_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/media/arm-logo-blue-rgb.svg") 59 60list(APPEND DOXYGEN_EXCLUDE_PATTERNS "${SCP_SOURCE_DIR}/contrib/*") 61 62list(APPEND DOXYGEN_STRIP_FROM_PATH "${SCP_SOURCE_DIR}") 63list(APPEND DOXYGEN_STRIP_FROM_PATH "${SCP_BINARY_DIR}") 64 65# cmake-format: on 66 67set(DOXYGEN_BUILTIN_STL_SUPPORT "YES") 68set(DOXYGEN_EXTRACT_ALL "YES") 69set(DOXYGEN_GENERATE_TREEVIEW "YES") 70set(DOXYGEN_MACRO_EXPANSION "NO") 71set(DOXYGEN_SOURCE_BROWSER "YES") 72 73doxygen_add_docs(doc "${scp_sources}" "${scp_includes}") 74 75# 76# The built-in Doxygen support creates a file at configure time that expands 77# `${VARIABLES}` but, because it doesn't run at generate time, cannot expand 78# `$<GENERATOR_EXPRESSIONS>`. We need to regenerate the Doxyfile and forcibly 79# expand these generator expressesions in order to make it valid. 80# 81 82file( 83 GENERATE 84 OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.doc" 85 INPUT "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.doc") 86