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/arkui/ace_engine/ace_config.gni") 16 17config("ace_napi_v8_config") { 18 include_dirs = [ 19 "//foundation/arkui/napi", 20 "//third_party/libuv/include", 21 "//third_party/v8/include", 22 "//commonlibrary/c_utils/base/include", 23 ] 24} 25 26template("ace_napi_impl") { 27 ohos_source_set(target_name) { 28 public_configs = [ ":ace_napi_v8_config" ] 29 30 include_dirs = [ "//foundation/arkui/napi/native_engine/impl/v8" ] 31 32 defines = invoker.engine_defines 33 34 if (target_cpu == "arm64") { 35 defines += [ "APP_USE_ARM64" ] 36 } else if (target_cpu == "arm") { 37 defines += [ "APP_USE_ARM" ] 38 } 39 40 sources = [ 41 "native_value/v8_native_array.cpp", 42 "native_value/v8_native_array_buffer.cpp", 43 "native_value/v8_native_boolean.cpp", 44 "native_value/v8_native_data_view.cpp", 45 "native_value/v8_native_external.cpp", 46 "native_value/v8_native_function.cpp", 47 "native_value/v8_native_number.cpp", 48 "native_value/v8_native_object.cpp", 49 "native_value/v8_native_string.cpp", 50 "native_value/v8_native_typed_array.cpp", 51 "native_value/v8_native_value.cpp", 52 "v8_native_deferred.cpp", 53 "v8_native_engine.cpp", 54 "v8_native_reference.cpp", 55 ] 56 57 configs = [ "//third_party/v8:v8_header_features" ] 58 59 deps = [ 60 "//foundation/arkui/napi:ace_napi", 61 "//third_party/v8:v8_shared", 62 ] 63 64 external_deps = hilog_deps 65 } 66} 67 68foreach(item, ace_platforms) { 69 if (item.name == "ohos") { 70 engine_config = item.config 71 support_engines = engine_config.js_engines 72 foreach(engine, support_engines) { 73 if (engine.engine_name == "v8") { 74 ace_napi_impl("ace_napi_impl_v8") { 75 engine_defines = engine.engine_defines 76 } 77 } 78 } 79 } 80} 81