1# Copyright (c) 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/storage_service/storage_service_aafwk.gni")
16
17ohos_executable("mtpfs") {
18  branch_protector_ret = "pac_ret"
19
20  sanitize = {
21    integer_overflow = true
22    ubsan = true
23    boundary_sanitize = true
24    cfi = true
25    cfi_cross_dso = true
26    debug = false
27  }
28
29  include_dirs = [
30    "./include",
31    "${storage_daemon_path}/include/utils",
32    "${storage_service_common_path}/include",
33  ]
34
35  defines = [
36    "STORAGE_LOG_TAG = \"StorageDaemon\"",
37    "LOG_DOMAIN = 0xD004301",
38  ]
39
40  cflags = [
41    "-w",
42    "-DFUSE_USE_VERSION=31",
43    "-D_FILE_OFFSET_BITS=64",
44    "-std=c++11",
45  ]
46
47  deps = [ "${storage_daemon_path}:storage_common_utils" ]
48
49  external_deps = [
50    "c_utils:utils",
51    "hilog:libhilog",
52  ]
53
54  if (support_open_source_libmtp) {
55    sources = [
56      "./src/mtpfs_fuse.cpp",
57      "./src/mtpfs_libmtp.cpp",
58      "./src/mtpfs_main.cpp",
59      "./src/mtpfs_mtp_device.cpp",
60      "./src/mtpfs_sha.cpp",
61      "./src/mtpfs_tmp_files_pool.cpp",
62      "./src/mtpfs_type_dir.cpp",
63      "./src/mtpfs_type_file.cpp",
64      "./src/mtpfs_type_tmp_file.cpp",
65      "./src/mtpfs_util.cpp",
66    ]
67    external_deps += [
68      "libfuse:libfuse",
69      "libmtp:libmtp",
70      "libusb:libusb",
71    ]
72  } else {
73    sources = [ "./src/mtpfs_main_virtual.cpp" ]
74  }
75
76  subsystem_name = "filemanagement"
77  part_name = "storage_service"
78  install_enable = true
79}
80