Docs: Decouple from CMAKE and enable sphynx-build.
This patch is reducing the dependency of the documentation to
the TrustedFirmware-M build environment. Currently CMake will
copy over files from platforms, render the configuration files,
sort design documents and invoke the corresponding tools to
build the documentation.
This patch introduces an environment communicating interface file,
which CMAKE will need to populate, before calling the build command.
The file copy operation has been moved over to the sphynx-build logic,
and the design document’s classification is no longer required by the
new user interface.
The new implemenatation allows:
* Documentation can be built in an identical way through the build system,
retaining compatibility with existing tools, such as the CI.
* It is now possible to build documentation, by just invoking sphynx-build
from the build-docs directory.
* Third party tools/services like readthedocs.org can now render
the TF-M documentation.
* Reduced CMake code size.
* Documentation generating logic invokes ‘git describe’ in order to determine
a version. The order of precedence is set as:
Git Describe Version-> CMake hardcoded version -> Template version.
* CMake logic can still toggle parts of the new logic on and off if required.
* The full set of TF-M build dependencies are not longer required in order
to build documentation. Just the documentation dependencies would suffice.
Change-Id: I12e7bbffe9d1adb756329c46da13905e95096381
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
diff --git a/build_docs/conf.py b/build_docs/conf.py
new file mode 100644
index 0000000..5a83618
--- /dev/null
+++ b/build_docs/conf.py
@@ -0,0 +1,32 @@
+# -----------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+# -----------------------------------------------------------------------------
+#
+# Configuration file override for the Sphinx documentation builder.
+#
+# This file is used when Sphinx build is invoked directly at this level.
+# It will trigger a copy-files operation and render a new configuration
+# using either auto-detected or cmake provided parameters.
+import os
+import sys
+
+# Attempt to find the tools directory by recursing up to five levels of parents
+root_path = os.path.dirname(os.path.abspath(__file__))
+
+for i in range(5):
+ root_path = os.path.dirname(root_path)
+ doc_path = os.path.join(root_path, "tools", "documentation")
+ if os.path.isdir(doc_path):
+ sys.path.insert(0, os.path.abspath(doc_path))
+sys.path.append("./")
+
+# Trigger the copy operation logic
+import tfm_copy_files
+
+# Import the rendered configuration into global scope
+from tfm_cmake_defaults import *
+
+from conf_rendered import *