Skip to content

Commit d1300dc

Browse files
1 parent cc97fc4 commit d1300dc

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

from_source.html

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ <h1 id="supported-configurations">Supported Configurations</h1>
259259

260260
<h1 id="building-with-cmake">Building with CMake</h1>
261261

262+
<p>Drake’s build rules are defined using Bazel <code class="language-plaintext highlighter-rouge">BUILD</code> files, but we provide a
263+
CMake wrapper for installing Drake. While this compiles and installs Drake by
264+
invoking Bazel under the hood, it does so according to CMake conventions
265+
and using the options provided via CMake.</p>
266+
262267
<p>For sample projects that show how to import Drake as a CMake external project
263268
(either by building Drake from source, or by downloading a pre-compiled Drake
264269
release) please see our gallery of
@@ -282,10 +287,35 @@ <h1 id="building-with-cmake">Building with CMake</h1>
282287
<p>To change the build options, you can run one of the standard CMake GUIs (e.g.,
283288
<code class="language-plaintext highlighter-rouge">ccmake</code> or <code class="language-plaintext highlighter-rouge">cmake-gui</code>) or specify command-line options with <code class="language-plaintext highlighter-rouge">-D</code> to <code class="language-plaintext highlighter-rouge">cmake</code>.</p>
284289

290+
<p>Important note: when compiling Drake with Clang 17 or newer on Linux, you must
291+
add <code class="language-plaintext highlighter-rouge">-fno-assume-unique-vtables</code> to your project’s <code class="language-plaintext highlighter-rouge">CMAKE_CXX_FLAGS</code>, or else
292+
Drake’s use of run-time type information and dynamic casts will not work correctly.</p>
293+
294+
<h2 id="native-cmake-options-supported-by-drake">Native CMake Options Supported by Drake</h2>
295+
296+
<p>A selection of
297+
<a href="https://cmake.org/cmake/help/latest/manual/cmake-variables.7.html">CMake variables</a>
298+
can be specified by the user to be parsed by Drake’s CMake and passed to the
299+
Bazel build.</p>
300+
301+
<ul>
302+
<li><a href="https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html"><code class="language-plaintext highlighter-rouge">CMAKE_BUILD_TYPE</code></a></li>
303+
<li><a href="https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER.html"><code class="language-plaintext highlighter-rouge">CMAKE_(C|CXX)_COMPILER</code></a></li>
304+
<li><a href="https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html"><code class="language-plaintext highlighter-rouge">CMAKE_INSTALL_PREFIX</code></a></li>
305+
</ul>
306+
307+
<p>Building and installing Drake also requires a working installation of Python.
308+
When <code class="language-plaintext highlighter-rouge">Python_EXECUTABLE</code> is specified, it uses the given path to the Python
309+
interpreter. Otherwise, it uses <code class="language-plaintext highlighter-rouge">find_package(Python)</code> to find the Python
310+
version supported by Drake on the host platform (falling back to finding any
311+
Python version at all if needed). See
312+
<a href="https://cmake.org/cmake/help/latest/module/FindPython.html"><code class="language-plaintext highlighter-rouge">FindPython</code></a>
313+
for further details.</p>
314+
285315
<h2 id="drake-specific-cmake-options">Drake-specific CMake Options</h2>
286316

287-
<p>These options can be set using <code class="language-plaintext highlighter-rouge">-DFOO=bar</code> on the CMake command line, or in one
288-
of the CMake GUIs.</p>
317+
<p>Drake also defines a number of CMake options to control different facets of
318+
the build.</p>
289319

290320
<p>Adjusting open-source dependencies:</p>
291321

@@ -379,9 +409,17 @@ <h2 id="drake-specific-cmake-options">Drake-specific CMake Options</h2>
379409
</li>
380410
</ul>
381411

382-
<p>Important note: when compiling Drake with Clang 17 or newer on Linux, you must
383-
add <code class="language-plaintext highlighter-rouge">-fno-assume-unique-vtables</code> to your project’s <code class="language-plaintext highlighter-rouge">CXXFLAGS</code>, or else Drake’s
384-
use of run-time type information and dynamic casts will not work correctly.</p>
412+
<p>Adjusting installation methods (advanced):</p>
413+
414+
<ul>
415+
<li><code class="language-plaintext highlighter-rouge">INSTALL_NAME_TOOL</code>. When specified, uses the path to the
416+
<code class="language-plaintext highlighter-rouge">install_name_tool</code> program.
417+
<ul>
418+
<li>This option is only available on macOS.</li>
419+
</ul>
420+
</li>
421+
<li><code class="language-plaintext highlighter-rouge">INSTALL_STRIP_TOOL</code>. When specified, uses the path to the <code class="language-plaintext highlighter-rouge">strip</code> program.</li>
422+
</ul>
385423

386424
<h2 id="cmake-caveats">CMake Caveats</h2>
387425

0 commit comments

Comments
 (0)