# Copyright (c) 2021-2022 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("//build/ohos.gni") import("//foundation/ace/ace_engine/ace_config.gni") template("js_engine_ark") { forward_variables_from(invoker, "*") ohos_source_set(target_name) { defines += invoker.defines configs = [ "$ace_root:ace_config", "$ark_runtime_path/libpandabase:arkbase_public_config", "//ark/js_runtime:ark_jsruntime_public_config", ] sources = [ "ark_js_runtime.cpp", "ark_js_value.cpp", "jsi_animation_bridge.cpp", "jsi_animator_bridge.cpp", "jsi_badge_bridge.cpp", "jsi_base_utils.cpp", "jsi_canvas_bridge.cpp", "jsi_chart_bridge.cpp", "jsi_clock_bridge.cpp", "jsi_component_api_bridge.cpp", "jsi_engine.cpp", "jsi_engine_loader.cpp", "jsi_group_js_bridge.cpp", "jsi_image_animator_bridge.cpp", "jsi_input_bridge.cpp", "jsi_list_bridge.cpp", "jsi_offscreen_canvas_bridge.cpp", "jsi_stepper_bridge.cpp", "jsi_utils.cpp", ] # xcomponent components supports phone, TV and wearable except PC Preview if (defined(config.xcomponent_components_support) && config.xcomponent_components_support) { sources += [ "jsi_xcomponent_bridge.cpp" ] } deps = [ "//third_party/jsframework:ark_build" ] if (target_cpu == "arm64") { defines += [ "APP_USE_ARM64" ] } else if (target_cpu == "arm") { defines += [ "APP_USE_ARM" ] } deps += [ "//ark/js_runtime:libark_jsruntime", "//foundation/ace/napi:ace_napi_ark", ] external_deps = [ "multimedia_image_standard:image", "multimedia_image_standard:image_native", "napi:ace_napi", ] } } foreach(item, ace_platforms) { platform = item.name engine_config = { } engine_config = item.config support_engines = [] support_engines = engine_config.js_engines foreach(engine, support_engines) { if (engine.engine_name == "ark") { js_engine_ark("js_engine_bridge_ark_$platform") { defines = engine.engine_defines config = { } if (defined(item.config)) { config = item.config } if (defined(config.defines)) { defines += config.defines } } } } }