1# Copyright (C) 2023 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/multimedia/media_library/media_library.gni")
16
17ohos_executable("mediatool") {
18  install_enable = true
19  include_dirs = []
20  sources = [ "src/main.cpp" ]
21  deps = []
22  defines = []
23  external_deps = []
24
25  include_dirs = [
26    "./include",
27    "../get_self_permissions/include",
28    "${MEDIALIB_ROOT_PATH}/frameworks/innerkitsimpl/media_library_helper/include",
29    "${MEDIALIB_ROOT_PATH}/frameworks/services/media_thumbnail/include",
30    "${MEDIALIB_ROOT_PATH}/frameworks/utils/include",
31    "${MEDIALIB_ROOT_PATH}/interfaces/innerkits/native/include",
32    "${MEDIALIB_ROOT_PATH}/interfaces/inner_api/media_library_helper/include",
33    "${MEDIALIB_ROOT_PATH}/interfaces/kits/js/include",
34  ]
35
36  sources += [
37    "../get_self_permissions/src/get_self_permissions.cpp",
38    "src/command/command.cpp",
39    "src/command/delete_command_v10.cpp",
40    "src/command/list_command_v10.cpp",
41    "src/command/query_command_v10.cpp",
42    "src/command/recv_command_v10.cpp",
43    "src/command/send_command_v10.cpp",
44    "src/command_line.cpp",
45    "src/control_main.cpp",
46    "src/exec_env.cpp",
47    "src/userfile_client_ex.cpp",
48    "src/utils/database_utils.cpp",
49  ]
50
51  defines += [ "MEDIALIBRARY_MEDIATOOL_START=1" ]
52
53  deps += [
54    "${MEDIALIB_INNERKITS_PATH}/media_library_helper:media_library",
55    "${MEDIALIB_INNERKITS_PATH}/medialibrary_data_extension:medialibrary_data_extension",
56    "${MEDIALIB_INTERFACES_PATH}/kits/js:medialibrary_nutils",
57  ]
58
59  external_deps += [
60    "ability_base:want",
61    "ability_base:zuri",
62    "ability_runtime:ability_manager",
63    "ability_runtime:abilitykit_native",
64    "ability_runtime:dataobs_manager",
65    "ability_runtime:napi_base_context",
66    "access_token:libaccesstoken_sdk",
67    "access_token:libnativetoken_shared",
68    "access_token:libtokensetproc_shared",
69    "c_utils:utils",
70    "data_share:datashare_common",
71    "data_share:datashare_consumer",
72    "data_share:datashare_provider",
73    "device_auth:deviceauth_sdk",
74    "hilog:libhilog",
75    "hitrace:hitrace_meter",
76    "init:libbegetutil",
77    "napi:ace_napi",
78    "samgr:samgr_proxy",
79  ]
80
81  ldflags = [ "-Wl,--gc-sections" ]
82
83  cflags = [
84    "-fdata-sections",
85    "-ffunction-sections",
86    "-Os",
87  ]
88
89  cflags_cc = [ "-Os" ]
90
91  if (!media_library_link_opt) {
92    sanitize = {
93      cfi = true
94      cfi_cross_dso = true
95      debug = false
96      integer_overflow = true
97      ubsan = true
98      boundary_sanitize = true
99      stack_protector_ret = true
100    }
101  }
102
103  subsystem_name = "multimedia"
104  part_name = "media_library"
105}
106