1# Copyright 2020 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/target_types.gni") 18import("$dir_pw_protobuf_compiler/proto.gni") 19import("nanopb.gni") 20 21# This file defines a GN source_set for an external installation of nanopb. 22# To use, checkout the nanopb source into a directory, then set the build arg 23# dir_pw_third_party_nanopb to point to that directory. The nanopb library 24# will be available in GN at "$dir_pw_third_party/nanopb". 25if (dir_pw_third_party_nanopb != "") { 26 config("includes") { 27 include_dirs = [ dir_pw_third_party_nanopb ] 28 } 29 30 pw_source_set("nanopb") { 31 public_configs = [ ":includes" ] 32 public = [ 33 "$dir_pw_third_party_nanopb/pb.h", 34 "$dir_pw_third_party_nanopb/pb_common.h", 35 "$dir_pw_third_party_nanopb/pb_decode.h", 36 "$dir_pw_third_party_nanopb/pb_encode.h", 37 ] 38 sources = [ 39 "$dir_pw_third_party_nanopb/pb_common.c", 40 "$dir_pw_third_party_nanopb/pb_decode.c", 41 "$dir_pw_third_party_nanopb/pb_encode.c", 42 ] 43 } 44 45 pw_proto_library("proto") { 46 strip_prefix = "$dir_pw_third_party_nanopb/generator/proto" 47 sources = [ "$dir_pw_third_party_nanopb/generator/proto/nanopb.proto" ] 48 python_module_as_package = "nanopb_pb2" 49 } 50} else { 51 group("nanopb") { 52 } 53} 54