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_method_manager_preview.cpp",
77      "modal_ui_extension_impl.cpp",
78      "mouse_style_ohos.cpp",
79      "package_event_proxy_preview.cpp",
80      "pixel_map_preview.cpp",
81      "response_data.cpp",
82      "ressched_report.cpp",
83      "socperf_client_impl.cpp",
84      "stage_card_parser.cpp",
85      "stylus_detector_default.cpp",
86      "stylus_detector_loader.cpp",
87      "stylus_detector_mgr.cpp",
88      "system_bar_style_ohos.cpp",
89      "system_properties.cpp",
90      "task/task_runner_adapter_impl.cpp",
91      "thread_priority.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      "window_manager:previewer_window",
117    ]
118
119    if (ace_use_rosen_drawing) {
120      external_deps += [
121        "graphic_2d:2d_graphics",
122        "graphic_2d:drawing_napi_impl",
123      ]
124    }
125
126    configs = [ "$ace_root:ace_config" ]
127
128    if (is_ohos_standard_system) {
129      sources += [
130        "${ace_root}/adapter/ohos/osal/resource_theme_style.cpp",
131        "frame_trace_adapter_impl.cpp",
132        "resource_adapter_impl_standard.cpp",
133        "resource_convertor.cpp",
134      ]
135      defines += [ "OHOS_STANDARD_SYSTEM" ]
136      if (platform == "windows") {
137        deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_win" ]
138      } else if (platform == "mac") {
139        deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_mac" ]
140      } else if (platform == "linux") {
141        deps += [ "//base/global/resource_management/frameworks/resmgr:global_resmgr_linux" ]
142      }
143      external_deps += [ "napi:ace_napi" ]
144    } else {
145      sources += [
146        "frame_trace_adapter_impl.cpp",
147        "resource_adapter_impl.cpp",
148      ]
149      include_dirs = [ "//prebuilts/ace-toolkit/preview/rich/include/resmgr/resourcemanager/include" ]
150      if (platform == "windows") {
151        defines += [ "NOGDI" ]
152        libs = [ "//prebuilts/ace-toolkit/preview/rich/lib/windows/tv/libresourcemanager_win.lib" ]
153      } else if (platform == "mac") {
154        libs = [ "//prebuilts/ace-toolkit/preview/rich/lib/mac/tv/libresourcemanager_mac.dylib" ]
155      } else if (platform == "linux") {
156        libs = [ "//prebuilts/ace-toolkit/preview/rich/lib/linux/tv/libresourcemanager_linux.so" ]
157      }
158    }
159  }
160}
161