1# Copyright (C) 2022 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/test.gni") 15import("//foundation/multimedia/media_library/media_library.gni") 16 17ohos_executable("scanner") { 18 install_enable = true 19 20 include_dirs = [] 21 sources = [ "./src/medialibrary_scan.cpp" ] 22 deps = [] 23 defines = [] 24 25 if (build_variant == "root") { 26 include_dirs += [ 27 "./include", 28 "../get_self_permissions/include", 29 "${MEDIALIB_INTERFACES_PATH}/innerkits/native/include", 30 "${MEDIALIB_INNERKITS_PATH}/media_library_helper/include", 31 "${MEDIALIB_SERVICES_PATH}/media_library/include", 32 ] 33 34 sources += [ "../get_self_permissions/src/get_self_permissions.cpp" ] 35 deps += [ "${MEDIALIB_INNERKITS_PATH}/medialibrary_data_extension:medialibrary_data_extension" ] 36 defines += [ "MEDIALIBRARY_SCANNER_START=1" ] 37 38 external_deps = [ 39 "ability_base:zuri", 40 "ability_runtime:abilitykit_native", 41 "access_token:libaccesstoken_sdk", 42 "access_token:libnativetoken_shared", 43 "access_token:libtokensetproc_shared", 44 "c_utils:utils", 45 "common_event_service:cesfwk_innerkits", 46 "data_share:datashare_consumer", 47 "hilog:libhilog", 48 "hitrace:hitrace_meter", 49 "ipc:ipc_single", 50 "relational_store:native_appdatafwk", 51 "samgr:samgr_proxy", 52 ] 53 54 ldflags = [ "-Wl,--gc-sections" ] 55 56 cflags = [ 57 "-fdata-sections", 58 "-ffunction-sections", 59 "-Os", 60 ] 61 62 cflags_cc = [ "-Os" ] 63 } 64 65 if (!media_library_link_opt) { 66 sanitize = { 67 cfi = true 68 cfi_cross_dso = true 69 debug = false 70 integer_overflow = true 71 ubsan = true 72 boundary_sanitize = true 73 stack_protector_ret = true 74 } 75 } 76 77 subsystem_name = "multimedia" 78 part_name = "media_library" 79} 80