Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 1 | // Copyright (C) 2013 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://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, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | // libinput is partially built for the host (used by build time keymap validation tool) |
| 16 | |
Bob Badour | 3306e49 | 2021-02-25 15:35:37 -0800 | [diff] [blame] | 17 | package { |
| 18 | // See: http://go/android-license-faq |
| 19 | // A large-scale-change added 'default_applicable_licenses' to import |
| 20 | // all of the 'license_kinds' from "frameworks_native_license" |
| 21 | // to get the below license kinds: |
| 22 | // SPDX-license-identifier-Apache-2.0 |
| 23 | default_applicable_licenses: ["frameworks_native_license"], |
| 24 | } |
| 25 | |
Siarhei Vishniakou | 7062295 | 2020-07-30 11:17:23 -0500 | [diff] [blame] | 26 | filegroup { |
| 27 | name: "inputconstants_aidl", |
| 28 | srcs: [ |
Siarhei Vishniakou | ae6229e | 2019-12-30 16:23:19 -0800 | [diff] [blame] | 29 | "android/os/IInputConstants.aidl", |
| 30 | "android/os/InputEventInjectionResult.aidl", |
| 31 | "android/os/InputEventInjectionSync.aidl", |
Prabir Pradhan | 51e7db0 | 2022-02-07 06:02:57 -0800 | [diff] [blame] | 32 | "android/os/InputConfig.aidl", |
Siarhei Vishniakou | 7062295 | 2020-07-30 11:17:23 -0500 | [diff] [blame] | 33 | ], |
| 34 | } |
| 35 | |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 36 | aidl_interface { |
| 37 | name: "inputconstants", |
| 38 | host_supported: true, |
| 39 | vendor_available: true, |
| 40 | unstable: true, |
| 41 | srcs: [ |
| 42 | ":inputconstants_aidl", |
| 43 | ], |
| 44 | |
| 45 | backend: { |
| 46 | rust: { |
| 47 | enabled: true, |
| 48 | }, |
| 49 | }, |
| 50 | } |
| 51 | |
| 52 | rust_bindgen { |
| 53 | name: "libinput_bindgen", |
| 54 | host_supported: true, |
| 55 | crate_name: "input_bindgen", |
| 56 | visibility: ["//frameworks/native/services/inputflinger"], |
| 57 | wrapper_src: "InputWrapper.hpp", |
| 58 | |
| 59 | include_dirs: [ |
| 60 | "frameworks/native/include", |
| 61 | ], |
| 62 | |
| 63 | source_stem: "bindings", |
| 64 | |
| 65 | bindgen_flags: [ |
| 66 | "--verbose", |
| 67 | "--allowlist-var=AMOTION_EVENT_FLAG_CANCELED", |
| 68 | "--allowlist-var=AMOTION_EVENT_ACTION_CANCEL", |
| 69 | "--allowlist-var=AMOTION_EVENT_ACTION_UP", |
| 70 | "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_DOWN", |
| 71 | "--allowlist-var=AMOTION_EVENT_ACTION_DOWN", |
| 72 | "--allowlist-var=AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT", |
| 73 | "--allowlist-var=MAX_POINTER_ID", |
| 74 | ], |
| 75 | |
| 76 | static_libs: [ |
| 77 | "inputconstants-cpp", |
| 78 | "libui-types", |
| 79 | ], |
| 80 | shared_libs: ["libc++"], |
| 81 | header_libs: [ |
| 82 | "native_headers", |
| 83 | "jni_headers", |
| 84 | "flatbuffer_headers", |
| 85 | ], |
| 86 | } |
| 87 | |
| 88 | // Contains methods to help access C++ code from rust |
| 89 | cc_library_static { |
| 90 | name: "libinput_from_rust_to_cpp", |
| 91 | cpp_std: "c++20", |
| 92 | host_supported: true, |
| 93 | cflags: [ |
| 94 | "-Wall", |
| 95 | "-Wextra", |
| 96 | "-Werror", |
| 97 | ], |
| 98 | srcs: [ |
| 99 | "FromRustToCpp.cpp", |
| 100 | ], |
| 101 | |
| 102 | generated_headers: [ |
| 103 | "cxx-bridge-header", |
| 104 | ], |
| 105 | generated_sources: ["libinput_cxx_bridge_code"], |
| 106 | |
| 107 | shared_libs: [ |
| 108 | "libbase", |
| 109 | ], |
| 110 | } |
| 111 | |
| 112 | genrule { |
| 113 | name: "libinput_cxx_bridge_code", |
| 114 | tools: ["cxxbridge"], |
| 115 | cmd: "$(location cxxbridge) $(in) >> $(out)", |
| 116 | srcs: ["input_verifier.rs"], |
| 117 | out: ["inputverifier_generated.cpp"], |
| 118 | } |
| 119 | |
| 120 | genrule { |
| 121 | name: "libinput_cxx_bridge_header", |
| 122 | tools: ["cxxbridge"], |
| 123 | cmd: "$(location cxxbridge) $(in) --header >> $(out)", |
| 124 | srcs: ["input_verifier.rs"], |
| 125 | out: ["input_verifier.rs.h"], |
| 126 | } |
| 127 | |
| 128 | rust_defaults { |
| 129 | name: "libinput_rust_defaults", |
| 130 | srcs: ["input_verifier.rs"], |
| 131 | host_supported: true, |
| 132 | rustlibs: [ |
| 133 | "libbitflags", |
| 134 | "libcxx", |
| 135 | "libinput_bindgen", |
| 136 | "liblogger", |
| 137 | "liblog_rust", |
| 138 | "inputconstants-rust", |
| 139 | ], |
| 140 | |
| 141 | shared_libs: [ |
| 142 | "libbase", |
| 143 | "liblog", |
| 144 | ], |
| 145 | } |
| 146 | |
| 147 | rust_ffi_static { |
| 148 | name: "libinput_rust", |
| 149 | crate_name: "input", |
| 150 | defaults: ["libinput_rust_defaults"], |
| 151 | } |
| 152 | |
| 153 | rust_test { |
| 154 | name: "libinput_rust_test", |
| 155 | defaults: ["libinput_rust_defaults"], |
| 156 | whole_static_libs: [ |
| 157 | "libinput_from_rust_to_cpp", |
| 158 | ], |
| 159 | test_options: { |
| 160 | unit_test: true, |
| 161 | }, |
| 162 | test_suites: ["device_tests"], |
| 163 | sanitize: { |
| 164 | hwaddress: true, |
| 165 | }, |
| 166 | } |
| 167 | |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 168 | cc_library { |
| 169 | name: "libinput", |
Siarhei Vishniakou | bb19287 | 2021-12-09 17:14:49 -0800 | [diff] [blame] | 170 | cpp_std: "c++20", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 171 | host_supported: true, |
Frank Barchard | 9e94788 | 2017-03-06 11:17:52 -0800 | [diff] [blame] | 172 | cflags: [ |
| 173 | "-Wall", |
| 174 | "-Wextra", |
| 175 | "-Werror", |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 176 | "-Wno-unused-parameter", |
Frank Barchard | 9e94788 | 2017-03-06 11:17:52 -0800 | [diff] [blame] | 177 | ], |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 178 | srcs: [ |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 179 | "FromRustToCpp.cpp", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 180 | "Input.cpp", |
| 181 | "InputDevice.cpp", |
Chris Ye | 4958d06 | 2020-08-20 13:21:10 -0700 | [diff] [blame] | 182 | "InputEventLabels.cpp", |
Siarhei Vishniakou | 92c8fd5 | 2023-01-29 14:57:43 -0800 | [diff] [blame] | 183 | "InputVerifier.cpp", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 184 | "Keyboard.cpp", |
| 185 | "KeyCharacterMap.cpp", |
| 186 | "KeyLayoutMap.cpp", |
Siarhei Vishniakou | 39147ce | 2022-11-15 12:13:04 -0800 | [diff] [blame] | 187 | "MotionPredictor.cpp", |
Siarhei Vishniakou | 814ace3 | 2022-03-04 15:12:16 -0800 | [diff] [blame] | 188 | "PrintTools.cpp", |
Siarhei Vishniakou | 32f36ae | 2020-09-02 20:17:10 -0700 | [diff] [blame] | 189 | "PropertyMap.cpp", |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 190 | "TfLiteMotionPredictor.cpp", |
Siarhei Vishniakou | 26cf29d | 2019-02-15 16:48:38 -0600 | [diff] [blame] | 191 | "TouchVideoFrame.cpp", |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 192 | "VelocityControl.cpp", |
| 193 | "VelocityTracker.cpp", |
Zixuan Qu | dd0635d | 2023-02-06 04:52:38 +0000 | [diff] [blame] | 194 | "VirtualInputDevice.cpp", |
Siarhei Vishniakou | 5ac663d | 2019-02-15 17:15:56 -0600 | [diff] [blame] | 195 | "VirtualKeyMap.cpp", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 196 | ], |
| 197 | |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 198 | header_libs: [ |
| 199 | "flatbuffer_headers", |
| 200 | "jni_headers", |
| 201 | "tensorflow_headers", |
| 202 | ], |
Orion Hodson | e32877a | 2020-04-22 11:10:13 +0100 | [diff] [blame] | 203 | export_header_lib_headers: ["jni_headers"], |
| 204 | |
Prabir Pradhan | 1e63fc2 | 2023-02-23 19:03:03 +0000 | [diff] [blame] | 205 | generated_headers: [ |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 206 | "cxx-bridge-header", |
| 207 | "libinput_cxx_bridge_header", |
Prabir Pradhan | 1e63fc2 | 2023-02-23 19:03:03 +0000 | [diff] [blame] | 208 | "toolbox_input_labels", |
| 209 | ], |
| 210 | |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 211 | generated_sources: ["libinput_cxx_bridge_code"], |
| 212 | |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 213 | shared_libs: [ |
Siarhei Vishniakou | ec2727e | 2017-07-06 10:22:03 -0700 | [diff] [blame] | 214 | "libbase", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 215 | "libcutils", |
Siarhei Vishniakou | 39147ce | 2022-11-15 12:13:04 -0800 | [diff] [blame] | 216 | "liblog", |
| 217 | "libPlatformProperties", |
Philip Quinn | f84fa49 | 2023-06-26 14:15:15 -0700 | [diff] [blame] | 218 | "libtinyxml2", |
Siarhei Vishniakou | a9fd82c | 2022-05-18 09:42:52 -0700 | [diff] [blame] | 219 | "libvintf", |
Philip Quinn | da6a448 | 2023-02-07 10:09:57 -0800 | [diff] [blame] | 220 | ], |
| 221 | |
| 222 | ldflags: [ |
| 223 | "-Wl,--exclude-libs=libtflite_static.a", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 224 | ], |
| 225 | |
Siarhei Vishniakou | dd88248 | 2023-04-28 21:13:26 +0000 | [diff] [blame] | 226 | sanitize: { |
| 227 | undefined: true, |
| 228 | all_undefined: true, |
| 229 | misc_undefined: ["integer"], |
| 230 | }, |
| 231 | |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 232 | static_libs: [ |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 233 | "inputconstants-cpp", |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 234 | "libui-types", |
Philip Quinn | da6a448 | 2023-02-07 10:09:57 -0800 | [diff] [blame] | 235 | "libtflite_static", |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 236 | ], |
| 237 | |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 238 | whole_static_libs: [ |
| 239 | "libinput_rust", |
| 240 | ], |
| 241 | |
chaviw | fd9c1ed | 2020-07-01 10:57:59 -0700 | [diff] [blame] | 242 | export_static_lib_headers: [ |
| 243 | "libui-types", |
| 244 | ], |
| 245 | |
Siarhei Vishniakou | 5c02a71 | 2023-05-15 15:45:02 -0700 | [diff] [blame] | 246 | export_generated_headers: [ |
| 247 | "cxx-bridge-header", |
| 248 | "libinput_cxx_bridge_header", |
| 249 | ], |
| 250 | |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 251 | target: { |
| 252 | android: { |
| 253 | srcs: [ |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 254 | "InputTransport.cpp", |
Siarhei Vishniakou | 7766c03 | 2021-03-02 20:32:20 +0000 | [diff] [blame] | 255 | "android/os/IInputFlinger.aidl", |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 256 | ], |
| 257 | |
Bernardo Rufino | ea97d18 | 2020-08-19 14:43:14 +0100 | [diff] [blame] | 258 | export_shared_lib_headers: ["libbinder"], |
| 259 | |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 260 | shared_libs: [ |
| 261 | "libutils", |
| 262 | "libbinder", |
| 263 | ], |
Evgenii Stepanov | de98297 | 2017-01-31 16:37:44 -0800 | [diff] [blame] | 264 | |
Colin Cross | 433cfd9 | 2021-07-16 22:29:59 -0700 | [diff] [blame] | 265 | static_libs: [ |
| 266 | "libgui_window_info_static", |
| 267 | ], |
| 268 | |
| 269 | export_static_lib_headers: [ |
| 270 | "libgui_window_info_static", |
| 271 | ], |
| 272 | |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 273 | required: [ |
| 274 | "motion_predictor_model_prebuilt", |
Philip Quinn | f84fa49 | 2023-06-26 14:15:15 -0700 | [diff] [blame] | 275 | "motion_predictor_model_config", |
Philip Quinn | 8f953ab | 2022-12-06 15:37:07 -0800 | [diff] [blame] | 276 | ], |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 277 | }, |
| 278 | host: { |
| 279 | shared: { |
| 280 | enabled: false, |
| 281 | }, |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 282 | include_dirs: [ |
Zixuan Qu | dd0635d | 2023-02-06 04:52:38 +0000 | [diff] [blame] | 283 | "bionic/libc/kernel/android/uapi/", |
| 284 | "bionic/libc/kernel/uapi", |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 285 | "frameworks/native/libs/arect/include", |
| 286 | ], |
| 287 | }, |
Colin Cross | 4a4a85f | 2022-03-08 18:25:24 -0800 | [diff] [blame] | 288 | host_linux: { |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 289 | srcs: [ |
| 290 | "InputTransport.cpp", |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 291 | ], |
| 292 | static_libs: [ |
Colin Cross | 433cfd9 | 2021-07-16 22:29:59 -0700 | [diff] [blame] | 293 | "libgui_window_info_static", |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 294 | ], |
| 295 | shared_libs: [ |
| 296 | "libbinder", |
| 297 | ], |
Colin Cross | 433cfd9 | 2021-07-16 22:29:59 -0700 | [diff] [blame] | 298 | |
| 299 | export_static_lib_headers: [ |
| 300 | "libgui_window_info_static", |
| 301 | ], |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 302 | }, |
| 303 | }, |
Chris Ye | 0783e99 | 2020-06-02 21:34:49 -0700 | [diff] [blame] | 304 | |
| 305 | aidl: { |
| 306 | local_include_dirs: ["."], |
Brett Chabot | 5820852 | 2020-09-09 13:55:24 -0700 | [diff] [blame] | 307 | export_aidl_headers: true, |
chaviw | 3277faf | 2021-05-19 16:45:23 -0500 | [diff] [blame] | 308 | include_dirs: [ |
| 309 | "frameworks/native/libs/gui", |
| 310 | ], |
Chris Ye | 0783e99 | 2020-06-02 21:34:49 -0700 | [diff] [blame] | 311 | }, |
Dan Willemsen | 59e086f | 2016-07-25 17:13:45 -0700 | [diff] [blame] | 312 | } |
Dan Willemsen | c7dd2b9 | 2016-08-25 17:05:22 -0700 | [diff] [blame] | 313 | |
Siarhei Vishniakou | 32f36ae | 2020-09-02 20:17:10 -0700 | [diff] [blame] | 314 | cc_defaults { |
| 315 | name: "libinput_fuzz_defaults", |
Harry Cutts | 2b67ff1 | 2023-03-13 11:32:06 +0000 | [diff] [blame] | 316 | cpp_std: "c++20", |
Siarhei Vishniakou | 32f36ae | 2020-09-02 20:17:10 -0700 | [diff] [blame] | 317 | host_supported: true, |
| 318 | shared_libs: [ |
| 319 | "libutils", |
| 320 | "libbase", |
| 321 | "liblog", |
| 322 | ], |
| 323 | } |
| 324 | |
| 325 | cc_fuzz { |
| 326 | name: "libinput_fuzz_propertymap", |
| 327 | defaults: ["libinput_fuzz_defaults"], |
| 328 | srcs: [ |
| 329 | "PropertyMap.cpp", |
| 330 | "PropertyMap_fuzz.cpp", |
| 331 | ], |
| 332 | } |
| 333 | |
Dan Willemsen | c7dd2b9 | 2016-08-25 17:05:22 -0700 | [diff] [blame] | 334 | subdirs = ["tests"] |