# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//arkcompiler/ets_runtime/js_runtime_config.gni") import("//build/ohos.gni") import("//foundation/arkui/ace_engine/ace_config.gni") import("//foundation/arkui/napi/napi.gni") config("ace_napi_ark_config") { include_dirs = [ "//foundation/arkui/napi", "//third_party/libuv/include", "//commonlibrary/c_utils/base/include", ] defines = [] cflags_cc = [] if (is_mingw || is_mac || is_linux) { defines += [ "PREVIEW" ] } if (is_mingw) { defines += [ "WINDOWS_PLATFORM" ] cflags_cc += [ "-std=c++17" ] } else if (is_mac) { defines += [ "MAC_PLATFORM" ] } else if (is_linux) { defines += [ "LINUX_PLATFORM" ] cflags_cc += [ "-std=c++17" ] } else if (target_os == "ios") { defines += [ "IOS_PLATFORM" ] } } template("ace_napi_impl") { ohos_source_set(target_name) { public_configs = [ ":ace_napi_ark_config" ] defines = invoker.engine_defines configs = [ "//arkcompiler/ets_runtime:ark_jsruntime_public_config" ] include_dirs = [ "//foundation/arkui/napi/native_engine/impl/ark" ] sources = [ "ark_native_deferred.cpp", "ark_native_engine.cpp", "ark_native_engine_impl.cpp", "ark_native_reference.cpp", "native_value/ark_native_array.cpp", "native_value/ark_native_array_buffer.cpp", "native_value/ark_native_big_int.cpp", "native_value/ark_native_boolean.cpp", "native_value/ark_native_data_view.cpp", "native_value/ark_native_date.cpp", "native_value/ark_native_external.cpp", "native_value/ark_native_function.cpp", "native_value/ark_native_number.cpp", "native_value/ark_native_object.cpp", "native_value/ark_native_string.cpp", "native_value/ark_native_typed_array.cpp", "native_value/ark_native_value.cpp", ] if (target_cpu == "arm64") { defines += [ "APP_USE_ARM64" ] } else if (target_cpu == "arm") { defines += [ "APP_USE_ARM" ] } if (target_os == "android") { defines += [ "ANDROID_PLATFORM" ] } deps = [ "//foundation/arkui/napi:ace_napi" ] if (target_os == "ios") { deps += [ "//arkcompiler/ets_runtime:libark_jsruntime_static" ] } else { deps += [ "//arkcompiler/ets_runtime:libark_jsruntime" ] } if (is_mingw || is_mac || is_linux) { deps += [ "//third_party/icu/icu4c:shared_icui18n", "//third_party/icu/icu4c:shared_icuuc", ] } if (product_name != "ohos-sdk") { if (napi_enable_container_scope) { if (target_os == "ios") { deps += [ "//foundation/arkui/napi:ace_container_scope_static" ] } else { deps += [ "//foundation/arkui/napi:ace_container_scope" ] } defines += [ "ENABLE_CONTAINER_SCOPE" ] } } cflags_cc = [ "-Wno-missing-braces" ] if (!is_mingw && !is_mac && !is_linux) { external_deps = hilog_deps if (is_standard_system) { defines += [ "OHOS_PLATFORM" ] defines += [ "ENABLE_HITRACE" ] external_deps += [ "hitrace_native:hitrace_meter", "init:libbegetutil", ] } } part_name = "napi" subsystem_name = "arkui" } } foreach(item, ace_platforms) { if (item.name == "ohos" || is_cross_platform_build) { engine_config = item.config support_engines = engine_config.js_engines foreach(engine, support_engines) { if (engine.engine_name == "ark") { ace_napi_impl("ace_napi_impl_ark") { engine_defines = engine.engine_defines } } } } }