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 | |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 17 | cc_library_headers { |
| 18 | name: "nos_headers", |
Andrew Scull | 56ffcc4 | 2018-01-17 11:58:38 +0000 | [diff] [blame] | 19 | defaults: ["nos_cc_host_supported_defaults"], |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 20 | export_include_dirs: ["nugget/include"], |
| 21 | } |
| 22 | |
| 23 | cc_defaults { |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame] | 24 | name: "nos_proto_defaults", |
Andrew Scull | 1a48a03 | 2017-09-26 17:33:22 +0100 | [diff] [blame] | 25 | cflags: [ |
Andrew Scull | 1a48a03 | 2017-09-26 17:33:22 +0100 | [diff] [blame] | 26 | "-Wno-unused-parameter", |
| 27 | ], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | cc_defaults { |
| 31 | name: "nos_app_defaults", |
| 32 | defaults: ["nos_proto_defaults"], |
Andrew Scull | 87a2caf | 2017-10-11 14:07:24 +0100 | [diff] [blame] | 33 | header_libs: ["nos_headers"], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame] | 34 | shared_libs: [ |
| 35 | "libnos", |
| 36 | "libprotobuf-cpp-full", |
| 37 | ], |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | cc_defaults { |
| 41 | name: "nos_app_service_defaults", |
| 42 | defaults: [ |
| 43 | "nos_app_defaults", |
Andrew Scull | 56ffcc4 | 2018-01-17 11:58:38 +0000 | [diff] [blame] | 44 | "nos_cc_defaults", |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 45 | ], |
Andrew Scull | af221e3 | 2017-10-12 13:00:53 +0100 | [diff] [blame] | 46 | shared_libs: ["libnosprotos"], |
| 47 | export_shared_lib_headers: ["libnosprotos"], |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | // Soong doesn't allow adding plugins to a protobuf compilation so we need to |
| 51 | // invoke it directly. If we could pass a plugin, it could use insertion points |
| 52 | // in the .pb.{cc,h} files rather than needing to generate new .client.{cpp,h} |
| 53 | // files for each service. |
Garret Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 54 | GEN_SERVICE = "$(location aprotoc) --plugin=protoc-gen-nos-client-cpp=$(location protoc-gen-nos-client-cpp) $(in) -Iexternal/protobuf/src -Iexternal/nos/host/generic/nugget/proto" |
Andrew Scull | 1c02d64 | 2017-09-11 17:54:56 +0100 | [diff] [blame] | 55 | |
| 56 | GEN_SERVICE_SOURCE = GEN_SERVICE + " --nos-client-cpp_out=source:$(genDir) " |
| 57 | GEN_SERVICE_HEADER = GEN_SERVICE + " --nos-client-cpp_out=header:$(genDir) " |
| 58 | GEN_SERVICE_MOCK = GEN_SERVICE + " --nos-client-cpp_out=mock:$(genDir) " |
Andrew Scull | d9b1de2 | 2018-03-26 14:18:35 +0100 | [diff] [blame] | 59 | |
| 60 | // A special target to be statically linkeed into recovery which is a system |
| 61 | // (not vendor) component. |
| 62 | cc_library_static { |
| 63 | name: "libnos_for_recovery", |
| 64 | cflags: [ |
| 65 | "-Wall", |
| 66 | "-Wextra", |
| 67 | "-Werror", |
| 68 | "-Wno-zero-length-array", |
| 69 | ], |
| 70 | export_include_dirs: [ |
| 71 | "nugget/include", |
| 72 | "libnos/include", |
| 73 | "libnos_datagram/include", |
| 74 | "libnos_transport/include", |
| 75 | ], |
| 76 | srcs: [ |
| 77 | "libnos/debug.cpp", |
| 78 | "libnos_transport/transport.c", |
Andrew Scull | 3fc6cfe | 2018-02-22 11:09:51 -0800 | [diff] [blame] | 79 | "libnos_transport/crc16.c", |
| 80 | ], |
| 81 | static_libs: [ |
| 82 | "libbase", |
Andrew Scull | d9b1de2 | 2018-03-26 14:18:35 +0100 | [diff] [blame] | 83 | ], |
| 84 | } |
Garret Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 85 | |
josephjang | 64a6c36 | 2020-09-23 11:02:16 +0800 | [diff] [blame] | 86 | // A special target to be statically linkeed into fastboot hal. |
| 87 | cc_library_static { |
| 88 | name: "libnos_for_fastboot", |
| 89 | recovery: true, |
| 90 | cflags: [ |
| 91 | "-Wall", |
| 92 | "-Wextra", |
| 93 | "-Werror", |
| 94 | "-Wno-zero-length-array", |
| 95 | ], |
| 96 | export_include_dirs: [ |
| 97 | "nugget/include", |
| 98 | "libnos/include", |
| 99 | "libnos_datagram/include", |
| 100 | "libnos_transport/include", |
| 101 | ], |
| 102 | srcs: [ |
| 103 | "libnos/debug.cpp", |
| 104 | "libnos_transport/transport.c", |
| 105 | "libnos_transport/crc16.c", |
| 106 | ], |
| 107 | static_libs: [ |
| 108 | "libbase", |
| 109 | ], |
| 110 | } |
| 111 | |
Garret Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 112 | // A special target to be statically linkeed into recovery which is a system |
| 113 | // (not vendor) component. |
| 114 | cc_library_static { |
| 115 | name: "libnos_citadel_for_recovery", |
| 116 | cflags: [ |
| 117 | "-Wall", |
| 118 | "-Wextra", |
| 119 | "-Werror", |
| 120 | ], |
| 121 | srcs: [ |
| 122 | ":libnos_client", |
| 123 | "libnos_datagram/citadel.c", |
| 124 | ], |
| 125 | static_libs: [ |
| 126 | "libnos_for_recovery", |
| 127 | ], |
| 128 | } |
| 129 | |
josephjang | 64a6c36 | 2020-09-23 11:02:16 +0800 | [diff] [blame] | 130 | // A special target to be statically linkeed into fastboot hal. |
| 131 | cc_library_static { |
| 132 | name: "libnos_citadel_for_fastboot", |
| 133 | recovery: true, |
| 134 | cflags: [ |
| 135 | "-Wall", |
| 136 | "-Wextra", |
| 137 | "-Werror", |
| 138 | ], |
| 139 | srcs: [ |
| 140 | ":libnos_client", |
| 141 | "libnos_datagram/citadel.c", |
| 142 | ], |
| 143 | static_libs: [ |
| 144 | "libnos_for_fastboot", |
| 145 | ], |
| 146 | } |
| 147 | |
Garret Kelly | 844f4e1 | 2019-09-20 16:13:24 -0400 | [diff] [blame] | 148 | // Language and vendor related defaults |
| 149 | cc_defaults { |
| 150 | name: "nos_cc_defaults", |
| 151 | clang: true, |
| 152 | cflags: [ |
| 153 | "-pedantic", |
| 154 | "-Wall", |
| 155 | "-Wextra", |
| 156 | "-Werror", |
| 157 | "-Wno-zero-length-array", |
| 158 | ], |
| 159 | conlyflags: [ |
| 160 | "-std=c11", |
| 161 | ], |
| 162 | vendor: true, |
| 163 | owner: "google", |
| 164 | } |
| 165 | |
| 166 | // Defaults for components under the hw subdirectory |
| 167 | cc_defaults { |
| 168 | name: "nos_cc_hw_defaults", |
| 169 | defaults: ["nos_cc_defaults"], |
| 170 | relative_install_path: "hw", |
| 171 | } |
| 172 | |
| 173 | // Defaults for components shared between the host and device |
| 174 | cc_defaults { |
| 175 | name: "nos_cc_host_supported_defaults", |
| 176 | defaults: ["nos_cc_defaults"], |
| 177 | host_supported: true, |
| 178 | } |
| 179 | |
| 180 | cc_library { |
| 181 | name: "libnos_client_citadel", |
| 182 | srcs: [":libnos_client"], |
| 183 | defaults: [ |
| 184 | "libnos_client_defaults", |
| 185 | "nos_cc_defaults", |
| 186 | ], |
| 187 | shared_libs: ["libnos_datagram_citadel"], |
| 188 | } |