1# Copyright (c) 2021-2022 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 17template("declarative_js_engine_qjs") { 18 forward_variables_from(invoker, "*") 19 20 ohos_source_set(target_name) { 21 subsystem_name = ace_engine_subsystem 22 part_name = ace_engine_part 23 defines += invoker.defines 24 25 configs = [ "$ace_root:ace_config" ] 26 27 sources = [ 28 "modules/qjs_curves_module.cpp", 29 "modules/qjs_matrix4_module.cpp", 30 "modules/qjs_module_manager.cpp", 31 "modules/qjs_router_module.cpp", 32 "qjs_bindings.cpp", 33 "qjs_declarative_engine.cpp", 34 "qjs_declarative_engine_instance.cpp", 35 "qjs_function_list_entries_container.cpp", 36 "qjs_helpers.cpp", 37 "qjs_object_template.cpp", 38 "qjs_types.cpp", 39 "qjs_unwrap_any.cpp", 40 "qjs_view_register.cpp", 41 ] 42 43 if (enable_ng_build) { 44 sources += [ "qjs_view_register_impl_ng.cpp" ] 45 } else { 46 sources += [ "qjs_view_register_impl.cpp" ] 47 } 48 49 deps = [ 50 "$ace_root/frameworks/core/components/theme:build_theme_code", 51 "//third_party/quickjs:qjs", 52 ] 53 54 if (defined(config.use_build_in_js_engine) && 55 config.use_build_in_js_engine) { 56 defines += [ "BUILT_IN_JS_ENGINE" ] 57 if (enable_ng_build) { 58 sources += [ 59 "$ace_root/frameworks/bridge/js_frontend/engine/quickjs/qjs_group_js_bridge.cpp", 60 "$ace_root/frameworks/bridge/js_frontend/engine/quickjs/qjs_utils.cpp", 61 ] 62 } 63 } else { 64 sources += [ 65 "$ace_root/frameworks/bridge/js_frontend/engine/quickjs/qjs_group_js_bridge.cpp", 66 "$ace_root/frameworks/bridge/js_frontend/engine/quickjs/qjs_utils.cpp", 67 ] 68 } 69 70 # if napi support 71 deps += [ "//foundation/arkui/napi:ace_napi_quickjs" ] 72 public_deps = [ "//foundation/arkui/napi:ace_napi" ] 73 } 74} 75 76foreach(item, ace_platforms) { 77 platform = item.name 78 engine_config = { 79 } 80 engine_config = item.config 81 support_engines = [] 82 support_engines = engine_config.js_engines 83 foreach(engine, support_engines) { 84 if (engine.engine_name == "qjs") { 85 declarative_js_engine_qjs("declarative_js_engine_bridge_qjs_$platform") { 86 defines = engine.engine_defines 87 config = { 88 } 89 90 if (defined(item.config)) { 91 config = item.config 92 } 93 if (defined(config.defines)) { 94 defines += config.defines 95 } 96 } 97 } 98 } 99} 100