xref: /foundation/arkui/napi/jsvm/BUILD.gn (revision 33eb0b6d)
133eb0b6dSopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd.
233eb0b6dSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
333eb0b6dSopenharmony_ci# you may not use this file except in compliance with the License.
433eb0b6dSopenharmony_ci# You may obtain a copy of the License at
533eb0b6dSopenharmony_ci#
633eb0b6dSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
733eb0b6dSopenharmony_ci#
833eb0b6dSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
933eb0b6dSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1033eb0b6dSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1133eb0b6dSopenharmony_ci# See the License for the specific language governing permissions and
1233eb0b6dSopenharmony_ci# limitations under the License.
1333eb0b6dSopenharmony_ci
1433eb0b6dSopenharmony_ciimport("//build/config/clang/clang.gni")
1533eb0b6dSopenharmony_ciimport("//build/ohos.gni")
1633eb0b6dSopenharmony_ci
1733eb0b6dSopenharmony_ciohos_prebuilt_shared_library("libv8") {
1833eb0b6dSopenharmony_ci  deps = [ ":copy_v8" ]
1933eb0b6dSopenharmony_ci
2033eb0b6dSopenharmony_ci  source = "$target_gen_dir/libv8_shared.so"
2133eb0b6dSopenharmony_ci  subsystem_name = "arkui"
2233eb0b6dSopenharmony_ci  part_name = "napi"
2333eb0b6dSopenharmony_ci
2433eb0b6dSopenharmony_ci  install_enable = true
2533eb0b6dSopenharmony_ci  install_images = [ "system" ]
2633eb0b6dSopenharmony_ci  innerapi_tags = [ "ndk" ]
2733eb0b6dSopenharmony_ci}
2833eb0b6dSopenharmony_ci
2933eb0b6dSopenharmony_ciaction("copy_v8") {
3033eb0b6dSopenharmony_ci  external_deps = []
3133eb0b6dSopenharmony_ci  deps = []
3233eb0b6dSopenharmony_ci  script = "copy_v8.sh"
3333eb0b6dSopenharmony_ci  sources = []
3433eb0b6dSopenharmony_ci  outputs = [ "$target_gen_dir/libv8_shared.so" ]
3533eb0b6dSopenharmony_ci  args = [
3633eb0b6dSopenharmony_ci    "--target_gen_dir",
3733eb0b6dSopenharmony_ci    rebase_path("$target_gen_dir"),
3833eb0b6dSopenharmony_ci  ]
3933eb0b6dSopenharmony_ci}
4033eb0b6dSopenharmony_ci
4133eb0b6dSopenharmony_ciohos_prebuilt_shared_library("libjsvm") {
4233eb0b6dSopenharmony_ci  deps = [
4333eb0b6dSopenharmony_ci    ":build_libjsvm",
4433eb0b6dSopenharmony_ci    ":libv8",
4533eb0b6dSopenharmony_ci  ]
4633eb0b6dSopenharmony_ci
4733eb0b6dSopenharmony_ci  source = "$target_gen_dir/libjsvm.so"
4833eb0b6dSopenharmony_ci  subsystem_name = "arkui"
4933eb0b6dSopenharmony_ci  part_name = "napi"
5033eb0b6dSopenharmony_ci
5133eb0b6dSopenharmony_ci  install_enable = true
5233eb0b6dSopenharmony_ci  install_images = [ "system" ]
5333eb0b6dSopenharmony_ci  innerapi_tags = [ "ndk" ]
5433eb0b6dSopenharmony_ci}
5533eb0b6dSopenharmony_ci
5633eb0b6dSopenharmony_ciaction("build_libjsvm") {
5733eb0b6dSopenharmony_ci  external_deps = [
5833eb0b6dSopenharmony_ci    "node:node_header_notice",
5933eb0b6dSopenharmony_ci    "resource_schedule_service:ressched_client",
6033eb0b6dSopenharmony_ci  ]
6133eb0b6dSopenharmony_ci  deps = [ "//third_party/musl:musl_all" ]
6233eb0b6dSopenharmony_ci  script = "build_jsvm.sh"
6333eb0b6dSopenharmony_ci  sources = []
6433eb0b6dSopenharmony_ci  outputs = [ "$target_gen_dir/libjsvm.so" ]
6533eb0b6dSopenharmony_ci  args = [
6633eb0b6dSopenharmony_ci    "--target_gen_dir",
6733eb0b6dSopenharmony_ci    rebase_path("$target_gen_dir"),
6833eb0b6dSopenharmony_ci    "--target_cpu",
6933eb0b6dSopenharmony_ci    "$target_cpu",
7033eb0b6dSopenharmony_ci    "--prefix",
7133eb0b6dSopenharmony_ci    rebase_path("$clang_base_path/bin"),
7233eb0b6dSopenharmony_ci    "--sysroot",
7333eb0b6dSopenharmony_ci    rebase_path("$musl_sysroot"),
7433eb0b6dSopenharmony_ci    "--node_path",
7533eb0b6dSopenharmony_ci    rebase_path("//third_party/node"),
7633eb0b6dSopenharmony_ci  ]
7733eb0b6dSopenharmony_ci  if (use_clang_coverage) {
7833eb0b6dSopenharmony_ci    args += [
7933eb0b6dSopenharmony_ci      "--target_clang_coverage",
8033eb0b6dSopenharmony_ci      "$use_clang_coverage",
8133eb0b6dSopenharmony_ci    ]
8233eb0b6dSopenharmony_ci  }
8333eb0b6dSopenharmony_ci}
84