diff --git a/flang/docs/CMakeLists.txt b/flang/docs/CMakeLists.txt --- a/flang/docs/CMakeLists.txt +++ b/flang/docs/CMakeLists.txt @@ -95,7 +95,23 @@ 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) + add_dependencies(docs-flang-html flang-doc) + + # Copies flang/docs/ to binary directory + add_custom_target(copy-flang-src-docs + COMMAND "${CMAKE_COMMAND}" -E copy_directory + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/Source") + + # Copies FIRLangRef into the same directory so sphinx can use it + add_custom_command(TARGET docs-flang-html POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "${CMAKE_CURRENT_BINARY_DIR}/Dialect/FIRLangRef.md" + "${CMAKE_CURRENT_BINARY_DIR}/Source/FIRLangRef.md") + endif() if (${SPHINX_OUTPUT_MAN}) add_sphinx_target(man flang) diff --git a/flang/docs/_templates/indexsidebar.html b/flang/docs/_templates/indexsidebar.html --- a/flang/docs/_templates/indexsidebar.html +++ b/flang/docs/_templates/indexsidebar.html @@ -5,6 +5,7 @@