third_party.pigweed.src/targets/host/host_common.gni
Alexei Frolov f39cd8b5ba pw_protobuf_compiler: nanopb support
This change adds support for compiling nanopb protobufs using
pw_protobuf_compiler.

The pw_protobuf_langs build variable is renamed to
pw_protobuf_generators as there is no longer a 1:1 mapping of languages.

To compile nanopb, add the "nanopb" generator to pw_protobuf_generators.
The build variable $dir_third_party_nanopb must be set to point to a
local installation of nanopb with GN support:

  https://github.com/frolv/nanopb/tree/gn-build

The host build will run a test which compiles nanopb code if
$dir_third_party_nanopb is set.

Change-Id: I29bf8780644917f35203a538b0bd7e4f3ec40180
2020-04-15 18:19:44 +00:00

38 lines
1.2 KiB
Plaintext

# Copyright 2019 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("$dir_pigweed/pw_vars_default.gni")
declare_args() {
pw_build_host_tools = false
dir_third_party_nanopb = ""
}
# Allow nanopb to be toggled via a build arg on host for easy testing.
if (dir_third_party_nanopb != "") {
pw_protobuf_generators += [ "nanopb" ]
}
# Use logging-based test output on host.
pw_unit_test_main = "$dir_pw_unit_test:logging_main"
# Configure backend for assert facade.
dir_pw_assert_backend = "$dir_pw_assert_basic"
# Configure backend for logging facade.
dir_pw_log_backend = "$dir_pw_log_basic"
# Configure backend for pw_sys_io facade.
dir_pw_sys_io_backend = "$dir_pw_sys_io_stdio"