1# Copyright (c) 2023 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/config/clang/clang.gni")
15import("//build/ohos.gni")
16
17ohos_prebuilt_shared_library("libv8") {
18  deps = [ ":copy_v8" ]
19
20  source = "$target_gen_dir/libv8_shared.so"
21  subsystem_name = "arkui"
22  part_name = "napi"
23
24  install_enable = true
25  install_images = [ "system" ]
26  innerapi_tags = [ "ndk" ]
27}
28
29action("copy_v8") {
30  external_deps = []
31  deps = []
32  script = "copy_v8.sh"
33  sources = []
34  outputs = [ "$target_gen_dir/libv8_shared.so" ]
35  args = [
36    "--target_gen_dir",
37    rebase_path("$target_gen_dir"),
38  ]
39}
40
41ohos_prebuilt_shared_library("libjsvm") {
42  deps = [
43    ":build_libjsvm",
44    ":libv8",
45  ]
46
47  source = "$target_gen_dir/libjsvm.so"
48  subsystem_name = "arkui"
49  part_name = "napi"
50
51  install_enable = true
52  install_images = [ "system" ]
53  innerapi_tags = [ "ndk" ]
54}
55
56action("build_libjsvm") {
57  external_deps = [
58    "node:node_header_notice",
59    "resource_schedule_service:ressched_client",
60  ]
61  deps = [ "//third_party/musl:musl_all" ]
62  script = "build_jsvm.sh"
63  sources = []
64  outputs = [ "$target_gen_dir/libjsvm.so" ]
65  args = [
66    "--target_gen_dir",
67    rebase_path("$target_gen_dir"),
68    "--target_cpu",
69    "$target_cpu",
70    "--prefix",
71    rebase_path("$clang_base_path/bin"),
72    "--sysroot",
73    rebase_path("$musl_sysroot"),
74    "--node_path",
75    rebase_path("//third_party/node"),
76  ]
77  if (use_clang_coverage) {
78    args += [
79      "--target_clang_coverage",
80      "$use_clang_coverage",
81    ]
82  }
83}
84