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