1# Copyright (c) 2023 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/config/components/ets_frontend/es2abc_config.gni") 15import("//build/ohos.gni") 16import("//foundation/arkui/ace_engine/ace_config.gni") 17import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni") 18 19es2abc_gen_abc("gen_chip_abc") { 20 src_js = rebase_path("chip.js") 21 dst_file = rebase_path(target_out_dir + "/chip.abc") 22 in_puts = [ "chip.js" ] 23 out_puts = [ target_out_dir + "/chip.abc" ] 24 extra_args = [ "--module" ] 25} 26 27es2abc_gen_abc("gen_chip_v16_abc") { 28 src_js = rebase_path("chip_v16.js") 29 dst_file = rebase_path(target_out_dir + "/chip_v16.abc") 30 in_puts = [ "chip_v16.js" ] 31 out_puts = [ target_out_dir + "/chip_v16.abc" ] 32 extra_args = [ "--module" ] 33} 34 35gen_js_obj("chip_abc") { 36 input = get_label_info(":gen_chip_abc", "target_out_dir") + "/chip.abc" 37 output = target_out_dir + "/chip_abc.o" 38 dep = ":gen_chip_abc" 39} 40 41gen_js_obj("chip_v16_abc") { 42 input = 43 get_label_info(":gen_chip_v16_abc", "target_out_dir") + "/chip_v16.abc" 44 output = target_out_dir + "/chip_v16_abc.o" 45 dep = ":gen_chip_v16_abc" 46} 47 48gen_obj("chip_abc_preview") { 49 input = get_label_info(":gen_chip_abc", "target_out_dir") + "/chip.abc" 50 output = target_out_dir + "/chip_abc.c" 51 snapshot_dep = [ ":gen_chip_abc" ] 52} 53 54gen_obj("chip_v16_abc_preview") { 55 input = 56 get_label_info(":gen_chip_v16_abc", "target_out_dir") + "/chip_v16.abc" 57 output = target_out_dir + "/chip_v16_abc.c" 58 snapshot_dep = [ ":gen_chip_v16_abc" ] 59} 60 61template("chip_static") { 62 forward_variables_from(invoker, "*") 63 64 ohos_source_set(target_name) { 65 defines += invoker.defines 66 cflags_cc += invoker.cflags_cc 67 configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ] 68 69 sources = [ "chip.cpp" ] 70 deps = 71 [ "$ace_root/interfaces/napi/kits/utils:napi_utils_static_${platform}" ] 72 external_deps = [] 73 74 if (platform != "" && is_arkui_x) { 75 deps += [ "//plugins/libs/napi:napi_$platform" ] 76 include_dirs = [ "//commonlibrary/c_utils/base/include" ] 77 } else { 78 external_deps += [ "napi:ace_napi" ] 79 } 80 81 if (defined(config.libace_target)) { 82 deps += [ config.libace_target ] 83 } 84 85 if (use_mingw_win || use_mac || use_linux) { 86 deps += [ 87 ":gen_obj_src_chip_abc_preview", 88 ":gen_obj_src_chip_v16_abc_preview", 89 ] 90 } else { 91 deps += [ 92 ":chip_abc", 93 ":chip_v16_abc", 94 ] 95 } 96 97 subsystem_name = ace_engine_subsystem 98 part_name = ace_engine_part 99 } 100} 101 102foreach(item, ace_platforms) { 103 chip_static("chip_static_" + item.name) { 104 defines = [] 105 cflags_cc = [] 106 config = { 107 } 108 platform = item.name 109 110 if (defined(item.config)) { 111 config = item.config 112 } 113 114 if (defined(config.defines)) { 115 defines = config.defines 116 } 117 118 if (defined(config.cflags_cc)) { 119 cflags_cc = config.cflags_cc 120 } 121 } 122} 123