[flang-commits] [flang] b9f8a1e - [Flang] Add a link from the docs html page to the FIR html page

Dylan Fleming via flang-commits flang-commits at lists.llvm.org
Mon Jul 11 11:06:23 PDT 2022


Author: Dylan Fleming
Date: 2022-07-11T17:59:11Z
New Revision: b9f8a1ea84a8c77028f66906028e03cba67f6971

URL: https://github.com/llvm/llvm-project/commit/b9f8a1ea84a8c77028f66906028e03cba67f6971
DIFF: https://github.com/llvm/llvm-project/commit/b9f8a1ea84a8c77028f66906028e03cba67f6971.diff

LOG: [Flang] Add a link from the docs html page to the FIR html page

The Fortran Language Reference is currently generated via tablegen,
however isn't present on flang.llvm.org/docs/

This patch adds FIRLangRef.md to the flang/docs directoy,
and adds a link to the generated HTML file in sidebar
under the 'Documentation' heading.

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D128650

Added: 
    

Modified: 
    flang/docs/CMakeLists.txt
    flang/docs/_templates/indexsidebar.html

Removed: 
    


################################################################################
diff  --git a/flang/docs/CMakeLists.txt b/flang/docs/CMakeLists.txt
index 8d2edc493ec2..374bdf30cfbf 100644
--- a/flang/docs/CMakeLists.txt
+++ b/flang/docs/CMakeLists.txt
@@ -95,7 +95,24 @@ if (LLVM_ENABLE_SPHINX)
   include(AddSphinxTarget)
   if (SPHINX_FOUND)
     if (${SPHINX_OUTPUT_HTML})
-      add_sphinx_target(html flang)
+      add_sphinx_target(html flang SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Source")
+
+      add_dependencies(docs-flang-html copy-flang-src-docs)
+
+      # Copy the flang/docs directory and the generated FIRLangRef.md file to a place in the binary directory.
+      # Having all the files in a single directory makes it possible for Sphinx to process them together.
+      # Add a dependency to the flang-doc target to ensure that the FIRLangRef.md file is generated before the copying happens.
+      add_custom_target(copy-flang-src-docs
+        COMMAND "${CMAKE_COMMAND}" -E copy_directory
+        "${CMAKE_CURRENT_SOURCE_DIR}"
+        "${CMAKE_CURRENT_BINARY_DIR}/Source"
+
+        COMMAND "${CMAKE_COMMAND}" -E copy
+        "${CMAKE_CURRENT_BINARY_DIR}/Dialect/FIRLangRef.md"
+        "${CMAKE_CURRENT_BINARY_DIR}/Source/FIRLangRef.md"
+
+        DEPENDS flang-doc)
+
     endif()
     if (${SPHINX_OUTPUT_MAN})
       add_sphinx_target(man flang)

diff  --git a/flang/docs/_templates/indexsidebar.html b/flang/docs/_templates/indexsidebar.html
index b6f7942e46bd..d06ada300969 100644
--- a/flang/docs/_templates/indexsidebar.html
+++ b/flang/docs/_templates/indexsidebar.html
@@ -5,6 +5,7 @@ <h3>Documentation</h3>
 
 <ul class="want-points">
     <li><a href="https://github.com/llvm/llvm-project/blob/main/flang/README.md#getting-started">Getting Started</a></li>
+    <li><a class="reference internal" href="FIRLangRef.html">Fortran IR Language Reference</a></li>
 </ul>
 
 <h3>Getting Involved</h3>


        


More information about the flang-commits mailing list