1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/ohos.gni")
15import("//foundation/multimodalinput/input/multimodalinput_mini.gni")
16
17defines = input_default_defines
18
19config("mmi_libudev_public_config") {
20  include_dirs = [ "include" ]
21}
22
23config("mmi_libudev_config") {
24  include_dirs = [ "${mmi_path}/util/common/include" ]
25}
26
27ohos_static_library("mmi_libudev") {
28  public_configs = [ ":mmi_libudev_public_config" ]
29  configs = [ ":mmi_libudev_config" ]
30
31  sources = [ "src/udev_device.cpp" ]
32  branch_protector_ret = "pac_ret"
33  sanitize = {
34    cfi = true
35    cfi_cross_dso = true
36    debug = false
37  }
38  external_deps = [ "hilog:libhilog" ]
39
40  defines += [ "MMI_DISABLE_LOG_TRACE" ]
41  part_name = "input"
42  subsystem_name = "multimodalinput"
43}
44
45import("//build/test.gni")
46output_path = "multimodalinput/mmi_unit_out"
47
48group("test") {
49  testonly = true
50  deps = [ ":libudev-test" ]
51}
52
53ohos_unittest("libudev-test") {
54  module_out_path = output_path
55  include_dirs = [
56    "${mmi_path}/util/common/include",
57    "//third_party/libevdev",
58  ]
59
60  configs = [
61    ":mmi_libudev_config",
62    ":mmi_libudev_public_config",
63  ]
64
65  sources = [
66    "src/udev_device.cpp",
67    "test/custom_udev_test.cpp",
68  ]
69
70  external_deps = [ "hilog:libhilog" ]
71
72  deps = [
73    "//third_party/googletest:gmock_main",
74    "//third_party/libevdev",
75  ]
76
77  defines += [ "MMI_DISABLE_LOG_TRACE" ]
78}
79
80ohos_unittest("e2e-libudev-test") {
81  module_out_path = output_path
82  include_dirs = [ "//third_party/libevdev" ]
83
84  sources = [ "test/e2e_udev_test.cpp" ]
85
86  deps = [
87    "${mmi_path}/frameworks/proxy:libmmi-client",
88    "//third_party/googletest:gmock_main",
89    "//third_party/libevdev",
90  ]
91}
92