blob: 77e245332cc5afdd46979a25820a1b4fb8f9b98a [file] [log] [blame]
Alexei Frolovdd6fa5c2020-08-11 10:04:01 -07001# 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
Alexei Frolovdd6fa5c2020-08-11 10:04:01 -070015import("//build_overrides/pigweed.gni")
16
17import("$dir_pw_build/target_types.gni")
Wyatt Heplerd517afc2021-02-03 19:40:08 -080018import("$dir_pw_protobuf_compiler/proto.gni")
Alexei Frolovdd6fa5c2020-08-11 10:04:01 -070019import("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 }
Wyatt Heplerd517afc2021-02-03 19:40:08 -080044
45 pw_proto_library("proto") {
Wyatt Hepler752d7d32021-03-02 09:02:23 -080046 strip_prefix = "$dir_pw_third_party_nanopb/generator/proto"
Wyatt Heplerd517afc2021-02-03 19:40:08 -080047 sources = [ "$dir_pw_third_party_nanopb/generator/proto/nanopb.proto" ]
Wyatt Hepler752d7d32021-03-02 09:02:23 -080048 python_module_as_package = "nanopb_pb2"
Wyatt Heplerd517afc2021-02-03 19:40:08 -080049 }
Alexei Frolovdd6fa5c2020-08-11 10:04:01 -070050} else {
51 group("nanopb") {
52 }
53}