1# Copyright (c) 2021 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") 16import("//foundation/arkui/ace_engine/build/ace_controller.gni") 17import("napi_lib.gni") 18 19config("ace_napi_config") { 20 include_dirs = [ 21 "$ace_root", 22 "$arkui_root", 23 "$ace_root/frameworks", 24 "$root_out_dir/arkui", 25 "$root_out_dir/arkui/framework", 26 "//third_party/zlib", 27 ] 28 cflags_cc = [] 29 defines = [] 30 if (use_mingw_win) { 31 cflags_cc += [ "-std=c++17" ] 32 defines += [ "_USE_MATH_DEFINES" ] 33 } 34 35 if (use_linux) { 36 cflags_cc += [ "-std=c++17" ] 37 defines += [ "_USE_MATH_DEFINES" ] 38 } 39 40 if (use_hilog) { 41 include_dirs += [ "$hilog_root/interfaces/native/innerkits/include" ] 42 defines += [ "USE_HILOG" ] 43 } 44 45 if (is_mac) { 46 cflags_cc = [ "-O0" ] 47 } 48} 49 50common_targets = [] 51foreach(module, common_napi_libs) { 52 if (use_mac) { 53 ace_napi_lib(module) { 54 platform = "mac" 55 } 56 } else if (use_mingw_win) { 57 ace_napi_lib(module) { 58 platform = "windows" 59 } 60 } else if (use_linux) { 61 ace_napi_lib(module) { 62 platform = "linux" 63 } 64 } else if (!is_arkui_x) { 65 ace_napi_lib(module) { 66 # napi libs remain isolate in libace.z.so and asan version 67 if (is_asan || !ace_engine_feature_enable_libace) { 68 platform = "ohos" 69 } else { 70 platform = "ohos_ng" 71 } 72 } 73 } 74 75 module_path_names = [] 76 module_path_names = string_split(module, "/") 77 prefix_dir = module_path_names[0] 78 79 module_path = prefix_dir 80 if (prefix_dir != module) { 81 module_path = module_path_names[1] 82 } 83 84 module_name = string_replace(module_path, "_", "") 85 common_targets += [ ":$module_name" ] 86} 87 88group("napi_group") { 89 if (use_mac || use_mingw_win || use_linux) { 90 public_deps = common_targets 91 } else { 92 deps = common_targets 93 deps += [ 94 "$ace_root/interfaces/napi/kits/drawabledescriptor:drawabledescriptor", 95 "$ace_root/interfaces/napi/kits/plugincomponent:plugincomponent", 96 ] 97 } 98} 99