• 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("//ark/js_runtime/js_runtime_config.gni")
15import("//build/ohos.gni")
16import("//foundation/ace/ace_engine/ace_config.gni")
17
18config("ace_napi_ark_config") {
19  include_dirs = [
20    "//foundation/ace/napi",
21    "//third_party/libuv/include",
22    "//utils/native/base/include",
23  ]
24}
25
26template("ace_napi_impl") {
27  ohos_source_set(target_name) {
28    public_configs = [ ":ace_napi_ark_config" ]
29    defines = invoker.engine_defines
30    configs = [ "//ark/js_runtime:ark_jsruntime_public_config" ]
31
32    include_dirs = [ "//foundation/ace/napi/native_engine/impl/ark" ]
33
34    sources = [
35      "ark_native_deferred.cpp",
36      "ark_native_engine.cpp",
37      "ark_native_reference.cpp",
38      "native_value/ark_native_array.cpp",
39      "native_value/ark_native_array_buffer.cpp",
40      "native_value/ark_native_big_int.cpp",
41      "native_value/ark_native_boolean.cpp",
42      "native_value/ark_native_data_view.cpp",
43      "native_value/ark_native_date.cpp",
44      "native_value/ark_native_external.cpp",
45      "native_value/ark_native_function.cpp",
46      "native_value/ark_native_number.cpp",
47      "native_value/ark_native_object.cpp",
48      "native_value/ark_native_string.cpp",
49      "native_value/ark_native_typed_array.cpp",
50      "native_value/ark_native_value.cpp",
51    ]
52
53    if (target_cpu == "arm64") {
54      defines += [ "APP_USE_ARM64" ]
55    } else if (target_cpu == "arm") {
56      defines += [ "APP_USE_ARM" ]
57    }
58
59    deps = [
60      "//ark/js_runtime:libark_jsruntime",
61      "//foundation/ace/napi:ace_napi",
62    ]
63
64    if (product_name != "ohos-sdk") {
65      deps += [ "$ace_root/frameworks/core:ace_container_scope" ]
66      defines += [ "ENABLE_CONTAINER_SCOPE" ]
67    }
68
69    cflags_cc = [ "-Wno-missing-braces" ]
70    external_deps = hilog_deps
71    if (is_standard_system) {
72      external_deps += [ "startup_l2:syspara" ]
73    } else {
74      external_deps += [ "startup:syspara" ]
75    }
76  }
77}
78
79foreach(item, ace_platforms) {
80  if (item.name == "ohos") {
81    engine_config = item.config
82    support_engines = engine_config.js_engines
83    foreach(engine, support_engines) {
84      if (engine.engine_name == "ark") {
85        ace_napi_impl("ace_napi_impl_ark") {
86          engine_defines = engine.engine_defines
87        }
88      }
89    }
90  }
91}
92