1# Copyright (c) 2021-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/arkui/ace_engine/ace_config.gni")
16
17ohos_source_set("utilsecurec_source") {
18  subsystem_name = ace_engine_subsystem
19  part_name = ace_engine_part
20  if (defined(current_platform.name)) {
21    platform = current_platform.name
22    defines = []
23    config = {
24    }
25    if (defined(current_platform.config)) {
26      config = current_platform.config
27    }
28    if (defined(config.defines)) {
29      defines += config.defines
30    }
31    if (platform == "windows") {
32      external_deps = [ "bounds_checking_function:libsec_shared" ]
33      cflags = [ "-Wno-inconsistent-dllimport" ]
34    }
35  }
36}
37
38ohos_source_set("preview_osal_source") {
39  subsystem_name = ace_engine_subsystem
40  part_name = ace_engine_part
41  if (defined(current_platform.name)) {
42    platform = current_platform.name
43    defines = []
44    config = {
45    }
46    if (defined(current_platform.config)) {
47      config = current_platform.config
48    }
49    if (defined(config.defines)) {
50      defines += config.defines
51    }
52
53    sources = [
54      "${ace_root}/adapter/ohos/osal/log_wrapper.cpp",
55      "ace_checker.cpp",
56      "ace_engine_ext.cpp",
57      "ace_trace.cpp",
58      "advance/ai_write_adapter.cpp",
59      "advance/data_detector_adapter.cpp",
60      "advance/data_detector_mgr.cpp",
61      "advance/image_analyzer_adapter_impl.cpp",
62      "advance/image_analyzer_manager.cpp",
63      "advance/image_analyzer_mgr.cpp",
64      "app_bar_helper_impl.cpp",
65      "display_info_utils.cpp",
66      "download_manager_preview.cpp",
67      "drawing_color_filter_preview.cpp",
68      "drawing_lattice_preview.cpp",
69      "event_report.cpp",
70      "exception_handler.cpp",
71      "fetch_manager.cpp",
72      "file_uri_helper_preview.cpp",
73      "frame_report.cpp",
74      "image_packer_preview.cpp",
75      "image_source_preview.cpp",
76      "input_manager.cpp",
77      "input_method_manager_preview.cpp",
78      "modal_ui_extension_impl.cpp",
79      "mouse_style_ohos.cpp",
80      "package_event_proxy_preview.cpp",
81      "pixel_map_preview.cpp",
82      "response_data.cpp",
83      "ressched_report.cpp",
84      "socperf_client_impl.cpp",
85      "stage_card_parser.cpp",
86      "stylus_detector_default.cpp",
87      "stylus_detector_loader.cpp",
88      "stylus_detector_mgr.cpp",
89      "system_bar_style_ohos.cpp",
90      "system_properties.cpp",
91      "task/task_runner_adapter_impl.cpp",
92      "time_event_proxy_preview.cpp",
93      "trace_id_impl.cpp",
94      "view_data_wrap_impl.cpp",
95      "want_wrap_preview.cpp",
96    ]
97
98    if (defined(resourceschedule_ffrt_support) &&
99        resourceschedule_ffrt_support) {
100      sources += [ "long_frame_report_impl.cpp" ]
101    }
102
103    cflags_cc = [
104      "-DNAME_MAX=128",
105      "-Wno-inconsistent-dllimport",
106    ]
107
108    deps = [
109      ":utilsecurec_source",
110      "//foundation/graphic/graphic_2d/rosen/modules/platform:image_native",
111    ]
112
113    external_deps = [
114      "curl:curl_shared",
115      "hilog:libhilog",
116    ]
117
118    if (ace_use_rosen_drawing) {
119      external_deps += [
120        "graphic_2d:2d_graphics",
121        "graphic_2d:drawing_napi_impl",
122      ]
123    }
124
125    configs = [ "$ace_root:ace_config" ]
126
127    if (is_ohos_standard_system) {
128      sources += [
129        "${ace_root}/adapter/ohos/osal/resource_theme_style.cpp",
130        "frame_trace_adapter_impl.cpp",
131        "resource_adapter_impl_standard.cpp",
132        "resource_convertor.cpp",
133      ]
134      defines += [ "OHOS_STANDARD_SYSTEM" ]
135      if (platform == "windows") {
136        deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_win" ]
137      } else if (platform == "mac") {
138        deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_mac" ]
139      } else if (platform == "linux") {
140        deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_linux" ]
141      }
142      external_deps += [ "napi:ace_napi" ]
143    } else {
144      sources += [
145        "frame_trace_adapter_impl.cpp",
146        "resource_adapter_impl.cpp",
147      ]
148      include_dirs = [ "//prebuilts/ace-toolkit/preview/rich/include/resmgr/resourcemanager/include" ]
149      if (platform == "windows") {
150        defines += [ "NOGDI" ]
151        libs = [ "//prebuilts/ace-toolkit/preview/rich/lib/windows/tv/libresourcemanager_win.lib" ]
152      } else if (platform == "mac") {
153        libs = [ "//prebuilts/ace-toolkit/preview/rich/lib/mac/tv/libresourcemanager_mac.dylib" ]
154      } else if (platform == "linux") {
155        libs = [ "//prebuilts/ace-toolkit/preview/rich/lib/linux/tv/libresourcemanager_linux.so" ]
156      }
157    }
158  }
159}
160