aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGalanakis, Minos <minos.galanakis@arm.com>2019-11-08 11:28:40 +0000
committerTamas Ban <tamas.ban@arm.com>2019-11-26 11:04:04 +0000
commit0c1ad78607c2e4e1b764c52f4d42fb7d74d6151e (patch)
tree44f0ad743bf79dac9fdd876c0a21b33e479b95f4 /cmake
parent6ccf7ec77cc98612c4ba807c5502c19b47e71162 (diff)
downloadtrusted-firmware-m-0c1ad78607c2e4e1b764c52f4d42fb7d74d6151e.tar.gz
Doc: Added nested index structure
This patch adjusts the structure of documentation, making it easier to organise and navigate. * Modifies index.rst.in decoupled from cmake index.rst. * Creates respective indexes in the documentation sub-directories and links them to the master index * External component documentation is preserved * CMAKE build system is updated to automate the document listing in the design_documents index instead of the master index. Change-Id: I697b68e19dc57ecf7f36bc6dd8248fe345bdad61 Signed-off-by: Galanakis, Minos <minos.galanakis@arm.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Common/BuildSphinxDoc.cmake6
-rw-r--r--cmake/SphinxCopyDoc.cmake11
-rw-r--r--cmake/SphinxDesignDocStatus.cmake9
3 files changed, 17 insertions, 9 deletions
diff --git a/cmake/Common/BuildSphinxDoc.cmake b/cmake/Common/BuildSphinxDoc.cmake
index 74ead011b..3aea00fef 100644
--- a/cmake/Common/BuildSphinxDoc.cmake
+++ b/cmake/Common/BuildSphinxDoc.cmake
@@ -76,9 +76,10 @@ if (NOT SPHINX_NODOC)
set(SPHINXCFG_TEMPLATE_FILE "${TFM_ROOT_DIR}/docs/conf.py.in")
set(SPHINXCFG_CONFIGURED_FILE "${SPHINXCFG_OUTPUT_PATH}/conf.py")
- set(SPHINX_TEMPLATE_INDEX_FILE "${TFM_ROOT_DIR}/docs/index.rst.in")
- set(SPHINX_CONFIGURED_INDEX_FILE "${SPHINX_TMP_DOC_DIR}/index.rst")
set(SPHINX_DESIGN_DOC_ROOT "${TFM_ROOT_DIR}/docs/design_documents")
+ set(SPHINX_TEMPLATE_INDEX_FILE "${SPHINX_DESIGN_DOC_ROOT}/index.rst.in")
+ set(SPHINX_CONFIGURED_INDEX_FILE "${SPHINX_TMP_DOC_DIR}/docs/design_documents/index.rst")
+ set(SPHINX_MAIN_INDEX_FILE "docs/index.rst")
#Version ID of TF-M.
#TODO: this shall not be hard-coded here. We need a process to define the
@@ -111,6 +112,7 @@ if (NOT SPHINX_NODOC)
COMMAND "${CMAKE_COMMAND}" -D TFM_ROOT_DIR=${TFM_ROOT_DIR}
-D DST_DIR=${SPHINX_TMP_DOC_DIR}
-D BINARY_DIR=${CMAKE_BINARY_DIR}
+ -D MASTER_IDX=${SPHINX_MAIN_INDEX_FILE}
-P "${TFM_ROOT_DIR}/cmake/SphinxCopyDoc.cmake"
WORKING_DIRECTORY "${TFM_ROOT_DIR}"
DEPENDS run-allways
diff --git a/cmake/SphinxCopyDoc.cmake b/cmake/SphinxCopyDoc.cmake
index e95757c73..6bf2f073a 100644
--- a/cmake/SphinxCopyDoc.cmake
+++ b/cmake/SphinxCopyDoc.cmake
@@ -26,10 +26,11 @@
#
#Usage:
# cmake -DDST_DIR=<path to destination> -DTFM_ROOT_DIR=<path to tf-m root> \
-# -DBINARY_DIR=${CMAKE_BINARY_DIR} -P SphinxCopyDoc.cmake
+# -DBINARY_DIR=${CMAKE_BINARY_DIR}
+# -DMASTER_IDX=<path to master index.rst> -P SphinxCopyDoc.cmake
#Check input parameters
-foreach(_PARAM IN ITEMS TFM_ROOT_DIR DST_DIR BINARY_DIR)
+foreach(_PARAM IN ITEMS TFM_ROOT_DIR DST_DIR BINARY_DIR MASTER_IDX)
if (NOT DEFINED ${_PARAM})
message(FATAL_ERROR "Variable ${_PARAM} is undefined. Please add -D${_PARAM}=<...> when calling this script.")
endif()
@@ -56,5 +57,9 @@ endforeach()
#Copy files with directory tree.
foreach(_FILE ${_COPY_FILES})
get_filename_component(_DIR ${_FILE} DIRECTORY)
- file(COPY ${_FILE} DESTINATION "${DST_DIR}/${_DIR}")
+ if (_FILE STREQUAL MASTER_IDX)
+ file(COPY ${_FILE} DESTINATION "${DST_DIR}")
+ else()
+ file(COPY ${_FILE} DESTINATION "${DST_DIR}/${_DIR}")
+ endif()
endforeach()
diff --git a/cmake/SphinxDesignDocStatus.cmake b/cmake/SphinxDesignDocStatus.cmake
index e76c448a6..88438d340 100644
--- a/cmake/SphinxDesignDocStatus.cmake
+++ b/cmake/SphinxDesignDocStatus.cmake
@@ -20,7 +20,7 @@
Include(CMakeParseArguments)
#This function will search for .rst files in a given directory, read them and
-#check if the :Status: field is defined in them. Then will add each file to a
+#check if the ":Status:" field is defined in them. Then will add each file to a
#list with a name matching the status value.
#See the definition of _STATE_VALUES below for a list of valid state values.
#Files with missing or invalid state value will be placed on the "unknown" list.
@@ -174,15 +174,16 @@ function(sphinx_configure_index)
#Loop over files on the list of this status
foreach(_FILE IN LISTS _DD_${_STATUS})
- #Get the path of the file relative to the document root
- file(RELATIVE_PATH _REL_FILE ${_MY_PARAMS_DOC_ROOT} ${_FILE})
+
+ # Strip path from the filesince index is placed in same location
+ get_filename_component(_FILE ${_FILE} NAME)
#Detailed and Draft files go to the same section
if (_STATUS STREQUAL "DETAILED")
set(_STATUS "DRAFT")
endif()
#Append the file to the output string
- string(APPEND ${_STATUS}_DD_LIST "\n ${_REL_FILE}")
+ string(APPEND ${_STATUS}_DD_LIST "\n ${_FILE}")
endforeach()
endforeach()