• 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_gen_obj.gni")
17import("$v8_root/gni/snapshot_toolchain.gni")
18
19# Build v8 snapshot obj
20base_output_path =
21    get_label_info(":gen_v8_startup_snapshot_bin", "target_out_dir")
22v8_startup_snapshot_bin_path = base_output_path + "/v8_startup_snapshot.bin"
23v8_startup_snapshot_obj_path = base_output_path + "/v8_startup_snapshot.o"
24
25action("gen_v8_startup_snapshot_bin") {
26  visibility = [ ":*" ]  # Only targets in this file can depend on this.
27
28  deps = [ "$v8_root:mksnapshot($v8_snapshot_toolchain)" ]
29
30  script = "$v8_root/tools/run.sh"
31
32  args = [
33    rebase_path("${aosp_libs_dir}/ndk/libcxx/linux_x86") + ":" +
34        rebase_path("${aosp_libs_dir}/ndk/libcxx/linux_x86_64"),
35    rebase_path(
36        get_label_info("$v8_root:mksnapshot($v8_snapshot_toolchain)",
37                       "root_out_dir") + "/arkui/ace_engine_full/mksnapshot"),
38    "--startup_blob=" + rebase_path(v8_startup_snapshot_bin_path),
39    "--turbo_instruction_scheduling",
40  ]
41  outputs = [ v8_startup_snapshot_bin_path ]
42}
43
44gen_obj("v8_startup_snapshot") {
45  input = v8_startup_snapshot_bin_path
46  output = v8_startup_snapshot_obj_path
47  snapshot_dep = [ ":gen_v8_startup_snapshot_bin" ]
48}
49
50# Build v8 helper
51ohos_shared_library("ace_v8_helper") {
52  configs = [
53    "$ace_root:ace_config",
54    "$v8_root:v8_header_features",
55  ]
56  include_dirs = [ "//third_party/v8/include" ]
57  sources = [ "v8_helper.cpp" ]
58  deps = [ ":gen_obj_src_v8_startup_snapshot" ]
59
60  if (use_shared_v8) {
61    deps += [ "$v8_root:v8_shared" ]
62  } else {
63    deps += [
64      "$v8_root:ace_libicu",
65      "$v8_root:v8",
66      "$v8_root:v8_libbase",
67      "$v8_root:v8_libplatform",
68    ]
69  }
70
71  part_name = ace_engine_part
72  subsystem_name = ace_engine_subsystem
73}
74
75ohos_source_set("ace_v8_helper_static") {
76  configs = [
77    "$ace_root:ace_config",
78    "$v8_root:v8_header_features",
79  ]
80  include_dirs = [ "//third_party/v8/include" ]
81  sources = [ "v8_helper.cpp" ]
82  deps = [ ":gen_obj_src_v8_startup_snapshot" ]
83
84  if (use_shared_v8) {
85    deps += [ "$v8_root:v8_shared" ]
86  } else {
87    deps += [
88      "$v8_root:ace_libicu",
89      "$v8_root:v8",
90      "$v8_root:v8_libbase",
91      "$v8_root:v8_libplatform",
92    ]
93  }
94}
95