Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2017 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
| 17 | // Build files need to go in these directories in order for protoc to generate |
| 18 | // files with the correct paths |
| 19 | subdirs = [ |
Andrew Scull | 599e791 | 2017-09-14 14:00:36 +0100 | [diff] [blame] | 20 | "libnos", |
Andrew Scull | 1c021e8 | 2017-09-20 17:04:55 +0100 | [diff] [blame] | 21 | "libnos_datagram", |
| 22 | "libnos_transport", |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame^] | 23 | "nugget/proto", |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 24 | ] |
| 25 | |
| 26 | cc_library_headers { |
| 27 | name: "nos_headers", |
| 28 | defaults: ["nos_shared_cc_defaults"], |
| 29 | export_include_dirs: ["nugget/include"], |
| 30 | } |
| 31 | |
| 32 | cc_defaults { |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame^] | 33 | name: "nos_proto_defaults", |
Andrew Scull | 1a48a03 | 2017-09-26 17:33:22 +0100 | [diff] [blame] | 34 | cflags: [ |
| 35 | "-Wno-extended-offsetof", |
| 36 | "-Wno-unused-parameter", |
| 37 | ], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame^] | 38 | } |
| 39 | |
| 40 | cc_defaults { |
| 41 | name: "nos_app_defaults", |
| 42 | defaults: ["nos_proto_defaults"], |
Andrew Scull | 87a2caf | 2017-10-11 14:07:24 +0100 | [diff] [blame] | 43 | header_libs: ["nos_headers"], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame^] | 44 | shared_libs: [ |
| 45 | "libnos", |
| 46 | "libprotobuf-cpp-full", |
| 47 | ], |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | cc_defaults { |
| 51 | name: "nos_app_service_defaults", |
| 52 | defaults: [ |
| 53 | "nos_app_defaults", |
| 54 | "nos_cc_defaults", |
| 55 | ], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame^] | 56 | shared_libs: ["libnosprotos"], |
| 57 | export_shared_lib_headers: ["libnosprotos"], |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | // Soong doesn't allow adding plugins to a protobuf compilation so we need to |
| 61 | // invoke it directly. If we could pass a plugin, it could use insertion points |
| 62 | // in the .pb.{cc,h} files rather than needing to generate new .client.{cpp,h} |
| 63 | // files for each service. |
| 64 | GEN_SERVICE = "$(location aprotoc) --plugin=protoc-gen-nos-client-cpp=$(location protoc-gen-nos-client-cpp) $(in) -Iexternal/protobuf/src -Iexternal/libnos/nugget/proto" |
| 65 | |
| 66 | GEN_SERVICE_SOURCE = GEN_SERVICE + " --nos-client-cpp_out=source:$(genDir) " |
| 67 | GEN_SERVICE_HEADER = GEN_SERVICE + " --nos-client-cpp_out=header:$(genDir) " |
| 68 | GEN_SERVICE_MOCK = GEN_SERVICE + " --nos-client-cpp_out=mock:$(genDir) " |