1# Copyright (c) 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("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni") 15import("//build/ohos.gni") 16import("//foundation/arkui/ace_engine/ace_config.gni") 17import("//foundation/arkui/ace_engine/adapter/preview/build/config.gni") 18import("//foundation/arkui/ace_engine/build/ace_gen_obj.gni") 19 20es2abc_gen_abc("gen_measure_abc") { 21 src_js = rebase_path("measure.js") 22 dst_file = rebase_path(target_out_dir + "/measure.abc") 23 in_puts = [ "measure.js" ] 24 out_puts = [ target_out_dir + "/measure.abc" ] 25 extra_args = [ "--module" ] 26} 27 28base_output_path = get_label_info(":gen_measure_abc", "target_out_dir") 29measure_obj_path = base_output_path + "/measure.o" 30measure_abc_obj_path = base_output_path + "/measure_abc.o" 31 32gen_obj("measure_js") { 33 input = "measure.js" 34 if (use_mac || use_mingw_win || use_linux || target_os == "ios") { 35 measure_obj_path = base_output_path + "/measure.c" 36 } 37 output = measure_obj_path 38 snapshot_dep = [] 39} 40 41gen_obj("measure_abc") { 42 input = get_label_info(":gen_measure_abc", "target_out_dir") + "/measure.abc" 43 if (use_mac || use_mingw_win || use_linux || target_os == "ios") { 44 measure_abc_obj_path = base_output_path + "/measure_abc.c" 45 } 46 output = measure_abc_obj_path 47 snapshot_dep = [ ":gen_measure_abc" ] 48} 49 50template("napi_measure_static") { 51 forward_variables_from(invoker, "*") 52 53 ohos_source_set(target_name) { 54 defines += invoker.defines 55 cflags_cc += invoker.cflags_cc 56 configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ] 57 58 sources = [ "js_measure.cpp" ] 59 deps = [ 60 ":gen_obj_src_measure_abc", 61 ":gen_obj_src_measure_js", 62 ] 63 external_deps = [] 64 if (platform != "" && is_arkui_x) { 65 deps += [ "//plugins/libs/napi:napi_$platform" ] 66 } else { 67 external_deps += [ "napi:ace_napi" ] 68 } 69 deps += [ "../utils:napi_utils_static_${platform}" ] 70 71 if (defined(config.libace_target)) { 72 deps += [ config.libace_target ] 73 } 74 75 subsystem_name = "arkui" 76 part_name = ace_engine_part 77 } 78} 79 80foreach(item, ace_platforms) { 81 napi_measure_static("measure_static_" + item.name) { 82 defines = [] 83 cflags_cc = [] 84 config = { 85 } 86 platform = item.name 87 88 if (defined(item.config)) { 89 config = item.config 90 } 91 92 if (defined(config.defines)) { 93 defines = config.defines 94 } 95 96 if (defined(config.cflags_cc)) { 97 cflags_cc = config.cflags_cc 98 } 99 } 100} 101