Commit Graph

14 Commits

Author SHA1 Message Date
Wyatt Hepler
f6f74f4a79 pw_build: Configurable Python and proto toolchains
- Rename pw_toolchain/dummy to pw_toolchain/default to make its intended
  purpose clear. Keep pw_toolchain/dummy around for compatibility.
- Create a template that generates non-C++ toolchains. This is used for
  non-C++ tasks like Python and proto. GN parses build files differently
  in the default toolchain (all targets are instantiated), so the
  these toolchains can be used when that is not desired.
- Make pw_python_package's toolchain configurable with the
  pw_build_PYTHON_TOOLCHAIN arg.
- Make pw_proto_library's toolchain configurable with the
  pw_protobuf_compiler_TOOLCHAIN arg.

Requires: pigweed-internal:11680
Change-Id: I0aad049c605906b77c58b93a08efc63a648947ee
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40763
Reviewed-by: Armando Montanez <amontanez@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2021-04-29 20:30:56 +00:00
Alexei Frolov
4c0428a0d8 Define Linux clang target as toolchain
This change configures the Linux clang -Og target as a toolchain with
args. To support this, all Pigweed variables from pw_vars_default are
made into build args, defined within their respective modules.

The Linux clang target/toolchain is the only one that currently works.
Pigweed's other targets will be ported in later changes.

Change-Id: I051e29fde7577e41a3184c37031a4e04936404e1
2020-06-16 09:50:59 -07:00
Armando Montanez
fb3d3fba79 Don't declare pigweed variables as globals
Require targets to explicitly import pigweed variable definitions. This
moves out some necessary logic from the BUILDCONFIG.gn file.

Change-Id: If9c9fe5a680cc9d897a0e8a55889873be618ed84
2020-06-16 09:50:59 -07:00
Alexei Frolov
edd2f148be pw_build: Switch to pw_* target types
This change replaces the implicit overrides of the default GN target
types in BUILDCONFIG.gn with explicit pw_* versions. This is done to
allow Pigweed to build within larger GN projects without modifying their
BUILDCONFIG files.

Change-Id: I1d1e41d5e9bde8fe076f7031f3c2b98b9630ff70
2020-06-16 09:50:59 -07:00
Alexei Frolov
844ff0f056 pw_build, pw_toolchain: Add default configs
This CL reworks toolchains to be defined as scopes composing configs and
toolchain args. This allows individual targets to add configs to or
remove configs from the defaults.

Change-Id: I105a231f3e2de35499e1617241f3eeb42ef3248d
2020-06-16 09:50:59 -07:00
Armando Montanez
888370ddd8 Enable -Wshadow
Enable -Wshadow for upstream pigweed to improve compatibility with
projects that decide to enable this flag.

Change-Id: I7e1ce22f245e719ec78118370e591437abe07f0a
2020-05-04 17:10:25 +00:00
Armando Montanez
e97f05936a host: Rename host.gni to target_config.gni
Renames host.gni to target_config.gni so all targets have a
target_config.gni, and it's clear which .gni file to use for target
configuration.

Change-Id: I1bd0442a9dc00201bff46eb776a4a59c1d339a4e
2020-03-19 17:42:26 +00:00
Wyatt Hepler
b9db09f7c2 Build with -g by default
Change-Id: I5331319164bb103bc226d4553d883e27411be5a9
2020-01-28 01:52:44 +00:00
Wyatt Hepler
c542a5d6f7 pw_polyfill: Backports for C++11 and C++14
- The pw_polyfill module brings some C++17 features to C++11 and C++14.
- The module's overrides are added to the GN build to seamlessly
  support older C++ standards.

Change-Id: Icb29772073e681e1ef868561bdde56e629e9c0d9
2020-01-17 09:04:49 -08:00
Wyatt Hepler
2119240da1 GN build: Override built-in targets
- Override built-in targets, which gives more flexibility than
  set_defaults.
- Provide the default C++ in the toolchain, which can be overridden by
  explicitly specifying a config on a target.
- Remove the C++17 default flags from public configs, since it is no
  longer needed.

Change-Id: If211bada971c46cef83909bf15811a4f2c1eb7fd
2020-01-16 11:41:15 -08:00
Armando Montanez
0ef17a7752 Clean up BUILDCONFIG.gn
Starting a new project requires copying Pigweed's BUILDCONFIG.gn as the
foundation for a project's own BUILDCONFIG. This change adds
documentation and some minor changes to the structure of the BUILDCONFIG
to simplify it.

Change-Id: I1354afedea28b1d1e04d1cdb663451f73c6fc3f9
2020-01-09 20:22:39 +00:00
Alexei Frolov
e899dcf4a3 Start build target config files
This change defines the build target system used by Pigweed, where the
build is configured using per-target globals imported from a target .gni
file. A single build arg specifying the path to the target file replaces
the previous args.

A default build variables file is provided in the Pigweed root. This
file defines and documents all of the build variables used by Pigweed.

A top-level targets directory is added to define the targets used by
Pigweed developers. Currently, only a "host" target is added, which
configures the build for a development system based on the host OS.

Change-Id: Ie62b8d41e5789bfe7fffe20462160142c79076c4
2019-11-14 00:34:25 +00:00
Alexei Frolov
02dfcc47d9 Make default toolchain a build argument
This change makes the default toolchain for the build system an
argument so that it can be configured per build target.

Change-Id: I32822be9a6e33376bb1e75b996f79d3451ef9963
2019-11-11 17:59:47 +00:00
Alexei Frolov
1a82c146ff
Initial Pigweed modules
This change adds Pigweed's first few (incomplete) modules: pw_build,
pw_status, and pw_toolchain. The main scaffolding for Pigweed's GN-based
build system is also included, with a root BUILDCONFIG and BUILD.gn file
defining a top-level modules build target.

Change-Id: I09599443d50696343d6c5b85853cb5cee3ce0026
2019-10-31 17:43:53 -07:00