Skip to content

Commit 0c24894

Browse files
author
Samarth Narang
committed
Separate out build directories for man and html builds
1 parent ef6fa37 commit 0c24894

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

flang/docs/CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ function (gen_rst_file_from_td output_file td_option source)
9999
endfunction()
100100

101101
if (LLVM_ENABLE_SPHINX)
102+
set (FLANG_DOCS_HTML_DIR "${CMAKE_CURRENT_BINARY_DIR}/SourceHtml")
103+
set (FLANG_DOCS_MAN_DIR "${CMAKE_CURRENT_BINARY_DIR}/SourceMan")
102104
include(AddSphinxTarget)
103105
if (SPHINX_FOUND)
104106

@@ -117,18 +119,18 @@ if (LLVM_ENABLE_SPHINX)
117119
add_custom_target(copy-flang-src-docs-html
118120
COMMAND "${CMAKE_COMMAND}" -E copy_directory
119121
"${CMAKE_CURRENT_SOURCE_DIR}"
120-
"${CMAKE_CURRENT_BINARY_DIR}/Source"
122+
"${FLANG_DOCS_HTML_DIR}"
121123
COMMAND "${CMAKE_COMMAND}" -E remove
122-
"${CMAKE_CURRENT_BINARY_DIR}/Source/CommandGuide/index.rst"
124+
"${FLANG_DOCS_HTML_DIR}/CommandGuide/index.rst"
123125
DEPENDS flang-doc gen-FlangCommandLineReference.rst)
124126

125127
# Run Python preprocessing ONLY for HTML build
126128
# This script prepends headers to FIRLangRef.md for proper formatting
127129
add_custom_command(TARGET copy-flang-src-docs-html
128130
COMMAND "${Python3_EXECUTABLE}"
129-
ARGS ${CMAKE_CURRENT_BINARY_DIR}/Source/FIR/CreateFIRLangRef.py)
131+
ARGS "${FLANG_DOCS_HTML_DIR}/FIR/CreateFIRLangRef.py")
130132

131-
add_sphinx_target(html flang SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Source")
133+
add_sphinx_target(html flang SOURCE_DIR "${FLANG_DOCS_HTML_DIR}")
132134
add_dependencies(docs-flang-html copy-flang-src-docs-html)
133135
endif()
134136

@@ -144,16 +146,19 @@ if (LLVM_ENABLE_SPHINX)
144146
# - FlangCommandLineReference.rst (generated reference)
145147
add_custom_target(copy-flang-src-docs-man
146148
COMMAND "${CMAKE_COMMAND}" -E make_directory
147-
"${CMAKE_CURRENT_BINARY_DIR}/Source"
149+
"${FLANG_DOCS_MAN_DIR}"
148150
COMMAND "${CMAKE_COMMAND}" -E copy
149151
"${CMAKE_CURRENT_SOURCE_DIR}/conf.py"
150-
"${CMAKE_CURRENT_BINARY_DIR}/Source/conf.py"
152+
"${FLANG_DOCS_MAN_DIR}/conf.py"
153+
COMMAND "${CMAKE_COMMAND}" -E copy
154+
"${CMAKE_CURRENT_BINARY_DIR}/Source/FlangCommandLineReference.rst"
155+
"${FLANG_DOCS_MAN_DIR}/FlangCommandLineReference.rst"
151156
COMMAND "${CMAKE_COMMAND}" -E copy
152157
"${CMAKE_CURRENT_SOURCE_DIR}/CommandGuide/index.rst"
153-
"${CMAKE_CURRENT_BINARY_DIR}/Source/index.rst"
158+
"${FLANG_DOCS_MAN_DIR}/index.rst"
154159
DEPENDS flang-doc gen-FlangCommandLineReference.rst)
155160

156-
add_sphinx_target(man flang SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/Source")
161+
add_sphinx_target(man flang SOURCE_DIR "${FLANG_DOCS_MAN_DIR}")
157162
add_dependencies(docs-flang-man copy-flang-src-docs-man)
158163
endif()
159164
endif()

flang/docs/CommandGuide/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ Flang Command Line Reference
1919
.. toctree::
2020
:maxdepth: 1
2121

22-
../FlangCommandLineReference
22+
FlangCommandLineReference

0 commit comments

Comments
 (0)