1# Copyright (C) 2023 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/graphic/graphic_2d/rosen/modules/platform/config.gni")
16
17# ace_skia {{{
18group("ace_skia") {
19  if (is_arkui_x) {
20    public_deps = [ "//third_party/skia:skia_$platform" ]
21  } else {
22    public_external_deps = [ "skia:skia_canvaskit" ]
23  }
24}
25
26# ace_skia }}}
27
28# eventhandler {{{
29group("eventhandler") {
30  if (platform == "ohos") {
31    public_external_deps = [ "eventhandler:libeventhandler" ]
32  } else if (cross_platform) {
33    public_deps = [ "$appframework_root/ability/ability_runtime/cross_platform/frameworks/native/base/event_handler:cross_platform_event_handler" ]
34  } else {
35    public_deps = [ ":impl_eventhandler" ]
36  }
37}
38
39config("eventhandler_config") {
40  include_dirs = [ "eventhandler" ]
41}
42
43ohos_source_set("impl_eventhandler") {
44  public_configs = [ ":eventhandler_config" ]
45  sources = [
46    "eventhandler_impl/epoll_io_waiter_mingw.cpp",
47    "eventhandler_impl/event_handler.cpp",
48    "eventhandler_impl/event_queue.cpp",
49    "eventhandler_impl/event_runner.cpp",
50    "eventhandler_impl/file_descriptor_listener.cpp",
51    "eventhandler_impl/inner_event.cpp",
52    "eventhandler_impl/native_implement_eventhandler.cpp",
53    "eventhandler_impl/none_io_waiter.cpp",
54  ]
55  defines = [ "LOG_DOMAIN=0xD001200" ]
56  cflags = [ "-std=c++17" ]
57  deps = [ ":utils" ]
58
59  external_deps = [
60    "hilog:libhilog",
61    "libuv:uv",
62  ]
63
64  if (is_arkui_x) {
65    defines += [ "CROSSPLATFORM" ]
66  }
67
68  part_name = "graphic_2d"
69  subsystem_name = "graphic"
70}
71
72# eventhandler }}}
73
74# hilog {{{
75ohos_source_set("hilog") {
76  if (current_os == "android" || current_os == "ios") {
77    public_deps = hilog_deps
78  } else {
79    external_deps = [ "hilog:libhilog" ]
80  }
81  part_name = "graphic_2d"
82  subsystem_name = "graphic"
83}
84
85# hilog }}}
86
87# image_native {{{
88group("image_native") {
89  if (platform == "ohos") {
90    public_external_deps = [ "image_framework:image_native" ]
91  } else if (platform == "android" || platform == "ios") {
92    public_external_deps = [ "image_framework:image_native" ]
93  } else {
94    public_deps = [ ":mock_image_native" ]
95  }
96}
97
98config("image_native_config") {
99  include_dirs = [ "image_native" ]
100}
101
102ohos_source_set("mock_image_native") {
103  public_configs = [ ":image_native_config" ]
104  sources = [ "image_native/pixel_map.cpp" ]
105  deps = [ ":utils" ]
106  cflags = [ "-DIMAGE_COLORSPACE_FLAG" ]
107  part_name = "graphic_2d"
108  subsystem_name = "graphic"
109}
110
111# image_native }}}
112
113# ipc_core {{{
114group("ipc_core") {
115  if (platform == "ohos") {
116    public_external_deps = [ "ipc:ipc_core" ]
117  } else {
118    public_deps = [ ":mock_ipc_core" ]
119  }
120}
121
122config("ipc_core_config") {
123  include_dirs = [ "ipc_core" ]
124}
125
126ohos_source_set("mock_ipc_core") {
127  public_configs = [ ":ipc_core_config" ]
128  sources = [
129    "ipc_core/ipc_object_stub.cpp",
130    "ipc_core/iremote_broker.cpp",
131    "ipc_core/iremote_object.cpp",
132    "ipc_core/message_option.cpp",
133    "ipc_core/message_parcel.cpp",
134    "ipc_core/peer_holder.cpp",
135  ]
136  deps = [ ":utils" ]
137  part_name = "graphic_2d"
138  subsystem_name = "graphic"
139}
140
141# ipc_core }}}
142
143# utils {{{
144group("utils") {
145  defines = []
146  if (platform == "ohos") {
147    public_external_deps = [ "c_utils:utils" ]
148  } else if (platform == "android" || platform == "ios") {
149    public_external_deps = [ "c_utils:utilsbase" ]
150  } else {
151    public_deps = [ ":mock_utils" ]
152  }
153  if (is_emulator) {
154    defines += [ "ROSEN_EMULATOR" ]
155  } else {
156    defines += []
157  }
158  if (platform == "ios") {
159    public_configs = [ ":ios_utils_config" ]
160  }
161}
162
163config("utils_config") {
164  include_dirs = [ "utils" ]
165}
166
167config("ios_utils_config") {
168  defines = [ "IOS_PLATFORM" ]
169}
170
171ohos_source_set("mock_utils") {
172  public_external_deps = []
173  if (current_os == "ios") {
174    public_configs = [ ":ios_utils_config" ]
175    public_external_deps += [ "c_utils:utilsbase" ]
176  } else {
177    public_configs = [ ":utils_config" ]
178    sources = [
179      "utils/directory_ex.cpp",
180      "utils/parcel.cpp",
181      "utils/refbase.cpp",
182    ]
183    public_external_deps += [ "bounds_checking_function:libsec_shared" ]
184  }
185  part_name = "graphic_2d"
186  subsystem_name = "graphic"
187}
188# utils }}}
189