Lines Matching +full:build +full:- +full:root +full:- +full:directory
11 `CMake <http://www.cmake.org/>`_ is a cross-platform build-generator tool. CMake
12 does not build the project, it generates the files needed by your build tool
19 If you are really anxious about getting a functional LLVM build, go to the
22 `Options and variables`_ section is a reference for customizing your build. If
25 This page is geared towards users of the LLVM CMake build. If you're looking for
26 information about modifying the LLVM CMake build system you may want to see the
34 We use here the command-line, non-interactive CMake interface.
42 #. Create a build directory. Building LLVM in the source
43 directory is not supported. cd to this directory:
45 .. code-block:: console
50 #. Execute this command in the shell replacing `path/to/llvm/source/root` with
51 the path to the root of your LLVM source tree:
53 .. code-block:: console
55 $ cmake path/to/llvm/source/root
59 for all build parameters. See the `Options and variables`_ section for
60 a list of build parameters that you can modify.
66 to build MinGW makefiles if you have a POSIX shell reachable through the PATH
67 environment variable, for instance. You can force CMake to use a given build
71 the build from the build directory:
73 .. code-block:: console
75 $ cmake --build .
77 The ``--build`` option tells ``cmake`` to invoke the underlying build
80 The underlying build tool can be invoked directly, of course, but
81 the ``--build`` option is portable.
83 #. After LLVM has finished building, install it from the build directory:
85 .. code-block:: console
87 $ cmake --build . --target install
89 The ``--target`` option with ``install`` parameter in addition to
90 the ``--build`` option tells ``cmake`` to build the ``install`` target.
94 build directory:
96 .. code-block:: console
98 $ cmake -DCMAKE_INSTALL_PREFIX=/tmp/llvm -P cmake_install.cmake
107 which you may need in your day-to-day usage.
111 --help`` for further help options.
113 CMake allows you to specify a build tool (e.g., GNU make, Visual Studio,
115 build tool to use, based on your environment. Once it has identified your
116 build tool, CMake uses the corresponding *Generator* to create files for your
117 build tool (e.g., Makefiles or Visual Studio or Xcode project files). You can
118 explicitly specify the generator with the command line option ``-G "Name of the
121 .. code-block:: console
123 $ cmake --help
127 Generators' names are case-sensitive, and may contain spaces. For this reason,
128 you should enter them exactly as they are listed in the ``cmake --help``
132 .. code-block:: console
134 $ cmake -G "Visual Studio 12" path/to/llvm/source/root
140 you must tell this to CMake with the ``-G`` option.
151 Variables customize how the build will be generated. Options are boolean
155 .. code-block:: console
157 $ cmake -DVARIABLE=value path/to/llvm/source
162 .. code-block:: console
164 $ cmake -UVARIABLE path/to/llvm/source
167 stored at the root of your build directory that is generated by ``cmake``.
174 .. code-block:: console
176 $ cmake -DVARIABLE:TYPE=value path/to/llvm/source
178 Frequently-used CMake variables
179 -------------------------------
182 brief explanation and LLVM-specific notes. For full documentation, consult the
183 CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
186 Sets the build type for ``make``-based generators. Possible values are
188 Visual Studio, you should use the IDE settings to set the build type.
195 Extra suffix to append to the directory where libraries are to be
196 installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
205 .. _LLVM-specific variables:
207 LLVM-specific variables
208 -----------------------
211 Semicolon-separated list of targets to build, or *all* for building all
212 targets. Case-sensitive. Defaults to *all*. Example:
213 ``-DLLVM_TARGETS_TO_BUILD="X86;PowerPC"``.
216 Build LLVM tools. Defaults to ON. Targets for building each tool are generated
217 in any case. You can build a tool separately by invoking its target. For
218 example, you can build *llvm-as* with a Makefile-based system by executing *make
219 llvm-as* at the root of your build directory.
222 Generate build targets for the LLVM tools. Defaults to ON. You can use this
223 option to disable the generation of build targets for the LLVM tools.
226 Build LLVM examples. Defaults to OFF. Targets for building each example are
231 Generate build targets for the LLVM examples. Defaults to ON. You can use this
232 option to disable the generation of build targets for the LLVM examples.
235 Build LLVM unit tests. Defaults to OFF. Targets for building each unit test
236 are generated in any case. You can build a specific unit test using the
239 for a complete list of unit tests.) It is possible to build all unit tests
243 Generate build targets for the LLVM unit tests. Defaults to ON. You can use
244 this option to disable the generation of build targets for the LLVM unit
250 cmake must be invoked before the build. Defaults to OFF.
253 Build with threads support, if available. Defaults to ON.
256 Build in C++1y mode, if available. Defaults to OFF.
263 Build LLVM with exception-handling support. This is necessary if you wish to
271 Add the ``-fPIC`` flag to the compiler command-line, if the compiler supports
275 Build LLVM with run-time type information. Defaults to OFF.
281 Enable pedantic mode. This disables compiler-specific extensions, if
285 Stop and fail the build, if a compiler warning is triggered. Defaults to OFF.
291 assertion enabled build. `FORCE_ON` (`FORCE_OFF`) turns them on
292 (off) irrespective of whether normal (`NDEBUG`-based) assertions are
297 Build 32-bit executables and libraries on 64-bit systems. This option is
298 available only on some 64-bit Unix systems. Defaults to OFF.
303 of the machine where LLVM is being built. If you are cross-compiling, set it
307 Full path to a native TableGen executable (usually named ``llvm-tblgen``). This is
308 intended for cross-compiling: if the user sets this variable, no native
312 Arguments given to lit. ``make check`` and ``make clang-test`` are affected.
313 By default, ``'-sv --no-progress-bar'`` on Visual C++ and Xcode, ``'-sv'`` on
320 %PATH%, then you can set this variable to the GnuWin32 directory so that
321 lit can find tools needed for tests in that directory.
332 These variables specify the path to the source directory for the external
333 LLVM projects Clang, lld, and Polly, respectively, relative to the top-level
334 source directory. If the in-tree subdirectory for an external project
340 Semicolon-separated list of additional external projects to build as part of
343 ``-DLLVM_EXTERNAL_PROJECTS="Foo;Bar"
344 -DLLVM_EXTERNAL_FOO_SOURCE_DIR=/src/foo
345 -DLLVM_EXTERNAL_BAR_SOURCE_DIR=/src/bar``.
351 Path to a profdata file to pass into clang's -fprofile-instr-use flag. This
362 Define the sanitizer used to build LLVM binaries and tests. Possible values
367 Add ``-flto`` or ``-flto=`` flags to the compile and link command
368 lines, enabling link-time optimization. Possible values are ``Off``,
379 dependencies of the default build targets. This results in all of the (enabled)
380 documentation targets being as part of a normal build. If the ``install``
391 This affects the make target ``doxygen-llvm``. When enabled, apart from
394 This option is only useful in combination with ``-DLLVM_ENABLE_DOXYGEN=ON``;
399 ``-DLLVM_ENABLE_DOXYGEN=ON`` and
400 ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON`` are given. Defaults to
403 ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``;
410 combination with ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``; otherwise
419 useful in combination with ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``;
422 .. _Qt Help Project: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-filters
427 ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``; otherwise it has no
435 If specified, CMake will search for the ``sphinx-build`` executable and will make
440 The path to the ``sphinx-build`` executable detected by CMake.
446 source tree that uses sphinx (e.g. ``docs-llvm-html``, ``docs-clang-html``
447 and ``docs-lld-html``). Defaults to ON.
452 is enabled). Currently the only target added is ``docs-llvm-man``. Defaults
461 'install-xcode-toolchain'. This target will create a directory at
462 $CMAKE_INSTALL_PREFIX/Toolchains containing an xctoolchain directory which can
483 mingw-w64, but not when building with the Microsoft toolchain.
486 If you want to build LLVM as a shared library, you should use the
490 If enabled and building a debug or asserts build the CMake build system will
491 generate a Release build tree to build a fully optimized tablegen for use
492 during the build. Enabling this option can significantly speed up build times
498 Recently LLVM and Clang have been adding some more complicated build system
503 CMake cache files are utilized using CMake's -C flag:
505 .. code-block:: console
507 $ cmake -C <path to cache file> <path to sources>
515 - Order of command line arguments is important
517 - -D arguments specified before -C are set before the cache is processed and
519 - -D arguments specified after -C are set after the cache is processed and
522 - All -D arguments will override cache file settings
523 - CMAKE_TOOLCHAIN_FILE is evaluated after both the cache file and the command
525 - It is recommended that all -D options should be specified *before* -C
527 For more information about some of the advanced build configurations supported
533 Testing is performed when the *check-all* target is built. For instance, if you are
534 using Makefiles, execute this command in the root of your build directory:
536 .. code-block:: console
538 $ make check-all
540 On Visual Studio, you may run tests by building the project "check-all".
547 generic instructions on how to cross-compile with CMake. It goes into detailed
553 Also see the `LLVM-specific variables`_ section for variables used when
554 cross-compiling.
559 From LLVM 3.5 onwards both the CMake and autoconf/Makefile build systems export
561 now reliably use CMake to develop their own LLVM-based projects against an
565 and uses them to build a simple application ``simple-tool``.
567 .. code-block:: cmake
585 # Now build our tools
586 add_executable(simple-tool tool.cpp)
593 target_link_libraries(simple-tool ${llvm_libs})
598 directory where ``LLVMConfig.cmake`` is found or allows the user to specify the
599 directory (e.g. by passing ``-DLLVM_DIR=/usr/lib/cmake/llvm`` to
600 the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
609 ``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only
615 or you wish to build directly against the LLVM build tree you can use
622 The path to the LLVM CMake directory (i.e. the directory containing
647 The path to the directory containing the LLVM tools (e.g. ``llvm-as``).
649 Notice that in the above example we link ``simple-tool`` against several LLVM
652 components look at the output of running ``llvm-config --components``.
658 .. _cmake-out-of-source-pass:
661 ------------------------------------
666 .. code-block:: none
679 .. code-block:: cmake
690 .. code-block:: cmake
702 .. code-block:: cmake
709 .. code-block:: cmake
718 #. Copying ``<pass name>`` folder into ``<LLVM root>/lib/Transform`` directory.
721 ``<LLVM root>/lib/Transform/CMakeLists.txt``.
723 Compiler/Platform-specific topics
729 --------------------