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