• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 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/ace/ace_engine/ace_config.gni")
16import("//foundation/ace/ace_engine/build/ace_lib.gni")
17
18# generate libace_engine and libace_debug targets
19foreach(item, ace_platforms) {
20  platform = item.name
21  engine_config = {
22  }
23  engine_config = item.config
24  support_engines = []
25  support_engines = engine_config.js_engines
26
27  # generate libace_static lib
28  libace_static("libace_static_" + item.name) {
29    platform = item.name
30    config = {
31    }
32
33    if (defined(item.config)) {
34      config = item.config
35    }
36  }
37
38  # build-in qjs debugger so, generate libace_debug library
39  if (defined(engine_config.use_build_in_js_engine) &&
40      engine_config.use_build_in_js_engine) {
41    # only qjs support build-in
42    if (defined(engine_config.qjs_engine)) {
43      engine = {
44      }
45      engine = engine_config.qjs_engine
46      if (defined(engine.have_debug) && engine.have_debug) {
47        libace_static("libace_static_debug_" + item.name) {
48          platform = item.name
49          use_js_debug = true
50          config = {
51          }
52          if (defined(item.config)) {
53            config = item.config
54          }
55        }
56
57        # target for build-in debugger
58        ohos_shared_library("libace_debug") {
59          deps = [ "$ace_root/build:libace_static_debug_${item.name}" ]
60          part_name = ace_engine_part
61          subsystem_name = "ace"
62        }
63      }
64    }
65  }
66
67  # generate separated libace_engine lib
68  if (platform == "ohos") {
69    foreach(engine, support_engines) {
70      # generate libace_engine
71      ace_bridge_engine("libace_engine_${engine.engine_name}") {
72        platform = item.name
73        engine_name = engine.engine_name
74        build_type = "engine"
75        use_js_debug = false
76      }
77
78      # generate libace_engine_debug
79      if (defined(engine.have_debug) && engine.have_debug) {
80        ace_bridge_engine("libace_engine_${engine.engine_name}_debug") {
81          platform = item.name
82          engine_name = engine.engine_name
83          build_type = "engine"
84          use_js_debug = true
85        }
86      }
87
88      # generate libace_engine_declarative
89      ace_bridge_engine("libace_engine_declarative_${engine.engine_name}") {
90        platform = item.name
91        engine_name = engine.engine_name
92        build_type = "engine_declarative"
93      }
94      if (defined(engine.declarative_default) && engine.declarative_default) {
95        ace_bridge_engine("libace_engine_declarative") {
96          platform = item.name
97          engine_name = engine.engine_name
98          build_type = "engine_declarative"
99        }
100      }
101
102      # generate libace_engine_pa
103      if (defined(engine_config.js_pa_support) && engine_config.js_pa_support) {
104        ace_bridge_engine("libace_engine_pa_${engine.engine_name}") {
105          platform = item.name
106          engine_name = engine.engine_name
107          build_type = "engine_pa"
108          pa_engine_path = engine_config.pa_engine_path
109        }
110      }
111    }
112  }
113}
114
115foreach(item, ace_platforms) {
116  platform = item.name
117  if (platform == "ohos") {
118    # libace target
119    ohos_shared_library("libace") {
120      deps = [ "$ace_root/build:libace_static_ohos" ]
121      part_name = ace_engine_part
122      subsystem_name = "ace"
123    }
124
125    ohos_source_set("ace_ohos_unittest_base") {
126      testonly = true
127      sources = [
128        "$ace_root/frameworks/base/test/mock/mock_drag_window.cpp",
129        "$ace_root/frameworks/core/mock/mock_ace_application_info.cpp",
130        "$ace_root/frameworks/core/mock/mock_download_manager.cpp",
131        "$ace_root/frameworks/core/mock/mock_resource_adapter.cpp",
132      ]
133
134      if (is_standard_system) {
135        sources -= [
136          "$ace_root/frameworks/core/mock/mock_download_manager.cpp",
137          "$ace_root/frameworks/core/mock/mock_resource_adapter.cpp",
138        ]
139      }
140
141      configs = [ "$ace_root:ace_test_config" ]
142
143      deps = [
144        "$ace_root/adapter/ohos/osal:ace_osal_ohos",
145        "$ace_root/frameworks/base:ace_base_ohos",
146        "$ace_root/frameworks/base/resource:ace_resource",
147        "$ace_root/frameworks/bridge:framework_bridge_ohos",
148        "$ace_root/frameworks/core:ace_core_ohos",
149        "$ace_root/frameworks/core/components/theme:build_theme_code",
150        "//third_party/googletest:gtest_main",
151        "//utils/native/base:utils",
152      ]
153    }
154  }
155}
156
157# Config for reduceing eh_frame section on android platform to save rom size.
158config("reduce_eh_frame_config") {
159  if (!use_mingw_win && !use_mac) {
160    cflags = [
161      "-fno-unwind-tables",
162      "-fomit-frame-pointer",
163    ]
164    cflags_cc = cflags
165  }
166}
167