1# Copyright (c) 2022-2024 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 17common_napi_libs = [ 18 # napi .so needs to be all lower case 19 "arkui/componentutils", 20 "arkui/component_snapshot", 21 "arkui/drag_controller", 22 "arkui/focus_controller", 23 "arkui/inspector", 24 "arkui/observer", 25 "arkui/performancemonitor", 26 "configuration", 27 "device", 28 "font", 29 "grid", 30 "measure", 31 "mediaquery", 32 "overlay", 33 "prompt", 34 "promptaction", 35 "router", 36 "animator", 37 "atomic_service_bar", 38 "graphics/display_sync", 39] 40 41if (is_arkui_x) { 42 common_napi_libs += [ "arkui/drawabledescriptor" ] 43} 44 45template("ace_napi_lib") { 46 forward_variables_from(invoker, "*") 47 48 target_names = string_split(target_name, "/") 49 prefix_dir = target_names[0] 50 51 module_path = prefix_dir 52 install_dir = "" 53 if (prefix_dir != target_name) { 54 module_path = target_names[1] 55 install_dir = "/" + prefix_dir 56 } 57 58 module_name = string_replace(module_path, "_", "") 59 60 ohos_shared_library(module_name) { 61 if (current_os == "ohos") { 62 sanitize = { 63 integer_overflow = true 64 boundary_sanitize = true 65 debug = ace_sanitize_debug 66 } 67 } 68 deps = [ "$ace_root/interfaces/napi/kits/${module_path}:${module_name}_static_${platform}" ] 69 cflags = [] 70 ldflags = [] 71 sources = [] 72 defines = [] 73 include_dirs = [] 74 if (ace_engine_feature_enable_coverage) { 75 cflags += [ "--coverage" ] 76 ldflags += [ "--coverage" ] 77 } 78 if (use_hilog) { 79 external_deps = [ "hilog:libhilog" ] 80 } 81 relative_install_dir = "module" + install_dir 82 part_name = ace_engine_part 83 subsystem_name = ace_engine_subsystem 84 } 85} 86