• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2024 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
17template("ace_base_source_set") {
18  forward_variables_from(invoker, "*")
19
20  ohos_source_set(target_name) {
21    if (current_os == "ohos") {
22      sanitize = {
23        integer_overflow = true
24        boundary_sanitize = true
25        debug = ace_sanitize_debug
26      }
27    }
28    subsystem_name = ace_engine_subsystem
29    part_name = ace_engine_part
30    defines += invoker.defines
31    deps = [
32      "base64:ace_base_base64_$platform",
33      "i18n:ace_base_i18n_$platform",
34      "resource:ace_resource",
35    ]
36    external_deps = []
37    external_deps += [ "zlib:shared_libz" ]
38    include_dirs = [ "$ace_root" ]
39    if (ohos_indep_compiler_enable) {
40      include_dirs += indep_compile_includes
41    }
42    if (use_hilog) {
43      external_deps += [ "hilog:libhilog" ]
44    }
45    configs = [ "$ace_root:ace_config" ]
46
47    # add base source file here
48    sources = [
49      "geometry/animatable_dimension.cpp",
50      "geometry/animatable_matrix4.cpp",
51      "geometry/arc_round.cpp",
52      "geometry/dimension.cpp",
53      "geometry/least_square_impl.cpp",
54      "geometry/matrix3.cpp",
55      "geometry/matrix4.cpp",
56      "geometry/quaternion.cpp",
57      "geometry/transform_util.cpp",
58      "image/pixel_map.cpp",
59      "json/json_util.cpp",
60      "json/node_object.cpp",
61      "json/uobject.cpp",
62      "log/ace_performance_check.cpp",
63      "log/ace_performance_monitor.cpp",
64      "log/ace_scoring_log.cpp",
65      "log/ace_trace.cpp",
66      "log/ace_tracker.cpp",
67      "log/dump_log.cpp",
68      "log/dump_recorder.cpp",
69      "log/jank_frame_report.cpp",
70      "memory/memory_monitor.cpp",
71      "mousestyle/mouse_style.cpp",
72      "perfmonitor/perf_monitor.cpp",
73      "ressched/ressched_report.cpp",
74      "subwindow/subwindow_manager.cpp",
75      "thread/background_task_executor.cpp",
76      "thread/task_dependency_manager.cpp",
77      "utils/base_id.cpp",
78      "utils/date_util.cpp",
79      "utils/lifecycle_checkable.cpp",
80      "utils/measure_util.cpp",
81      "utils/resource_configuration.cpp",
82      "utils/string_expression.cpp",
83      "utils/string_utils.cpp",
84      "utils/time_util.cpp",
85      "utils/utf.cpp",
86      "utils/utf_helper.cpp",
87      "utils/utils.cpp",
88    ]
89
90    if (platform != "windows") {
91      # add secure c API
92      if (is_arkui_x) {
93        deps += [ "//third_party/bounds_checking_function:libsec_static" ]
94      }
95    } else {
96      defines -= [ "UNICODE" ]
97      libs = [ "//prebuilts/mingw-w64/ohos/linux-x86_64/clang-mingw/x86_64-w64-mingw32/lib/libshlwapi.a" ]
98    }
99
100    if (is_arkui_x) {
101      deps += [
102        "${ace_graphic}/rosen/modules/render_service_client:librender_service_client_static",
103        "${ace_root}/interfaces/inner_api/drawable_descriptor:native_drawabledescriptor_static",
104      ]
105    } else {
106      external_deps += [ "graphic_2d:librender_service_client" ]
107    }
108
109    if (is_arkui_x) {
110      deps += [ "//third_party/cJSON:cjson_static" ]
111    } else {
112      external_deps += [ "cJSON:cjson" ]
113    }
114
115    cflags_cc = []
116    cflags_cc += invoker.cflags_cc
117  }
118}
119
120foreach(item, ace_platforms) {
121  ace_base_source_set("ace_base_" + item.name) {
122    platform = item.name
123    defines = []
124    cflags_cc = []
125    config = {
126    }
127
128    if (defined(item.config)) {
129      config = item.config
130    }
131
132    if (defined(config.defines)) {
133      defines = config.defines
134    }
135
136    if (defined(config.cflags_cc)) {
137      cflags_cc = config.cflags_cc
138    }
139  }
140
141  ohos_source_set("ace_memory_monitor_" + item.name) {
142    platform = item.name
143    subsystem_name = ace_engine_subsystem
144    part_name = ace_engine_part
145    defines = []
146    cflags_cc = []
147    config = {
148    }
149
150    if (defined(item.config)) {
151      config = item.config
152    }
153
154    if (defined(config.defines)) {
155      defines = config.defines
156    }
157
158    if (defined(config.cflags_cc)) {
159      cflags_cc = config.cflags_cc
160    }
161
162    configs = [ "$ace_root:ace_config" ]
163
164    sources = [
165      "$ace_root/frameworks/base/log/dump_log.cpp",
166      "$ace_root/frameworks/base/memory/memory_monitor.cpp",
167    ]
168
169    if (platform == "windows" || platform == "mac" || platform == "linux") {
170      sources += [
171        "$ace_root/adapter/preview/osal/event_report.cpp",
172        "$ace_root/adapter/preview/osal/system_properties.cpp",
173      ]
174    } else {
175      sources += [ "$ace_root/adapter/$platform/osal/system_properties.cpp" ]
176    }
177
178    if (platform == "ohos") {
179      external_deps = [
180        "ability_runtime:abilitykit_native",
181        "hilog:libhilog",
182        "i18n:intl_util",
183        "init:libbeget_proxy",
184        "init:libbegetutil",
185        "napi:ace_napi",
186        "window_manager:libdm",
187        "zlib:shared_libz",
188      ]
189
190      if (defined(config.hichecker_exists) && config.hichecker_exists) {
191        external_deps += [ "hichecker:libhichecker" ]
192      }
193    }
194  }
195}
196