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