15bebb993Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.
25bebb993Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
35bebb993Sopenharmony_ci# you may not use this file except in compliance with the License.
45bebb993Sopenharmony_ci# You may obtain a copy of the License at
55bebb993Sopenharmony_ci#
65bebb993Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
75bebb993Sopenharmony_ci#
85bebb993Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
95bebb993Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
105bebb993Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
115bebb993Sopenharmony_ci# See the License for the specific language governing permissions and
125bebb993Sopenharmony_ci# limitations under the License.
135bebb993Sopenharmony_ci
145bebb993Sopenharmony_ciimport("//build/ohos.gni")
155bebb993Sopenharmony_ciimport("//foundation/filemanagement/file_api/file_api.gni")
165bebb993Sopenharmony_ci
175bebb993Sopenharmony_ciconfig("libn_public_config") {
185bebb993Sopenharmony_ci  visibility = [ ":*" ]
195bebb993Sopenharmony_ci
205bebb993Sopenharmony_ci  include_dirs = [
215bebb993Sopenharmony_ci    "include",
225bebb993Sopenharmony_ci    "include/n_async",
235bebb993Sopenharmony_ci    "${utils_path}/common/include",
245bebb993Sopenharmony_ci  ]
255bebb993Sopenharmony_ci}
265bebb993Sopenharmony_ci
275bebb993Sopenharmony_ciohos_shared_library("filemgmt_libn") {
285bebb993Sopenharmony_ci  cflags_cc = [ "-std=c++17" ]
295bebb993Sopenharmony_ci  if (!use_mingw_win && !use_mac) {
305bebb993Sopenharmony_ci    cflags = [
315bebb993Sopenharmony_ci      "-fdata-sections",
325bebb993Sopenharmony_ci      "-ffunction-sections",
335bebb993Sopenharmony_ci      "-Oz",
345bebb993Sopenharmony_ci    ]
355bebb993Sopenharmony_ci    cflags_cc += [
365bebb993Sopenharmony_ci      "-fvisibility-inlines-hidden",
375bebb993Sopenharmony_ci      "-Oz",
385bebb993Sopenharmony_ci    ]
395bebb993Sopenharmony_ci    branch_protector_ret = "pac_ret"
405bebb993Sopenharmony_ci    sanitize = {
415bebb993Sopenharmony_ci      integer_overflow = true
425bebb993Sopenharmony_ci      ubsan = true
435bebb993Sopenharmony_ci      boundary_sanitize = true
445bebb993Sopenharmony_ci      cfi = true
455bebb993Sopenharmony_ci      cfi_cross_dso = true
465bebb993Sopenharmony_ci      debug = false
475bebb993Sopenharmony_ci    }
485bebb993Sopenharmony_ci  }
495bebb993Sopenharmony_ci
505bebb993Sopenharmony_ci  sources = [
515bebb993Sopenharmony_ci    "src/n_async/n_async_work_callback.cpp",
525bebb993Sopenharmony_ci    "src/n_async/n_async_work_promise.cpp",
535bebb993Sopenharmony_ci    "src/n_async/n_ref.cpp",
545bebb993Sopenharmony_ci    "src/n_class.cpp",
555bebb993Sopenharmony_ci    "src/n_error.cpp",
565bebb993Sopenharmony_ci    "src/n_func_arg.cpp",
575bebb993Sopenharmony_ci    "src/n_val.cpp",
585bebb993Sopenharmony_ci  ]
595bebb993Sopenharmony_ci
605bebb993Sopenharmony_ci  if (use_mingw_win) {
615bebb993Sopenharmony_ci    defines = [ "WIN_PLATFORM" ]
625bebb993Sopenharmony_ci  }
635bebb993Sopenharmony_ci  if (use_mac) {
645bebb993Sopenharmony_ci    defines = [ "IOS_PLATFORM" ]
655bebb993Sopenharmony_ci  }
665bebb993Sopenharmony_ci
675bebb993Sopenharmony_ci  public_configs = [ ":libn_public_config" ]
685bebb993Sopenharmony_ci
695bebb993Sopenharmony_ci  deps = [ "${utils_path}/filemgmt_libhilog:filemgmt_libhilog" ]
705bebb993Sopenharmony_ci
715bebb993Sopenharmony_ci  external_deps = [
725bebb993Sopenharmony_ci    "hilog:libhilog",
735bebb993Sopenharmony_ci    "napi:ace_napi",
745bebb993Sopenharmony_ci  ]
755bebb993Sopenharmony_ci
765bebb993Sopenharmony_ci  use_exceptions = true
775bebb993Sopenharmony_ci
785bebb993Sopenharmony_ci  subsystem_name = "filemanagement"
795bebb993Sopenharmony_ci  innerapi_tags = [ "platformsdk" ]
805bebb993Sopenharmony_ci  part_name = "file_api"
815bebb993Sopenharmony_ci}
82