• 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/ace/ace_engine/ace_config.gni")
16
17config("ace_napi_quickjs_config") {
18  include_dirs = [
19    "//foundation/ace/napi",
20    "//foundation/ace/napi/native_engine",
21    "//third_party/libuv/include",
22    "//third_party/quickjs",
23    "//utils/native/base/include",
24  ]
25}
26
27template("ace_napi_impl") {
28  ohos_source_set(target_name) {
29    public_configs = [ ":ace_napi_quickjs_config" ]
30    defines = invoker.engine_defines
31    defines += invoker.defines
32
33    include_dirs = [ "//foundation/ace/napi/native_engine/impl/quickjs" ]
34
35    sources = [
36      "native_value/quickjs_native_array.cpp",
37      "native_value/quickjs_native_array_buffer.cpp",
38      "native_value/quickjs_native_big_int.cpp",
39      "native_value/quickjs_native_boolean.cpp",
40      "native_value/quickjs_native_buffer.cpp",
41      "native_value/quickjs_native_data_view.cpp",
42      "native_value/quickjs_native_date.cpp",
43      "native_value/quickjs_native_external.cpp",
44      "native_value/quickjs_native_function.cpp",
45      "native_value/quickjs_native_number.cpp",
46      "native_value/quickjs_native_object.cpp",
47      "native_value/quickjs_native_string.cpp",
48      "native_value/quickjs_native_typed_array.cpp",
49      "native_value/quickjs_native_value.cpp",
50      "quickjs_ext.cpp",
51      "quickjs_native_deferred.cpp",
52      "quickjs_native_engine.cpp",
53      "quickjs_native_reference.cpp",
54    ]
55
56    if (use_mingw_win) {
57      defines += [ "WINDOWS_PLATFORM" ]
58    } else if (use_mac) {
59      defines += [ "MAC_PLATFORM" ]
60    } else {
61      external_deps = hilog_deps
62    }
63
64    deps = [
65      "//foundation/ace/napi:ace_napi",
66      "//third_party/quickjs:qjs",
67      "//utils/native/base:utilsecurec",
68    ]
69
70    cflags_cc = [ "-Wno-missing-braces" ]
71  }
72}
73
74foreach(item, ace_platforms) {
75  if (item.name == "ohos" || item.name == "android") {
76    engine_config = item.config
77    support_engines = engine_config.js_engines
78    foreach(engine, support_engines) {
79      if (engine.engine_name == "qjs") {
80        ace_napi_impl("ace_napi_impl_quickjs") {
81          defines = []
82          engine_defines = engine.engine_defines
83          defines = engine_config.defines
84        }
85      }
86    }
87  }
88}
89