• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
14 import("//build/ohos.gni")
15 import("//foundation/ace/ace_engine/ace_config.gni")
16 
17 template("js_engine_ark") {
18   forward_variables_from(invoker, "*")
19 
20   ohos_source_set(target_name) {
21     defines += invoker.defines
22 
23     configs = [
24       "$ace_root:ace_config",
25       "$ark_runtime_path/libpandabase:arkbase_public_config",
26       "//ark/js_runtime:ark_jsruntime_public_config",
27     ]
28 
29     sources = [
30       "ark_js_runtime.cpp",
31       "ark_js_value.cpp",
32       "jsi_animation_bridge.cpp",
33       "jsi_animator_bridge.cpp",
34       "jsi_badge_bridge.cpp",
35       "jsi_base_utils.cpp",
36       "jsi_canvas_bridge.cpp",
37       "jsi_chart_bridge.cpp",
38       "jsi_clock_bridge.cpp",
39       "jsi_component_api_bridge.cpp",
40       "jsi_engine.cpp",
41       "jsi_engine_loader.cpp",
42       "jsi_group_js_bridge.cpp",
43       "jsi_image_animator_bridge.cpp",
44       "jsi_input_bridge.cpp",
45       "jsi_list_bridge.cpp",
46       "jsi_offscreen_canvas_bridge.cpp",
47       "jsi_stepper_bridge.cpp",
48       "jsi_utils.cpp",
49     ]
50 
51     # xcomponent components supports phone, TV and wearable except PC Preview
52     if (defined(config.xcomponent_components_support) &&
53         config.xcomponent_components_support) {
54       sources += [ "jsi_xcomponent_bridge.cpp" ]
55     }
56 
57     deps = [ "//third_party/jsframework:ark_build" ]
58     if (target_cpu == "arm64") {
59       defines += [ "APP_USE_ARM64" ]
60     } else if (target_cpu == "arm") {
61       defines += [ "APP_USE_ARM" ]
62     }
63     deps += [
64       "//ark/js_runtime:libark_jsruntime",
65       "//foundation/ace/napi:ace_napi_ark",
66     ]
67     external_deps = [
68       "multimedia_image_standard:image",
69       "multimedia_image_standard:image_native",
70       "napi:ace_napi",
71     ]
72   }
73 }
74 
75 foreach(item, ace_platforms) {
76   platform = item.name
77   engine_config = {
78   }
79   engine_config = item.config
80   support_engines = []
81   support_engines = engine_config.js_engines
82   foreach(engine, support_engines) {
83     if (engine.engine_name == "ark") {
84       js_engine_ark("js_engine_bridge_ark_$platform") {
85         defines = engine.engine_defines
86         config = {
87         }
88 
89         if (defined(item.config)) {
90           config = item.config
91         }
92         if (defined(config.defines)) {
93           defines += config.defines
94         }
95       }
96     }
97   }
98 }
99