Lines Matching +full:ninja +full:- +full:build
7 of specific tools using this infrastructure (e.g. ``clang-check``). This
14 Clang Tooling needs a compilation database to figure out specific build
17 invoking clang tools, you can either specify a path to a build directory
18 using a command line parameter ``-p`` or let Clang Tooling find this
20 build using CMake to use clang tools.
25 If you intend to use make to build LLVM, you should have CMake 2.8.6 or
29 make a build directory and run CMake from it:
31 .. code-block:: console
33 $ mkdir your/build/directory
34 $ cd your/build/directory
35 $ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON path/to/llvm/sources
38 ``-DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++``.
46 .. code-block:: console
48 $ ln -s $PWD/compile_commands.json path/to/llvm/source/
50 Now you are ready to build and test LLVM using make:
52 .. code-block:: console
54 $ make check-all
62 However, the Ninja generator does support this variable and can be used
66 First, you will need to install `Ninja`_. Once installed, the Ninja
71 will locate the MSVC compiler for the Ninja generator. The `documentation
72 <https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#path_and_env…
74 is to use a `developer command-prompt window
75 <https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#developer_co…
77 <https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#developer_co…
80 Now you can run CMake with the Ninja generator to export a compilation
83 .. code-block:: console
85 C:\> mkdir build-ninja
86 C:\> cd build-ninja
87 C:\build-ninja> cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON path/to/llvm/sources
89 It is best to keep your Visual Studio IDE build folder separate from the
90 Ninja build folder. This prevents the two build systems from negatively
93 Once the ``compile_commands.json`` file has been created by Ninja, you can
102 IDE from a suitable command-prompt window.
108 you have a recent clang installed, you should have ``clang-check`` in
111 .. code-block:: console
113 $ clang-check tools/clang/lib/Tooling/CompilationDatabase.cpp
115 If you're using vim, it's convenient to have clang-check integrated. Put
136 call ClangCheckImpl("clang-check " . l:filename)
140 echo "Can't detect file's compilation arguments and no previous clang-check invocation!"
148 will re-run the last clang-check invocation made from this vim instance
150 automatically when clang-check finds errors, and can be re-opened with
153 Other ``clang-check`` options that can be useful when working with clang
156 * ``-ast-print`` --- Build ASTs and then pretty-print them.
157 * ``-ast-dump`` --- Build ASTs and then debug dump them.
158 * ``-ast-dump-filter=<string>`` --- Use with ``-ast-dump`` or ``-ast-print`` to
160 qualified name. Use ``-ast-list`` to list all filterable declaration node
162 * ``-ast-list`` --- Build ASTs and print the list of declaration node qualified
167 .. code-block:: console
169 …$ clang-check tools/clang/tools/clang-check/ClangCheck.cpp -ast-dump -ast-dump-filter ActionFactor…
170 Processing: tools/clang/tools/clang-check/ClangCheck.cpp.
172 …r() (CompoundStmt 0x44da290 </home/alexfh/local/llvm/tools/clang/tools/clang-check/ClangCheck.cpp:…
177 …$ clang-check tools/clang/tools/clang-check/ClangCheck.cpp -ast-print -ast-dump-filter ActionFacto…
178 Processing: tools/clang/tools/clang-check/ClangCheck.cpp.
181 if (this->ASTList.operator _Bool())
183 if (this->ASTDump.operator _Bool())
185 this->ASTDumpFilter);
186 if (this->ASTPrint.operator _Bool())
187 return clang::CreateASTPrinter(&llvm::outs(), this->ASTDumpFilter);
191 Using Ninja Build System
194 Optionally you can use the `Ninja`_ build system instead of make. It is
196 building Ninja from sources.
198 To take advantage of using Clang Tools along with Ninja build you need
201 Clone the Ninja git repository and build Ninja from sources:
203 .. code-block:: console
205 $ git clone git://github.com/martine/ninja.git
206 $ cd ninja/
209 This will result in a single binary ``ninja`` in the current directory.
213 .. code-block:: console
215 $ sudo cp ninja /usr/local/bin/
216 $ sudo chmod a+rx /usr/local/bin/ninja
218 After doing all of this, you'll need to generate Ninja build files for
219 LLVM with CMake. You need to make a build directory and run CMake from
222 .. code-block:: console
224 $ mkdir your/build/directory
225 $ cd your/build/directory
226 $ cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON path/to/llvm/sources
229 ``-DCMAKE_C_COMPILER=/path/to/clang -DCMAKE_CXX_COMPILER=/path/to/clang++``.
237 .. code-block:: console
239 $ ln -s $PWD/compile_commands.json path/to/llvm/source/
241 Now you are ready to build and test LLVM using Ninja:
243 .. code-block:: console
245 $ ninja check-all
249 .. _Ninja: https://ninja-build.org/