1# Copyright (C) 2023-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/filemanagement/dfs_service/distributedfile.gni")
16
17config("optimize-size") {
18  cflags = [
19    "-fdata-sections",
20    "-ffunction-sections",
21    "-Oz",
22  ]
23  cflags_cc = [
24    "-fvisibility-inlines-hidden",
25    "-Oz",
26  ]
27}
28
29ohos_shared_library("cloudfiledaemon") {
30  branch_protector_ret = "pac_ret"
31  configs = [ ":optimize-size" ]
32  sanitize = {
33    integer_overflow = true
34    ubsan = true
35    boundary_sanitize = true
36    cfi = true
37    cfi_cross_dso = true
38    debug = false
39  }
40  cloud_disk = [
41    "src/cloud_disk/database_manager.cpp",
42    "src/cloud_disk/file_operations_base.cpp",
43    "src/cloud_disk/file_operations_cloud.cpp",
44    "src/cloud_disk/file_operations_helper.cpp",
45    "src/cloud_disk/file_operations_local.cpp",
46    "src/cloud_disk/fuse_operations.cpp",
47    "src/cloud_disk/account_status.cpp",
48    "src/cloud_disk/account_status_listener.cpp",
49  ]
50
51  sources = [
52    "src/fuse_manager/cloud_daemon_statistic.cpp",
53    "src/fuse_manager/fuse_manager.cpp",
54    "src/ipc/cloud_daemon.cpp",
55    "src/ipc/cloud_daemon_stub.cpp",
56  ]
57
58  sources += cloud_disk
59
60  configs += [ "${utils_path}:compiler_configs" ]
61
62  defines = [ "LOG_TAG=\"CloudFileDaemon\"" ]
63
64  include_dirs = [
65    "include",
66    "${utils_path}/cloud_disk/include",
67    "${utils_path}/dentry/include",
68    "${utils_path}/log/include",
69    "${utils_path}/system/include",
70    "${innerkits_native_path}/cloud_daemon_kit_inner",
71    "${innerkits_native_path}/cloud_file_kit_inner/big_data_statistics",
72    "${services_path}/cloudfiledaemon/include/cloud_disk/",
73    "${services_path}/cloudfiledaemon/include/fuse_manager/",
74    "${services_path}/cloudfiledaemon/include/ipc/",
75    "${services_path}/cloudsyncservice/include/data_sync/",
76    "${clouddisk_database_path}/include",
77  ]
78
79  deps = [
80    "${clouddisk_database_path}:clouddisk_database",
81    "${innerkits_native_path}/cloud_file_kit_inner:cloudfile_kit_core",
82    "${utils_path}:libdistributedfileutils_lite",
83  ]
84
85  external_deps = [
86    "ability_base:want",
87    "ability_runtime:dataobs_manager",
88    "c_utils:utils",
89    "common_event_service:cesfwk_innerkits",
90    "ffrt:libffrt",
91    "hilog:libhilog",
92    "hisysevent:libhisysevent",
93    "hitrace:hitrace_meter",
94    "init:libbegetutil",
95    "ipc:ipc_single",
96    "libfuse:libfuse",
97    "relational_store:native_rdb",
98    "safwk:system_ability_fwk",
99    "samgr:samgr_proxy",
100  ]
101
102  if (cloudsync_service_hicollie_enable) {
103    external_deps += [ "hicollie:libhicollie" ]
104    defines += [ "HICOLLIE_ENABLE" ]
105  }
106
107  use_exceptions = true
108  part_name = "dfs_service"
109  subsystem_name = "filemanagement"
110}
111