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