blob: acea1c5524fb62d85b3b2e40aef50297b1cb7aef [file] [log] [blame]
Rob Mohr84f234e2019-12-06 09:16:50 -08001.. _chapter-build:
2
3.. default-domain:: cpp
4
5.. highlight:: sh
6
7--------
8pw_build
9--------
10The build module contains the configuration necessary to build Pigweed using
11either `GN`_/`Ninja`_ or `Bazel`_.
12
13.. _GN: https://gn.googlesource.com/gn/
14.. _Ninja: https://ninja-build.org/
15.. _Bazel: https://bazel.build/
16
17GN / Ninja
18==========
19The common configuration for GN for all modules is in the ``BUILD.gn`` file.
20It contains ``config`` declarations referenced by ``BUILD.gn`` files in other
21modules.
22
23The ``pw_executable.gni`` file contains a wrapper to build a target for the
24globally-defined target type, and ``python_script.gni`` makes it easy to run
25Python scripts as part of build rules.
26
27Bazel
28=====
29The common configuration for Bazel for all modules is in the ``pigweed.bzl``
30file. The built-in Bazel rules ``cc_binary``, ``cc_library``, and ``cc_test``
31are wrapped with ``pw_cc_binary``, ``pw_cc_library``, and ``pw_cc_test``.
32These wrappers add parameters to calls to the compiler and linker.
33
34The ``BUILD`` file is merely a placeholder and currently does nothing.