annotate docs/CMake.rst @ 139:3c911905a0e9

add CodeGenPrepare Pass
author mir3636
date Thu, 08 Mar 2018 18:26:14 +0900
parents 3a76565eade5
children c2174574ed3a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 ========================
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 Building LLVM with CMake
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 ========================
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 .. contents::
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 :local:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 Introduction
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ============
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 `CMake <http://www.cmake.org/>`_ is a cross-platform build-generator tool. CMake
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 does not build the project, it generates the files needed by your build tool
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
13 (GNU make, Visual Studio, etc.) for building LLVM.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
15 If **you are a new contributor**, please start with the :doc:`GettingStarted`
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
16 page. This page is geared for existing contributors moving from the
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
17 legacy configure/make system.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
18
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 If you are really anxious about getting a functional LLVM build, go to the
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
20 `Quick start`_ section. If you are a CMake novice, start with `Basic CMake usage`_
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
21 and then go back to the `Quick start`_ section once you know what you are doing. The
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 `Options and variables`_ section is a reference for customizing your build. If
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 you already have experience with CMake, this is the recommended starting point.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
25 This page is geared towards users of the LLVM CMake build. If you're looking for
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
26 information about modifying the LLVM CMake build system you may want to see the
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
27 :doc:`CMakePrimer` page. It has a basic overview of the CMake language.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
28
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 .. _Quick start:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 Quick start
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 ===========
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 We use here the command-line, non-interactive CMake interface.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 #. `Download <http://www.cmake.org/cmake/resources/software.html>`_ and install
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
37 CMake. Version 3.4.3 is the minimum required.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 #. Open a shell. Your development tools must be reachable from this shell
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 through the PATH environment variable.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
42 #. Create a build directory. Building LLVM in the source
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
43 directory is not supported. cd to this directory:
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 .. code-block:: console
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 $ mkdir mybuilddir
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 $ cd mybuilddir
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
50 #. Execute this command in the shell replacing `path/to/llvm/source/root` with
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 the path to the root of your LLVM source tree:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 .. code-block:: console
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 $ cmake path/to/llvm/source/root
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
57 CMake will detect your development environment, perform a series of tests, and
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 generate the files required for building LLVM. CMake will use default values
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 for all build parameters. See the `Options and variables`_ section for
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
60 a list of build parameters that you can modify.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 This can fail if CMake can't detect your toolset, or if it thinks that the
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
63 environment is not sane enough. In this case, make sure that the toolset that
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
64 you intend to use is the only one reachable from the shell, and that the shell
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
65 itself is the correct one for your development environment. CMake will refuse
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 to build MinGW makefiles if you have a POSIX shell reachable through the PATH
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 environment variable, for instance. You can force CMake to use a given build
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
68 tool; for instructions, see the `Usage`_ section, below.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
70 #. After CMake has finished running, proceed to use IDE project files, or start
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
71 the build from the build directory:
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
72
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
73 .. code-block:: console
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
74
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
75 $ cmake --build .
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
76
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
77 The ``--build`` option tells ``cmake`` to invoke the underlying build
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
78 tool (``make``, ``ninja``, ``xcodebuild``, ``msbuild``, etc.)
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
79
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
80 The underlying build tool can be invoked directly, of course, but
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
81 the ``--build`` option is portable.
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
82
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
83 #. After LLVM has finished building, install it from the build directory:
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
84
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
85 .. code-block:: console
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
86
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
87 $ cmake --build . --target install
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
88
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
89 The ``--target`` option with ``install`` parameter in addition to
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
90 the ``--build`` option tells ``cmake`` to build the ``install`` target.
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
91
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
92 It is possible to set a different install prefix at installation time
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
93 by invoking the ``cmake_install.cmake`` script generated in the
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
94 build directory:
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
95
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
96 .. code-block:: console
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
97
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
98 $ cmake -DCMAKE_INSTALL_PREFIX=/tmp/llvm -P cmake_install.cmake
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
99
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 .. _Basic CMake usage:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 .. _Usage:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 Basic CMake usage
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 =================
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
106 This section explains basic aspects of CMake
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
107 which you may need in your day-to-day usage.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
109 CMake comes with extensive documentation, in the form of html files, and as
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
110 online help accessible via the ``cmake`` executable itself. Execute ``cmake
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
111 --help`` for further help options.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
113 CMake allows you to specify a build tool (e.g., GNU make, Visual Studio,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
114 or Xcode). If not specified on the command line, CMake tries to guess which
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
115 build tool to use, based on your environment. Once it has identified your
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
116 build tool, CMake uses the corresponding *Generator* to create files for your
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
117 build tool (e.g., Makefiles or Visual Studio or Xcode project files). You can
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 explicitly specify the generator with the command line option ``-G "Name of the
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
119 generator"``. To see a list of the available generators on your system, execute
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 .. code-block:: console
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 $ cmake --help
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
125 This will list the generator names at the end of the help text.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
126
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
127 Generators' names are case-sensitive, and may contain spaces. For this reason,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
128 you should enter them exactly as they are listed in the ``cmake --help``
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
129 output, in quotes. For example, to generate project files specifically for
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
130 Visual Studio 12, you can execute:
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 .. code-block:: console
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
134 $ cmake -G "Visual Studio 12" path/to/llvm/source/root
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 For a given development platform there can be more than one adequate
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
137 generator. If you use Visual Studio, "NMake Makefiles" is a generator you can use
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
138 for building with NMake. By default, CMake chooses the most specific generator
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 supported by your development environment. If you want an alternative generator,
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 you must tell this to CMake with the ``-G`` option.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 .. todo::
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 Explain variables and cache. Move explanation here from #options section.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 .. _Options and variables:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 Options and variables
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 =====================
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
150
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
151 Variables customize how the build will be generated. Options are boolean
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 variables, with possible values ON/OFF. Options and variables are defined on the
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
153 CMake command line like this:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
154
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 .. code-block:: console
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
156
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 $ cmake -DVARIABLE=value path/to/llvm/source
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
159 You can set a variable after the initial CMake invocation to change its
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 value. You can also undefine a variable:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
162 .. code-block:: console
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 $ cmake -UVARIABLE path/to/llvm/source
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
166 Variables are stored in the CMake cache. This is a file named ``CMakeCache.txt``
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
167 stored at the root of your build directory that is generated by ``cmake``.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
168 Editing it yourself is not recommended.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
170 Variables are listed in the CMake cache and later in this document with
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
171 the variable name and type separated by a colon. You can also specify the
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
172 variable and type on the CMake command line:
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 .. code-block:: console
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 $ cmake -DVARIABLE:TYPE=value path/to/llvm/source
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
177
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
178 Frequently-used CMake variables
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 -------------------------------
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
181 Here are some of the CMake variables that are used often, along with a
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
182 brief explanation and LLVM-specific notes. For full documentation, consult the
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
183 CMake manual, or execute ``cmake --help-variable VARIABLE_NAME``.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 **CMAKE_BUILD_TYPE**:STRING
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
186 Sets the build type for ``make``-based generators. Possible values are
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
187 Release, Debug, RelWithDebInfo and MinSizeRel. If you are using an IDE such as
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
188 Visual Studio, you should use the IDE settings to set the build type.
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
189 Be aware that Release and RelWithDebInfo use different optimization levels on
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
190 most platforms.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
191
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 **CMAKE_INSTALL_PREFIX**:PATH
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 Path where LLVM will be installed if "make install" is invoked or the
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
194 "install" target is built.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
196 **LLVM_LIBDIR_SUFFIX**:STRING
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 Extra suffix to append to the directory where libraries are to be
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198 installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 to install libraries to ``/usr/lib64``.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 **CMAKE_C_FLAGS**:STRING
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 Extra flags to use when compiling C source files.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 **CMAKE_CXX_FLAGS**:STRING
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 Extra flags to use when compiling C++ source files.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 .. _LLVM-specific variables:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
208
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
209 LLVM-specific variables
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
210 -----------------------
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
211
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
212 **LLVM_TARGETS_TO_BUILD**:STRING
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
213 Semicolon-separated list of targets to build, or *all* for building all
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
214 targets. Case-sensitive. Defaults to *all*. Example:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
215 ``-DLLVM_TARGETS_TO_BUILD="X86;PowerPC"``.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217 **LLVM_BUILD_TOOLS**:BOOL
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 Build LLVM tools. Defaults to ON. Targets for building each tool are generated
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
219 in any case. You can build a tool separately by invoking its target. For
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
220 example, you can build *llvm-as* with a Makefile-based system by executing *make
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
221 llvm-as* at the root of your build directory.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 **LLVM_INCLUDE_TOOLS**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
224 Generate build targets for the LLVM tools. Defaults to ON. You can use this
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
225 option to disable the generation of build targets for the LLVM tools.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
226
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
227 **LLVM_INSTALL_BINUTILS_SYMLINKS**:BOOL
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
228 Install symlinks from the binutils tool names to the corresponding LLVM tools.
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
229 For example, ar will be symlinked to llvm-ar.
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
230
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 **LLVM_BUILD_EXAMPLES**:BOOL
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 Build LLVM examples. Defaults to OFF. Targets for building each example are
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
233 generated in any case. See documentation for *LLVM_BUILD_TOOLS* above for more
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 details.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
235
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 **LLVM_INCLUDE_EXAMPLES**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
237 Generate build targets for the LLVM examples. Defaults to ON. You can use this
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
238 option to disable the generation of build targets for the LLVM examples.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
239
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
240 **LLVM_BUILD_TESTS**:BOOL
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
241 Build LLVM unit tests. Defaults to OFF. Targets for building each unit test
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
242 are generated in any case. You can build a specific unit test using the
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
243 targets defined under *unittests*, such as ADTTests, IRTests, SupportTests,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
244 etc. (Search for ``add_llvm_unittest`` in the subdirectories of *unittests*
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
245 for a complete list of unit tests.) It is possible to build all unit tests
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
246 with the target *UnitTests*.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
247
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 **LLVM_INCLUDE_TESTS**:BOOL
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 Generate build targets for the LLVM unit tests. Defaults to ON. You can use
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
250 this option to disable the generation of build targets for the LLVM unit
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 tests.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
252
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 **LLVM_APPEND_VC_REV**:BOOL
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
254 Embed version control revision info (svn revision number or Git revision id).
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
255 The version info is provided by the ``LLVM_REVISION`` macro in
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
256 ``llvm/include/llvm/Support/VCSRevision.h``. Developers using git who don't
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
257 need revision info can disable this option to avoid re-linking most binaries
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
258 after a branch switch. Defaults to ON.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
259
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
260 **LLVM_ENABLE_THREADS**:BOOL
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 Build with threads support, if available. Defaults to ON.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
262
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
263 **LLVM_ENABLE_CXX1Y**:BOOL
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
264 Build in C++1y mode, if available. Defaults to OFF.
33
e4204d083e25 LLVM 3.5
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
265
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 **LLVM_ENABLE_ASSERTIONS**:BOOL
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
267 Enables code assertions. Defaults to ON if and only if ``CMAKE_BUILD_TYPE``
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
268 is *Debug*.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
269
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
270 **LLVM_ENABLE_EH**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
271 Build LLVM with exception-handling support. This is necessary if you wish to
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
272 link against LLVM libraries and make use of C++ exceptions in your own code
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
273 that need to propagate through LLVM code. Defaults to OFF.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
274
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
275 **LLVM_ENABLE_EXPENSIVE_CHECKS**:BOOL
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
276 Enable additional time/memory expensive checking. Defaults to OFF.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
277
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
278 **LLVM_ENABLE_PIC**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
279 Add the ``-fPIC`` flag to the compiler command-line, if the compiler supports
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
280 this flag. Some systems, like Windows, do not need this flag. Defaults to ON.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
281
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
282 **LLVM_ENABLE_RTTI**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
283 Build LLVM with run-time type information. Defaults to OFF.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
284
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
285 **LLVM_ENABLE_WARNINGS**:BOOL
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
286 Enable all compiler warnings. Defaults to ON.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
287
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
288 **LLVM_ENABLE_PEDANTIC**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
289 Enable pedantic mode. This disables compiler-specific extensions, if
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
290 possible. Defaults to ON.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
291
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
292 **LLVM_ENABLE_WERROR**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
293 Stop and fail the build, if a compiler warning is triggered. Defaults to OFF.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
294
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
295 **LLVM_ABI_BREAKING_CHECKS**:STRING
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
296 Used to decide if LLVM should be built with ABI breaking checks or
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
297 not. Allowed values are `WITH_ASSERTS` (default), `FORCE_ON` and
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
298 `FORCE_OFF`. `WITH_ASSERTS` turns on ABI breaking checks in an
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
299 assertion enabled build. `FORCE_ON` (`FORCE_OFF`) turns them on
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
300 (off) irrespective of whether normal (`NDEBUG`-based) assertions are
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
301 enabled or not. A version of LLVM built with ABI breaking checks
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
302 is not ABI compatible with a version built without it.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
303
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
304 **LLVM_BUILD_32_BITS**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
305 Build 32-bit executables and libraries on 64-bit systems. This option is
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
306 available only on some 64-bit Unix systems. Defaults to OFF.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
307
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
308 **LLVM_TARGET_ARCH**:STRING
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 LLVM target to use for native code generation. This is required for JIT
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
310 generation. It defaults to "host", meaning that it shall pick the architecture
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
311 of the machine where LLVM is being built. If you are cross-compiling, set it
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
312 to the target architecture name.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
313
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
314 **LLVM_TABLEGEN**:STRING
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
315 Full path to a native TableGen executable (usually named ``llvm-tblgen``). This is
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
316 intended for cross-compiling: if the user sets this variable, no native
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
317 TableGen will be created.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
318
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
319 **LLVM_LIT_ARGS**:STRING
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
320 Arguments given to lit. ``make check`` and ``make clang-test`` are affected.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
321 By default, ``'-sv --no-progress-bar'`` on Visual C++ and Xcode, ``'-sv'`` on
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
322 others.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
323
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
324 **LLVM_LIT_TOOLS_DIR**:PATH
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
325 The path to GnuWin32 tools for tests. Valid on Windows host. Defaults to
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
326 the empty string, in which case lit will look for tools needed for tests
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
327 (e.g. ``grep``, ``sort``, etc.) in your %PATH%. If GnuWin32 is not in your
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
328 %PATH%, then you can set this variable to the GnuWin32 directory so that
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
329 lit can find tools needed for tests in that directory.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
330
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
331 **LLVM_ENABLE_FFI**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
332 Indicates whether the LLVM Interpreter will be linked with the Foreign Function
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
333 Interface library (libffi) in order to enable calling external functions.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
334 If the library or its headers are installed in a custom
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
335 location, you can also set the variables FFI_INCLUDE_DIR and
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
336 FFI_LIBRARY_DIR to the directories where ffi.h and libffi.so can be found,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
337 respectively. Defaults to OFF.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
338
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
339 **LLVM_EXTERNAL_{CLANG,LLD,POLLY}_SOURCE_DIR**:PATH
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
340 These variables specify the path to the source directory for the external
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
341 LLVM projects Clang, lld, and Polly, respectively, relative to the top-level
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
342 source directory. If the in-tree subdirectory for an external project
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
343 exists (e.g., llvm/tools/clang for Clang), then the corresponding variable
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
344 will not be used. If the variable for an external project does not point
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
345 to a valid path, then that project will not be built.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
346
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
347 **LLVM_ENABLE_PROJECTS**:STRING
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
348 Semicolon-separated list of projects to build, or *all* for building all
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
349 (clang, libcxx, libcxxabi, lldb, compiler-rt, lld, polly) projects.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
350 This flag assumes that projects are checked out side-by-side and not nested,
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
351 i.e. clang needs to be in parallel of llvm instead of nested in `llvm/tools`.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
352 This feature allows to have one build for only LLVM and another for clang+llvm
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
353 using the same source checkout.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
354
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
355 **LLVM_EXTERNAL_PROJECTS**:STRING
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
356 Semicolon-separated list of additional external projects to build as part of
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
357 llvm. For each project LLVM_EXTERNAL_<NAME>_SOURCE_DIR have to be specified
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
358 with the path for the source code of the project. Example:
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
359 ``-DLLVM_EXTERNAL_PROJECTS="Foo;Bar"
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
360 -DLLVM_EXTERNAL_FOO_SOURCE_DIR=/src/foo
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
361 -DLLVM_EXTERNAL_BAR_SOURCE_DIR=/src/bar``.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
362
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
363 **LLVM_USE_OPROFILE**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
364 Enable building OProfile JIT support. Defaults to OFF.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
365
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
366 **LLVM_PROFDATA_FILE**:PATH
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
367 Path to a profdata file to pass into clang's -fprofile-instr-use flag. This
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
368 can only be specified if you're building with clang.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
369
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 **LLVM_USE_INTEL_JITEVENTS**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
371 Enable building support for Intel JIT Events API. Defaults to OFF.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
372
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 **LLVM_ENABLE_ZLIB**:BOOL
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
374 Enable building with zlib to support compression/uncompression in LLVM tools.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 Defaults to ON.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
376
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
377 **LLVM_ENABLE_DIA_SDK**:BOOL
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
378 Enable building with MSVC DIA SDK for PDB debugging support. Available
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
379 only with MSVC. Defaults to ON.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
380
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 **LLVM_USE_SANITIZER**:STRING
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
382 Define the sanitizer used to build LLVM binaries and tests. Possible values
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
383 are ``Address``, ``Memory``, ``MemoryWithOrigins``, ``Undefined``, ``Thread``,
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
384 and ``Address;Undefined``. Defaults to empty string.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
385
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
386 **LLVM_ENABLE_LTO**:STRING
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
387 Add ``-flto`` or ``-flto=`` flags to the compile and link command
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
388 lines, enabling link-time optimization. Possible values are ``Off``,
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
389 ``On``, ``Thin`` and ``Full``. Defaults to OFF.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
390
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
391 **LLVM_USE_LINKER**:STRING
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
392 Add ``-fuse-ld={name}`` to the link invocation. The possible value depend on
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
393 your compiler, for clang the value can be an absolute path to your custom
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
394 linker, otherwise clang will prefix the name with ``ld.`` and apply its usual
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
395 search. For example to link LLVM with the Gold linker, cmake can be invoked
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
396 with ``-DLLVM_USE_LINKER=gold``.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
397
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
398 **LLVM_ENABLE_LLD**:BOOL
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
399 This option is equivalent to `-DLLVM_USE_LINKER=lld`, except during a 2-stage
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
400 build where a dependency is added from the first stage to the second ensuring
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
401 that lld is built before stage2 begins.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
402
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
403 **LLVM_PARALLEL_COMPILE_JOBS**:STRING
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
404 Define the maximum number of concurrent compilation jobs.
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
405
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
406 **LLVM_PARALLEL_LINK_JOBS**:STRING
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
407 Define the maximum number of concurrent link jobs.
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
408
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
409 **LLVM_BUILD_DOCS**:BOOL
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
410 Adds all *enabled* documentation targets (i.e. Doxgyen and Sphinx targets) as
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
411 dependencies of the default build targets. This results in all of the (enabled)
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
412 documentation targets being as part of a normal build. If the ``install``
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
413 target is run then this also enables all built documentation targets to be
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
414 installed. Defaults to OFF. To enable a particular documentation target, see
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
415 see LLVM_ENABLE_SPHINX and LLVM_ENABLE_DOXYGEN.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
416
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
417 **LLVM_ENABLE_DOXYGEN**:BOOL
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
418 Enables the generation of browsable HTML documentation using doxygen.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
419 Defaults to OFF.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
420
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
421 **LLVM_ENABLE_DOXYGEN_QT_HELP**:BOOL
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
422 Enables the generation of a Qt Compressed Help file. Defaults to OFF.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
423 This affects the make target ``doxygen-llvm``. When enabled, apart from
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
424 the normal HTML output generated by doxygen, this will produce a QCH file
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
425 named ``org.llvm.qch``. You can then load this file into Qt Creator.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
426 This option is only useful in combination with ``-DLLVM_ENABLE_DOXYGEN=ON``;
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
427 otherwise this has no effect.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
428
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
429 **LLVM_DOXYGEN_QCH_FILENAME**:STRING
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
430 The filename of the Qt Compressed Help file that will be generated when
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
431 ``-DLLVM_ENABLE_DOXYGEN=ON`` and
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
432 ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON`` are given. Defaults to
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
433 ``org.llvm.qch``.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
434 This option is only useful in combination with
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
435 ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``;
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
436 otherwise it has no effect.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
437
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
438 **LLVM_DOXYGEN_QHP_NAMESPACE**:STRING
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
439 Namespace under which the intermediate Qt Help Project file lives. See `Qt
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
440 Help Project`_
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
441 for more information. Defaults to "org.llvm". This option is only useful in
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
442 combination with ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``; otherwise
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
443 it has no effect.
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
444
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
445 **LLVM_DOXYGEN_QHP_CUST_FILTER_NAME**:STRING
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
446 See `Qt Help Project`_ for
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
447 more information. Defaults to the CMake variable ``${PACKAGE_STRING}`` which
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
448 is a combination of the package name and version string. This filter can then
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
449 be used in Qt Creator to select only documentation from LLVM when browsing
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
450 through all the help files that you might have loaded. This option is only
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
451 useful in combination with ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``;
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
452 otherwise it has no effect.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
453
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
454 .. _Qt Help Project: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-filters
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
455
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
456 **LLVM_DOXYGEN_QHELPGENERATOR_PATH**:STRING
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
457 The path to the ``qhelpgenerator`` executable. Defaults to whatever CMake's
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
458 ``find_program()`` can find. This option is only useful in combination with
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
459 ``-DLLVM_ENABLE_DOXYGEN_QT_HELP=ON``; otherwise it has no
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
460 effect.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
461
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
462 **LLVM_DOXYGEN_SVG**:BOOL
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
463 Uses .svg files instead of .png files for graphs in the Doxygen output.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
464 Defaults to OFF.
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
465
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
466 **LLVM_INSTALL_DOXYGEN_HTML_DIR**:STRING
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
467 The path to install Doxygen-generated HTML documentation to. This path can
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
468 either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
469 `share/doc/llvm/doxygen-html`.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
470
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
471 **LLVM_ENABLE_SPHINX**:BOOL
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
472 If specified, CMake will search for the ``sphinx-build`` executable and will make
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
473 the ``SPHINX_OUTPUT_HTML`` and ``SPHINX_OUTPUT_MAN`` CMake options available.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
474 Defaults to OFF.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
475
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
476 **SPHINX_EXECUTABLE**:STRING
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
477 The path to the ``sphinx-build`` executable detected by CMake.
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
478 For installation instructions, see
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
479 http://www.sphinx-doc.org/en/latest/install.html
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
480
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
481 **SPHINX_OUTPUT_HTML**:BOOL
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
482 If enabled (and ``LLVM_ENABLE_SPHINX`` is enabled) then the targets for
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
483 building the documentation as html are added (but not built by default unless
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
484 ``LLVM_BUILD_DOCS`` is enabled). There is a target for each project in the
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
485 source tree that uses sphinx (e.g. ``docs-llvm-html``, ``docs-clang-html``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
486 and ``docs-lld-html``). Defaults to ON.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
487
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
488 **SPHINX_OUTPUT_MAN**:BOOL
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
489 If enabled (and ``LLVM_ENABLE_SPHINX`` is enabled) the targets for building
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
490 the man pages are added (but not built by default unless ``LLVM_BUILD_DOCS``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
491 is enabled). Currently the only target added is ``docs-llvm-man``. Defaults
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
492 to ON.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
493
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
494 **SPHINX_WARNINGS_AS_ERRORS**:BOOL
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
495 If enabled then sphinx documentation warnings will be treated as
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
496 errors. Defaults to ON.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
497
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
498 **LLVM_INSTALL_SPHINX_HTML_DIR**:STRING
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
499 The path to install Sphinx-generated HTML documentation to. This path can
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
500 either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
501 `share/doc/llvm/html`.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
502
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
503 **LLVM_INSTALL_OCAMLDOC_HTML_DIR**:STRING
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
504 The path to install OCamldoc-generated HTML documentation to. This path can
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
505 either be absolute or relative to the CMAKE_INSTALL_PREFIX. Defaults to
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
506 `share/doc/llvm/ocaml-html`.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
507
100
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
508 **LLVM_CREATE_XCODE_TOOLCHAIN**:BOOL
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
509 OS X Only: If enabled CMake will generate a target named
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
510 'install-xcode-toolchain'. This target will create a directory at
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
511 $CMAKE_INSTALL_PREFIX/Toolchains containing an xctoolchain directory which can
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
512 be used to override the default system tools.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
513
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
514 **LLVM_BUILD_LLVM_DYLIB**:BOOL
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
515 If enabled, the target for building the libLLVM shared library is added.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
516 This library contains all of LLVM's components in a single shared library.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
517 Defaults to OFF. This cannot be used in conjunction with BUILD_SHARED_LIBS.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
518 Tools will only be linked to the libLLVM shared library if LLVM_LINK_LLVM_DYLIB
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
519 is also ON.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
520 The components in the library can be customised by setting LLVM_DYLIB_COMPONENTS
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
521 to a list of the desired components.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
522
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
523 **LLVM_LINK_LLVM_DYLIB**:BOOL
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
524 If enabled, tools will be linked with the libLLVM shared library. Defaults
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
525 to OFF. Setting LLVM_LINK_LLVM_DYLIB to ON also sets LLVM_BUILD_LLVM_DYLIB
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
526 to ON.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
527
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
528 **BUILD_SHARED_LIBS**:BOOL
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
529 Flag indicating if each LLVM component (e.g. Support) is built as a shared
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
530 library (ON) or as a static library (OFF). Its default value is OFF. On
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
531 Windows, shared libraries may be used when building with MinGW, including
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
532 mingw-w64, but not when building with the Microsoft toolchain.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
533
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
534 .. note:: BUILD_SHARED_LIBS is only recommended for use by LLVM developers.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
535 If you want to build LLVM as a shared library, you should use the
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
536 ``LLVM_BUILD_LLVM_DYLIB`` option.
7d135dc70f03 LLVM 3.9
Miyagi Mitsuki <e135756@ie.u-ryukyu.ac.jp>
parents: 95
diff changeset
537
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
538 **LLVM_OPTIMIZED_TABLEGEN**:BOOL
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
539 If enabled and building a debug or asserts build the CMake build system will
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
540 generate a Release build tree to build a fully optimized tablegen for use
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
541 during the build. Enabling this option can significantly speed up build times
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
542 especially when building LLVM in Debug configurations.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
543
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
544 **LLVM_REVERSE_ITERATION**:BOOL
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
545 If enabled, all supported unordered llvm containers would be iterated in
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
546 reverse order. This is useful for uncovering non-determinism caused by
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
547 iteration of unordered containers.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
548
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
549 **LLVM_BUILD_INSTRUMENTED_COVERAGE**:BOOL
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
550 If enabled, `source-based code coverage
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
551 <http://clang.llvm.org/docs/SourceBasedCodeCoverage.html>`_ instrumentation
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
552 is enabled while building llvm.
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
553
134
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
554 **LLVM_CCACHE_BUILD**:BOOL
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
555 If enabled and the ``ccache`` program is available, then LLVM will be
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
556 built using ``ccache`` to speed up rebuilds of LLVM and its components.
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
557 Defaults to OFF. The size and location of the cache maintained
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
558 by ``ccache`` can be adjusted via the LLVM_CCACHE_MAXSIZE and LLVM_CCACHE_DIR
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
559 options, which are passed to the CCACHE_MAXSIZE and CCACHE_DIR environment
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
560 variables, respectively.
3a76565eade5 update 5.0.1
mir3636
parents: 121
diff changeset
561
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
562 CMake Caches
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
563 ============
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
564
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
565 Recently LLVM and Clang have been adding some more complicated build system
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
566 features. Utilizing these new features often involves a complicated chain of
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
567 CMake variables passed on the command line. Clang provides a collection of CMake
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
568 cache scripts to make these features more approachable.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
569
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
570 CMake cache files are utilized using CMake's -C flag:
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
571
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
572 .. code-block:: console
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
573
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
574 $ cmake -C <path to cache file> <path to sources>
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
575
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
576 CMake cache scripts are processed in an isolated scope, only cached variables
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
577 remain set when the main configuration runs. CMake cached variables do not reset
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
578 variables that are already set unless the FORCE option is specified.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
579
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
580 A few notes about CMake Caches:
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
581
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
582 - Order of command line arguments is important
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
583
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
584 - -D arguments specified before -C are set before the cache is processed and
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
585 can be read inside the cache file
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
586 - -D arguments specified after -C are set after the cache is processed and
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
587 are unset inside the cache file
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
588
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
589 - All -D arguments will override cache file settings
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
590 - CMAKE_TOOLCHAIN_FILE is evaluated after both the cache file and the command
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
591 line arguments
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
592 - It is recommended that all -D options should be specified *before* -C
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
593
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
594 For more information about some of the advanced build configurations supported
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
595 via Cache files see :doc:`AdvancedBuilds`.
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
596
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
597 Executing the test suite
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
598 ========================
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
599
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
600 Testing is performed when the *check-all* target is built. For instance, if you are
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
601 using Makefiles, execute this command in the root of your build directory:
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
602
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
603 .. code-block:: console
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
604
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
605 $ make check-all
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
606
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
607 On Visual Studio, you may run tests by building the project "check-all".
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
608 For more information about testing, see the :doc:`TestingGuide`.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
609
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
610 Cross compiling
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
611 ===============
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
612
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
613 See `this wiki page <http://www.vtk.org/Wiki/CMake_Cross_Compiling>`_ for
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
614 generic instructions on how to cross-compile with CMake. It goes into detailed
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
615 explanations and may seem daunting, but it is not. On the wiki page there are
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
616 several examples including toolchain files. Go directly to `this section
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
617 <http://www.vtk.org/Wiki/CMake_Cross_Compiling#Information_how_to_set_up_various_cross_compiling_toolchains>`_
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
618 for a quick solution.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
619
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
620 Also see the `LLVM-specific variables`_ section for variables used when
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
621 cross-compiling.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
622
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
623 Embedding LLVM in your project
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 ==============================
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
625
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
626 From LLVM 3.5 onwards both the CMake and autoconf/Makefile build systems export
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
627 LLVM libraries as importable CMake targets. This means that clients of LLVM can
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
628 now reliably use CMake to develop their own LLVM-based projects against an
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
629 installed version of LLVM regardless of how it was built.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
630
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
631 Here is a simple example of a CMakeLists.txt file that imports the LLVM libraries
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
632 and uses them to build a simple application ``simple-tool``.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
633
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
634 .. code-block:: cmake
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
635
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
636 cmake_minimum_required(VERSION 3.4.3)
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
637 project(SimpleProject)
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
638
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
639 find_package(LLVM REQUIRED CONFIG)
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
640
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
641 message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
642 message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
643
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
644 # Set your project compile flags.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
645 # E.g. if using the C++ header files
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
646 # you will need to enable C++11 support
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
647 # for your compiler.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
648
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
649 include_directories(${LLVM_INCLUDE_DIRS})
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
650 add_definitions(${LLVM_DEFINITIONS})
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
651
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
652 # Now build our tools
83
60c9769439b8 LLVM 3.7
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 77
diff changeset
653 add_executable(simple-tool tool.cpp)
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
654
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
655 # Find the libraries that correspond to the LLVM components
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
656 # that we wish to use
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
657 llvm_map_components_to_libnames(llvm_libs support core irreader)
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
658
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
659 # Link against LLVM libraries
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
660 target_link_libraries(simple-tool ${llvm_libs})
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
661
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
662 The ``find_package(...)`` directive when used in CONFIG mode (as in the above
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
663 example) will look for the ``LLVMConfig.cmake`` file in various locations (see
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
664 cmake manual for details). It creates a ``LLVM_DIR`` cache entry to save the
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
665 directory where ``LLVMConfig.cmake`` is found or allows the user to specify the
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
666 directory (e.g. by passing ``-DLLVM_DIR=/usr/lib/cmake/llvm`` to
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
667 the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
668
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
669 This file is available in two different locations.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
670
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
671 * ``<INSTALL_PREFIX>/lib/cmake/llvm/LLVMConfig.cmake`` where
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
672 ``<INSTALL_PREFIX>`` is the install prefix of an installed version of LLVM.
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
673 On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
674
120
1172e4bd9c6f update 4.0.0
mir3636
parents: 100
diff changeset
675 * ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
676 ``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
677 available when building LLVM with CMake.**
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
678
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
679 If LLVM is installed in your operating system's normal installation prefix (e.g.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
680 on Linux this is usually ``/usr/``) ``find_package(LLVM ...)`` will
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
681 automatically find LLVM if it is installed correctly. If LLVM is not installed
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
682 or you wish to build directly against the LLVM build tree you can use
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
683 ``LLVM_DIR`` as previously mentioned.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
684
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
685 The ``LLVMConfig.cmake`` file sets various useful variables. Notable variables
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
686 include
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
687
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
688 ``LLVM_CMAKE_DIR``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
689 The path to the LLVM CMake directory (i.e. the directory containing
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
690 LLVMConfig.cmake).
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
691
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
692 ``LLVM_DEFINITIONS``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
693 A list of preprocessor defines that should be used when building against LLVM.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
694
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
695 ``LLVM_ENABLE_ASSERTIONS``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
696 This is set to ON if LLVM was built with assertions, otherwise OFF.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
697
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
698 ``LLVM_ENABLE_EH``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
699 This is set to ON if LLVM was built with exception handling (EH) enabled,
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
700 otherwise OFF.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
701
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
702 ``LLVM_ENABLE_RTTI``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
703 This is set to ON if LLVM was built with run time type information (RTTI),
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
704 otherwise OFF.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
705
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
706 ``LLVM_INCLUDE_DIRS``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
707 A list of include paths to directories containing LLVM header files.
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
708
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
709 ``LLVM_PACKAGE_VERSION``
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
710 The LLVM version. This string can be used with CMake conditionals, e.g., ``if
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
711 (${LLVM_PACKAGE_VERSION} VERSION_LESS "3.5")``.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
712
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
713 ``LLVM_TOOLS_BINARY_DIR``
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
714 The path to the directory containing the LLVM tools (e.g. ``llvm-as``).
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
715
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
716 Notice that in the above example we link ``simple-tool`` against several LLVM
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
717 libraries. The list of libraries is determined by using the
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
718 ``llvm_map_components_to_libnames()`` CMake function. For a list of available
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
719 components look at the output of running ``llvm-config --components``.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
720
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
721 Note that for LLVM < 3.5 ``llvm_map_components_to_libraries()`` was
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
722 used instead of ``llvm_map_components_to_libnames()``. This is now deprecated
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
723 and will be removed in a future version of LLVM.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
724
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
725 .. _cmake-out-of-source-pass:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
726
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
727 Developing LLVM passes out of source
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
728 ------------------------------------
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
729
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
730 It is possible to develop LLVM passes out of LLVM's source tree (i.e. against an
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
731 installed or built LLVM). An example of a project layout is provided below.
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
732
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
733 .. code-block:: none
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
734
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
735 <project dir>/
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
736 |
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 CMakeLists.txt
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
738 <pass name>/
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
739 |
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
740 CMakeLists.txt
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
741 Pass.cpp
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
742 ...
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
743
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
744 Contents of ``<project dir>/CMakeLists.txt``:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
745
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
746 .. code-block:: cmake
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
747
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
748 find_package(LLVM REQUIRED CONFIG)
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
749
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
750 add_definitions(${LLVM_DEFINITIONS})
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
751 include_directories(${LLVM_INCLUDE_DIRS})
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
752
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
753 add_subdirectory(<pass name>)
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
754
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
755 Contents of ``<project dir>/<pass name>/CMakeLists.txt``:
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
756
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
757 .. code-block:: cmake
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
758
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
759 add_library(LLVMPassname MODULE Pass.cpp)
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
760
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
761 Note if you intend for this pass to be merged into the LLVM source tree at some
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
762 point in the future it might make more sense to use LLVM's internal
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
763 ``add_llvm_loadable_module`` function instead by...
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
764
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
765
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
766 Adding the following to ``<project dir>/CMakeLists.txt`` (after
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
767 ``find_package(LLVM ...)``)
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
768
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
769 .. code-block:: cmake
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
770
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
771 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
772 include(AddLLVM)
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
773
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
774 And then changing ``<project dir>/<pass name>/CMakeLists.txt`` to
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
775
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
776 .. code-block:: cmake
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
777
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
778 add_llvm_loadable_module(LLVMPassname
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
779 Pass.cpp
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
780 )
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
781
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
782 When you are done developing your pass, you may wish to integrate it
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
783 into the LLVM source tree. You can achieve it in two easy steps:
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
784
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
785 #. Copying ``<pass name>`` folder into ``<LLVM root>/lib/Transform`` directory.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
786
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
787 #. Adding ``add_subdirectory(<pass name>)`` line into
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
788 ``<LLVM root>/lib/Transform/CMakeLists.txt``.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
789
77
54457678186b LLVM 3.6
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 33
diff changeset
790 Compiler/Platform-specific topics
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
791 =================================
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
792
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
793 Notes for specific compilers and/or platforms.
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
794
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
795 Microsoft Visual C++
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
796 --------------------
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
797
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
798 **LLVM_COMPILER_JOBS**:STRING
95
afa8332a0e37 LLVM 3.8
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents: 83
diff changeset
799 Specifies the maximum number of parallel compiler jobs to use per project
0
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
800 when building with msbuild or Visual Studio. Only supported for the Visual
95c75e76d11b LLVM 3.4
Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
parents:
diff changeset
801 Studio 2010 CMake generator. 0 means use all processors. Default is 0.