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("//build/test.gni")
16import("../../multimodalinput_mini.gni")
17module_output_path = "multimodalinput/mmi_unit_out"
18
19config("event_injection_config") {
20  visibility = [ ":*" ]
21
22  include_dirs = [
23    "include",
24    "${mmi_path}/util/common/include",
25    "${mmi_path}/interfaces/native/innerkits/common/include",
26  ]
27}
28
29config("event_injection_public_config") {
30  include_dirs = [
31    "include",
32    "${mmi_path}/util/common/include",
33    "${mmi_path}/interfaces/native/innerkits/common/include",
34    "//third_party/FreeBSD/sys/dev/evdev",
35  ]
36}
37
38ohos_source_set("event-injection") {
39  sources = event_injection_sources
40  branch_protector_ret = "pac_ret"
41  sanitize = {
42    cfi = true
43    cfi_cross_dso = true
44    debug = false
45  }
46  configs = [
47    ":event_injection_config",
48    ":event_injection_public_config",
49  ]
50
51  deps = [
52    "${mmi_path}/service/connect_manager:mmi_connect_manager_proxy",
53    "${mmi_path}/service/filter:mmi_event_filter_service",
54    "${mmi_path}/util:libmmi-util",
55  ]
56
57  external_deps = [
58    "cJSON:cjson",
59    "c_utils:utils",
60    "ipc:ipc_single",
61    "libinput:libinput-third-mmi",
62  ]
63
64  part_name = "input"
65  subsystem_name = "multimodalinput"
66}
67
68ohos_unittest("ut-event-injection-out") {
69  module_out_path = module_output_path
70
71  configs = [ "${mmi_path}:coverage_flags" ]
72
73  cflags = [
74    "-Dprivate=public",
75    "-Dprotected=public",
76  ]
77
78  include_dirs = [
79    "${mmi_path}/frameworks/proxy/event_handler",
80    "${mmi_path}/frameworks/proxy/event_handler/include",
81    "${mmi_path}/frameworks/proxy/module_loader",
82    "${mmi_path}/frameworks/proxy/module_loader/include",
83    "${mmi_path}/util/common",
84    "${mmi_path}/util/common/include",
85    "${mmi_path}/util/network",
86    "${mmi_path}/util/network/include",
87    "${mmi_path}/util/socket",
88    "${mmi_path}/util/socket/include",
89    "${mmi_path}/frameworks/proxy/event_handle",
90    "${mmi_path}/frameworks/proxy/event_handle/include",
91    "${mmi_path}/frameworks/proxy/module_loader",
92    "${mmi_path}/frameworks/proxy/module_loader/include",
93    "${mmi_path}/interfaces/native/innerkits/common/include",
94    "${mmi_path}/interfaces/native/innerkits/proxy/include",
95    "${mmi_path}/interfaces/native/innerkits/event/include",
96    "${mmi_path}/service/include",
97    "${mmi_path}/service/device_scalability/include",
98    "${mmi_path}/service/event_dispatch/include",
99    "${mmi_path}/service/event_handler/include",
100    "${mmi_path}/service/event_standard/include",
101    "${mmi_path}/service/libinput_adapter/include",
102    "${mmi_path}/service/message_handle/include",
103    "${mmi_path}/service/module_loader/include",
104    "${mmi_path}/service/window_manager/include",
105    "${mmi_path}/tools/event_inject/include",
106    "${mmi_path}/uinput",
107    "$root_out_dir/diff_libinput_mmi/export_include",
108  ]
109
110  sources = [
111    "test/device_base_test.cpp",
112    "test/get_device_node_test.cpp",
113    "test/get_device_object_test.cpp",
114    "test/injection_tools_help_func_test.cpp",
115    "test/processing_finger_device_test.cpp",
116    "test/processing_game_pad_device_test.cpp",
117    "test/processing_joystick_device_test.cpp",
118    "test/processing_keyboard_device_test.cpp",
119    "test/processing_mouse_device_test.cpp",
120    "test/processing_pad_device_test.cpp",
121    "test/processing_pen_device_test.cpp",
122    "test/processing_touch_screen_device_test.cpp",
123  ]
124
125  deps = [
126    "${mmi_path}/frameworks/proxy:libmmi-client",
127    "${mmi_path}/service:libmmi-server",
128    "${mmi_path}/tools/event_inject:event-injection",
129    "${mmi_path}/util:libmmi-util",
130  ]
131
132  external_deps = [
133    "cJSON:cjson",
134    "c_utils:utils",
135    "googletest:gmock_main",
136    "googletest:gtest_main",
137    "hilog:libhilog",
138    "image_framework:image_native",
139    "ipc:ipc_single",
140    "libinput:libinput-third-mmi",
141  ]
142}
143
144ohos_executable("mmi-event-injection") {
145  sources = [ "src/mmi_event_simulate_main.cpp" ]
146  branch_protector_ret = "pac_ret"
147  sanitize = {
148    cfi = true
149    cfi_cross_dso = true
150    debug = false
151  }
152  configs = [ ":event_injection_public_config" ]
153
154  deps = [
155    "${mmi_path}/tools/event_inject:event-injection",
156    "${mmi_path}/util:libmmi-util",
157  ]
158  external_deps = [
159    "cJSON:cjson",
160    "c_utils:utils",
161    "libinput:libinput-third-mmi",
162  ]
163  install_enable = true
164  part_name = "input"
165  subsystem_name = "multimodalinput"
166}
167