• 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/arkui/ace_engine/ace_config.gni")
16import("//foundation/arkui/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  build_in_engine = defined(engine_config.use_build_in_js_engine) &&
27                    engine_config.use_build_in_js_engine
28
29  # generate libace_static lib
30  libace_static("libace_static_" + item.name) {
31    platform = item.name
32    config = {
33    }
34
35    if (defined(item.config)) {
36      config = item.config
37    }
38  }
39
40  # generate separated libace_engine lib
41  if (platform == "ohos") {
42    foreach(engine, support_engines) {
43      if (!build_in_engine) {
44        # generate libace_engine
45        ace_bridge_engine("libace_engine_${engine.engine_name}") {
46          platform = item.name
47          engine_name = engine.engine_name
48          build_type = "engine"
49          use_js_debug = false
50        }
51
52        # generate libace_engine_debug
53        if (defined(engine.have_debug) && engine.have_debug) {
54          ace_bridge_engine("libace_engine_${engine.engine_name}_debug") {
55            platform = item.name
56            engine_name = engine.engine_name
57            build_type = "engine"
58            use_js_debug = true
59          }
60        }
61
62        # generate libace_engine_declarative
63        ace_bridge_engine("libace_engine_declarative_${engine.engine_name}") {
64          platform = item.name
65          engine_name = engine.engine_name
66          build_type = "engine_declarative"
67        }
68      }
69
70      # generate libace_engine_pa
71      if (defined(engine_config.js_pa_support) && engine_config.js_pa_support) {
72        ace_bridge_engine("libace_engine_pa_${engine.engine_name}") {
73          platform = item.name
74          engine_name = engine.engine_name
75          build_type = "engine_pa"
76          pa_engine_path = engine_config.pa_engine_path
77        }
78      }
79    }
80  }
81}
82
83foreach(item, ace_platforms) {
84  platform = item.name
85  if (platform == "ohos") {
86    # libace target
87    ohos_shared_library("libace") {
88      deps = [ "$ace_root/build:libace_static_ohos" ]
89      part_name = ace_engine_part
90      subsystem_name = ace_engine_subsystem
91    }
92
93    ohos_source_set("ace_ohos_unittest_base") {
94      subsystem_name = ace_engine_subsystem
95      part_name = ace_engine_part
96      testonly = true
97      sources = [
98        "$ace_root/frameworks/base/test/mock/mock_ace_container.cpp",
99        "$ace_root/frameworks/base/test/mock/mock_download_manager.cpp",
100        "$ace_root/frameworks/base/test/mock/mock_drag_window_old.cpp",
101        "$ace_root/frameworks/core/common/test/mock/mock_ace_application_info.cpp",
102        "$ace_root/frameworks/core/components/test/mock/mock_resource_adapter.cpp",
103        "$ace_root/frameworks/core/components/test/unittest/mock/subwindow_mock.cpp",
104      ]
105
106      if (is_standard_system) {
107        sources -= [
108          "$ace_root/frameworks/base/test/mock/mock_download_manager.cpp",
109          "$ace_root/frameworks/core/components/test/mock/mock_resource_adapter.cpp",
110        ]
111      }
112
113      configs = [ "$ace_root:ace_test_config" ]
114
115      deps = [
116        "$ace_root/adapter/ohos/osal:ace_osal_ohos",
117        "$ace_root/frameworks/base:ace_base_ohos",
118        "$ace_root/frameworks/base/resource:ace_resource",
119        "$ace_root/frameworks/bridge:framework_bridge_ohos",
120        "$ace_root/frameworks/core:ace_core_ohos",
121        "$ace_root/frameworks/core/components/theme:build_theme_code",
122        "//third_party/googletest:gtest_main",
123      ]
124
125      external_deps = [ "c_utils:utils" ]
126    }
127  }
128}
129
130# Config for reduceing eh_frame section on aosp platform to save rom size.
131config("reduce_eh_frame_config") {
132  if (!use_mingw_win && !use_mac && !use_linux) {
133    cflags = [
134      "-fno-unwind-tables",
135      "-fomit-frame-pointer",
136    ]
137    cflags_cc = cflags
138  }
139}
140