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 45if (!is_arkui_x) { 46 common_napi_libs += [ "arkui/container_utils" ] 47} 48 49template("ace_napi_lib") { 50 forward_variables_from(invoker, "*") 51 52 target_names = string_split(target_name, "/") 53 prefix_dir = target_names[0] 54 55 module_path = prefix_dir 56 install_dir = "" 57 if (prefix_dir != target_name) { 58 module_path = target_names[1] 59 install_dir = "/" + prefix_dir 60 } 61 62 module_name = string_replace(module_path, "_", "") 63 64 ohos_shared_library(module_name) { 65 if (current_os == "ohos") { 66 sanitize = { 67 integer_overflow = true 68 boundary_sanitize = true 69 debug = ace_sanitize_debug 70 } 71 } 72 deps = [ "$ace_root/interfaces/napi/kits/${module_path}:${module_name}_static_${platform}" ] 73 cflags = [] 74 ldflags = [] 75 sources = [] 76 defines = [] 77 include_dirs = [] 78 if (ace_engine_feature_enable_coverage) { 79 cflags += [ "--coverage" ] 80 ldflags += [ "--coverage" ] 81 } 82 if (use_hilog) { 83 external_deps = [ "hilog:libhilog" ] 84 } 85 relative_install_dir = "module" + install_dir 86 part_name = ace_engine_part 87 subsystem_name = ace_engine_subsystem 88 } 89} 90