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("//build/ohos.gni") 15import("//foundation/filemanagement/file_api/file_api.gni") 16 17config("libn_public_config") { 18 visibility = [ ":*" ] 19 20 include_dirs = [ 21 "include", 22 "include/n_async", 23 "${utils_path}/common/include", 24 ] 25} 26 27ohos_shared_library("filemgmt_libn") { 28 cflags_cc = [ "-std=c++17" ] 29 if (!use_mingw_win && !use_mac) { 30 cflags = [ 31 "-fdata-sections", 32 "-ffunction-sections", 33 "-Oz", 34 ] 35 cflags_cc += [ 36 "-fvisibility-inlines-hidden", 37 "-Oz", 38 ] 39 branch_protector_ret = "pac_ret" 40 sanitize = { 41 integer_overflow = true 42 ubsan = true 43 boundary_sanitize = true 44 cfi = true 45 cfi_cross_dso = true 46 debug = false 47 } 48 } 49 50 sources = [ 51 "src/n_async/n_async_work_callback.cpp", 52 "src/n_async/n_async_work_promise.cpp", 53 "src/n_async/n_ref.cpp", 54 "src/n_class.cpp", 55 "src/n_error.cpp", 56 "src/n_func_arg.cpp", 57 "src/n_val.cpp", 58 ] 59 60 if (use_mingw_win) { 61 defines = [ "WIN_PLATFORM" ] 62 } 63 if (use_mac) { 64 defines = [ "IOS_PLATFORM" ] 65 } 66 67 public_configs = [ ":libn_public_config" ] 68 69 deps = [ "${utils_path}/filemgmt_libhilog:filemgmt_libhilog" ] 70 71 external_deps = [ 72 "hilog:libhilog", 73 "napi:ace_napi", 74 ] 75 76 use_exceptions = true 77 78 subsystem_name = "filemanagement" 79 innerapi_tags = [ "platformsdk" ] 80 part_name = "file_api" 81} 82