14514f5e3Sopenharmony_ci# Copyright (c) 2021 Huawei Device Co., Ltd.
24514f5e3Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
34514f5e3Sopenharmony_ci# you may not use this file except in compliance with the License.
44514f5e3Sopenharmony_ci# You may obtain a copy of the License at
54514f5e3Sopenharmony_ci#
64514f5e3Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
74514f5e3Sopenharmony_ci#
84514f5e3Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
94514f5e3Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
104514f5e3Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114514f5e3Sopenharmony_ci# See the License for the specific language governing permissions and
124514f5e3Sopenharmony_ci# limitations under the License.
134514f5e3Sopenharmony_ci
144514f5e3Sopenharmony_ciimport("//arkcompiler/ets_runtime/js_runtime_config.gni")
154514f5e3Sopenharmony_ci
164514f5e3Sopenharmony_ciif (ark_standalone_build) {
174514f5e3Sopenharmony_ci  if (is_ohos && run_with_qemu) {
184514f5e3Sopenharmony_ci    import("$build_root/toolchain/ark/ark_toolchain.gni")
194514f5e3Sopenharmony_ci    copy("copy_libcxxso_for_qemu") {
204514f5e3Sopenharmony_ci      sources = [ "${libcxxso_file}" ]
214514f5e3Sopenharmony_ci      outputs = [ "${root_out_dir}/${so_dir_for_qemu}/lib/libc++.so" ]
224514f5e3Sopenharmony_ci    }
234514f5e3Sopenharmony_ci  }
244514f5e3Sopenharmony_ci}
254514f5e3Sopenharmony_ci
264514f5e3Sopenharmony_ciohos_executable("ark_js_vm") {
274514f5e3Sopenharmony_ci  if (enable_sanitize) {
284514f5e3Sopenharmony_ci    sanitize = {
294514f5e3Sopenharmony_ci      ubsan = true
304514f5e3Sopenharmony_ci    }
314514f5e3Sopenharmony_ci  }
324514f5e3Sopenharmony_ci
334514f5e3Sopenharmony_ci  sources = [ "main.cpp" ]
344514f5e3Sopenharmony_ci
354514f5e3Sopenharmony_ci  configs = [
364514f5e3Sopenharmony_ci    "$js_root:ark_jsruntime_common_config",
374514f5e3Sopenharmony_ci    "$js_root:ark_jsruntime_public_config",
384514f5e3Sopenharmony_ci  ]
394514f5e3Sopenharmony_ci
404514f5e3Sopenharmony_ci  external_deps = []
414514f5e3Sopenharmony_ci  deps = [ "$js_root:libark_jsruntime" ]
424514f5e3Sopenharmony_ci  if (ark_standalone_build) {
434514f5e3Sopenharmony_ci    if (run_with_qemu && is_ohos) {
444514f5e3Sopenharmony_ci      deps += [
454514f5e3Sopenharmony_ci        ":copy_libcxxso_for_qemu",
464514f5e3Sopenharmony_ci        "$build_root/third_party_gn/bounds_checking_function:libsec_shared_for_qemu",
474514f5e3Sopenharmony_ci      ]
484514f5e3Sopenharmony_ci      if (use_musl) {
494514f5e3Sopenharmony_ci        deps +=
504514f5e3Sopenharmony_ci            [ "$build_root/third_party_gn/musl:soft_create_linker_for_qemu" ]
514514f5e3Sopenharmony_ci      }
524514f5e3Sopenharmony_ci    }
534514f5e3Sopenharmony_ci  }
544514f5e3Sopenharmony_ci
554514f5e3Sopenharmony_ci  if (!is_arkui_x) {
564514f5e3Sopenharmony_ci    external_deps += [
574514f5e3Sopenharmony_ci      "runtime_core:arkfile_header_deps",
584514f5e3Sopenharmony_ci      "runtime_core:libarkbase_static",
594514f5e3Sopenharmony_ci    ]
604514f5e3Sopenharmony_ci  } else {
614514f5e3Sopenharmony_ci    deps += [
624514f5e3Sopenharmony_ci      "$ark_root/libpandabase:libarkbase_static",
634514f5e3Sopenharmony_ci      "$ark_root/libpandafile:arkfile_header_deps",
644514f5e3Sopenharmony_ci    ]
654514f5e3Sopenharmony_ci  }
664514f5e3Sopenharmony_ci
674514f5e3Sopenharmony_ci  # hiviewdfx libraries
684514f5e3Sopenharmony_ci  external_deps += hiviewdfx_ext_deps
694514f5e3Sopenharmony_ci  deps += hiviewdfx_deps
704514f5e3Sopenharmony_ci
714514f5e3Sopenharmony_ci  install_enable = false
724514f5e3Sopenharmony_ci
734514f5e3Sopenharmony_ci  part_name = "ets_runtime"
744514f5e3Sopenharmony_ci  subsystem_name = "arkcompiler"
754514f5e3Sopenharmony_ci}
76