1# Copyright (C) 2021-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("//commonlibrary/memory_utils/purgeable_mem_config.gni")
16import("//foundation/multimedia/media_library/media_library.gni")
17
18config("media_library_manager_config") {
19  include_dirs =
20      [ "${MEDIALIB_INTERFACES_PATH}/inner_api/media_library_helper/include" ]
21}
22
23ohos_shared_library("media_library_manager") {
24  install_enable = true
25
26  sources = [
27    "./media_library_manager.cpp",
28    "./src/media_library_tab_old_photos_client.cpp",
29  ]
30
31  include_dirs = [
32    "./include",
33    "${MEDIALIB_UTILS_PATH}/include",
34    "${MEDIALIB_INNERKITS_PATH}/media_library_helper/include",
35    "${MEDIALIB_INTERFACES_PATH}/kits/js/include",
36    "${MEDIALIB_SERVICES_PATH}/media_thumbnail/include",
37    "${MEDIALIB_INNERKITS_PATH}/medialibrary_data_extension/include",
38  ]
39
40  public_configs = [ ":media_library_manager_config" ]
41
42  deps = [ "${MEDIALIB_INNERKITS_PATH}/media_library_helper:media_library" ]
43
44  external_deps = [
45    "ability_base:want",
46    "ability_base:zuri",
47    "ability_runtime:ability_manager",
48    "ability_runtime:abilitykit_native",
49    "access_token:libaccesstoken_sdk",
50    "access_token:libprivacy_sdk",
51    "access_token:libtokenid_sdk",
52    "app_file_service:fileuri_native",
53    "bundle_framework:appexecfwk_base",
54    "bundle_framework:appexecfwk_core",
55    "c_utils:utils",
56    "common_event_service:cesfwk_innerkits",
57    "data_share:datashare_common",
58    "data_share:datashare_consumer",
59    "hilog:libhilog",
60    "hitrace:hitrace_meter",
61    "image_framework:image_native",
62    "kv_store:distributeddata_inner",
63    "relational_store:rdb_data_share_adapter",
64    "samgr:samgr_proxy",
65  ]
66
67  ldflags = [ "-Wl,--gc-sections" ]
68
69  cflags = [
70    "-fdata-sections",
71    "-ffunction-sections",
72    "-Os",
73  ]
74
75  cflags_cc = [ "-Os" ]
76
77  if (!media_library_link_opt) {
78    sanitize = {
79      cfi = true
80      cfi_cross_dso = true
81      debug = false
82      integer_overflow = true
83      ubsan = true
84      boundary_sanitize = true
85      stack_protector_ret = true
86    }
87  }
88
89  defines = []
90  defines += [ "MEDIALIBRARY_COMPATIBILITY=1" ]
91
92  if (memory_utils_purgeable_ashmem_enable && defined(global_parts_info) &&
93      defined(global_parts_info.resourceschedule_memmgr_override)) {
94    defines += [ "IMAGE_PURGEABLE_PIXELMAP" ]
95    external_deps += [
96      "memmgr:libpurgeablemem_plugin",
97      "memmgr:purgeable_pixelmap_builder",
98    ]
99  }
100
101  part_name = "media_library"
102  subsystem_name = "multimedia"
103}
104