Skip to content

Commit 5698071

Browse files
authored
[docs] Rearrange cmake configuration options in development.md (#4110)
- emphasize the common options between "in-tree extended", "in-of-tree base", and "out-of-tree"
1 parent 35fc83f commit 5698071

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

docs/development.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,17 @@ This will build `libtorch` / `PyTorch` wheels from source and requires [the enab
106106

107107
```shell
108108
cmake -GNinja -Bbuild \
109-
externals/llvm-project/llvm \
110109
`# Enables "--debug" and "--debug-only" flags for the "torch-mlir-opt" tool` \
111110
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
112111
-DLLVM_ENABLE_ASSERTIONS=ON \
113112
-DPython3_FIND_VIRTUALENV=ONLY \
113+
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
114+
-DLLVM_TARGETS_TO_BUILD=host \
115+
`# For building LLVM "in-tree"` \
116+
externals/llvm-project/llvm \
114117
-DLLVM_ENABLE_PROJECTS=mlir \
115118
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
116119
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \
117-
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
118-
-DLLVM_TARGETS_TO_BUILD=host \
119120
`# use clang`\
120121
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
121122
`# use ccache to cache build results` \
@@ -145,12 +146,13 @@ cmake -GNinja -Bbuild \
145146
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
146147
-DLLVM_ENABLE_ASSERTIONS=ON \
147148
-DPython3_FIND_VIRTUALENV=ONLY \
148-
-DLLVM_ENABLE_PROJECTS=mlir \
149-
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
150-
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD" \
151149
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
152150
-DLLVM_TARGETS_TO_BUILD=host \
153-
externals/llvm-project/llvm
151+
`# For building LLVM "in-tree"` \
152+
externals/llvm-project/llvm \
153+
-DLLVM_ENABLE_PROJECTS=mlir \
154+
-DLLVM_EXTERNAL_PROJECTS="torch-mlir" \
155+
-DLLVM_EXTERNAL_TORCH_MLIR_SOURCE_DIR="$PWD"
154156
```
155157
156158
@@ -163,10 +165,11 @@ cmake -GNinja -Bbuild \
163165
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
164166
-DLLVM_ENABLE_ASSERTIONS=ON \
165167
-DPython3_FIND_VIRTUALENV=ONLY \
166-
-DMLIR_DIR="$LLVM_INSTALL_DIR/lib/cmake/mlir/" \
167-
-DLLVM_DIR="$LLVM_INSTALL_DIR/lib/cmake/llvm/" \
168168
-DMLIR_ENABLE_BINDINGS_PYTHON=ON \
169169
-DLLVM_TARGETS_TO_BUILD=host \
170+
`# For building LLVM "out-of-tree"` \
171+
-DMLIR_DIR="$LLVM_INSTALL_DIR/lib/cmake/mlir/" \
172+
-DLLVM_DIR="$LLVM_INSTALL_DIR/lib/cmake/llvm/"
170173
.
171174
```
172175
The same QoL CMake flags can be used to enable clang, ccache, and lld. Be sure to have built LLVM with `-DLLVM_ENABLE_PROJECTS=mlir`.

0 commit comments

Comments
 (0)