• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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")
16import("//foundation/arkui/ace_engine/build/ace_controller.gni")
17import("//foundation/arkui/ace_engine/interfaces/napi/kits/napi_lib.gni")
18
19# Build libace static library
20template("libace_static") {
21  forward_variables_from(invoker, "*")
22
23  ohos_source_set(target_name) {
24    if (current_os == "ohos") {
25      sanitize = {
26        integer_overflow = true
27        boundary_sanitize = true
28        debug = ace_sanitize_debug
29      }
30    }
31
32    deps = [ "$ace_root/frameworks/base:ace_base_$platform" ]
33    external_deps = []
34    if (use_mingw_win || use_mac || use_linux) {
35      external_deps += [
36        "icu:shared_icui18n",
37        "icu:shared_icuuc",
38      ]
39    }
40
41    if (platform == "ohos_ng" || is_arkui_x) {
42      deps += [
43        "$ace_root/frameworks/bridge:framework_bridge_ng_$platform",
44        "$ace_root/frameworks/core:ace_core_ng_$platform",
45      ]
46    } else if (platform == "ohos" && !is_asan &&
47               ace_engine_feature_enable_libace) {
48      deps += [
49        "$ace_root/frameworks/bridge:framework_bridge_$platform",
50        "$ace_root/frameworks/core:ace_core_$platform",
51      ]
52
53      # add napi lib to libace.z.so for auto load in old generation mode
54      foreach(module, common_napi_libs) {
55        target_names = []
56        prefix_dir = []
57        module_path = []
58        module_name = []
59
60        target_names = string_split(module, "/")
61        prefix_dir = target_names[0]
62        if (prefix_dir != module) {
63          module_path = target_names[1]
64        } else {
65          module_path = prefix_dir
66        }
67        module_name = string_replace(module_path, "_", "")
68
69        deps += [ "$ace_root/interfaces/napi/kits/${module_path}:${module_name}_static_${platform}" ]
70      }
71    } else {
72      deps += [
73        "$ace_root/frameworks/bridge:framework_bridge_$platform",
74        "$ace_root/frameworks/core:ace_core_$platform",
75      ]
76    }
77
78    if (defined(config.platform_deps)) {
79      deps += config.platform_deps
80    }
81
82    # build-in ark js engine for preview
83    if (defined(config.use_build_in_js_engine) &&
84        config.use_build_in_js_engine && defined(config.ark_engine)) {
85      if (platform == "ohos_ng" || is_arkui_x) {
86        deps += [ "$ace_root/frameworks/bridge/declarative_frontend:declarative_js_engine_ng_ark_$platform" ]
87      } else {
88        deps += [
89          "$ace_root/frameworks/bridge/declarative_frontend:declarative_js_engine_ark_$platform",
90          "$ace_root/frameworks/bridge/js_frontend/engine:js_engine_ark_$platform",
91        ]
92      }
93    }
94    configs = [ "$ace_root:ace_coverage_config" ]
95    if (use_hilog) {
96      external_deps += [ "hilog:libhilog" ]
97    }
98    part_name = ace_engine_part
99    subsystem_name = ace_engine_subsystem
100  }
101}
102
103# build platform engine sources
104template("ace_bridge_engine") {
105  forward_variables_from(invoker, "*")
106
107  ohos_shared_library(target_name) {
108    configs = [ "$ace_root:ace_coverage_config" ]
109    deps = []
110
111    assert(defined(platform) && (platform == "ohos" || platform == "ohos_ng"),
112           "Only ohos need separated engine lib")
113
114    if (use_hilog) {
115      external_deps = [ "hilog:libhilog" ]
116    }
117    if (build_type == "engine") {
118      if (use_js_debug) {
119        deps += [ "$ace_root/frameworks/bridge/js_frontend/engine:js_engine_${engine_name}_debug_$platform" ]
120      } else {
121        deps += [ "$ace_root/frameworks/bridge/js_frontend/engine:js_engine_${engine_name}_$platform" ]
122      }
123    } else if (build_type == "engine_declarative") {
124      deps += [ "$ace_root/frameworks/bridge/declarative_frontend:declarative_js_engine_${engine_name}_$platform" ]
125    } else if (build_type == "engine_pa") {
126      deps += [ "$ace_root/${pa_engine_path}/engine:js_pa_engine_${engine_name}_$platform" ]
127    }
128
129    subsystem_name = ace_engine_subsystem
130    part_name = ace_engine_part
131  }
132}
133