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 "${MEDIALIB_TEST_PATH}/unittest/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 "${MEDIALIB_TEST_PATH}/unittest/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/ls_command.cpp", 42 "src/command/query_command_v10.cpp", 43 "src/command/recv_command_v10.cpp", 44 "src/command/send_command_v10.cpp", 45 "src/command_line.cpp", 46 "src/control_main.cpp", 47 "src/exec_env.cpp", 48 "src/userfile_client_ex.cpp", 49 "src/utils/database_utils.cpp", 50 "src/utils/mediatool_command_utils.cpp", 51 ] 52 53 defines += [ "MEDIALIBRARY_MEDIATOOL_START=1" ] 54 55 deps += [ 56 "${MEDIALIB_INNERKITS_PATH}/media_library_helper:media_library", 57 "${MEDIALIB_INNERKITS_PATH}/medialibrary_data_extension:medialibrary_data_extension", 58 "${MEDIALIB_INTERFACES_PATH}/kits/js:medialibrary_nutils", 59 ] 60 61 external_deps += [ 62 "ability_base:want", 63 "ability_base:zuri", 64 "ability_runtime:ability_manager", 65 "ability_runtime:abilitykit_native", 66 "ability_runtime:dataobs_manager", 67 "ability_runtime:napi_base_context", 68 "access_token:libaccesstoken_sdk", 69 "access_token:libnativetoken_shared", 70 "access_token:libtokensetproc_shared", 71 "c_utils:utils", 72 "data_share:datashare_common", 73 "data_share:datashare_consumer", 74 "data_share:datashare_provider", 75 "hilog:libhilog", 76 "hitrace:hitrace_meter", 77 "init:libbegetutil", 78 "ipc:ipc_napi", 79 "ipc:ipc_single", 80 "napi:ace_napi", 81 "samgr:samgr_proxy", 82 ] 83 84 ldflags = [ "-Wl,--gc-sections" ] 85 86 cflags = [ 87 "-fdata-sections", 88 "-ffunction-sections", 89 "-Os", 90 ] 91 92 cflags_cc = [ "-Os" ] 93 94 if (!media_library_link_opt) { 95 sanitize = { 96 cfi = true 97 cfi_cross_dso = true 98 debug = false 99 integer_overflow = true 100 ubsan = true 101 boundary_sanitize = true 102 stack_protector_ret = true 103 } 104 } 105 106 subsystem_name = "multimedia" 107 part_name = "media_library" 108} 109