1# Copyright (c) 2021 - 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("../../../camera.gni")
15
16if (defined(ohos_lite)) {
17  import("//build/ohos.gni")
18  config("buffer_manager_config") {
19    visibility = [ ":*" ]
20    cflags = [
21      "-DGST_DISABLE_DEPRECATED",
22      "-DHAVE_CONFIG_H",
23    ]
24
25    cflags_cc = [ "-std=c++17" ]
26    ldflags = [ "-Wl" ]
27    ldflags += [ "--coverage" ]
28
29    include_dirs = [ "./include" ]
30  }
31
32  ohos_shared_library("peripheral_camera_buffer_manager") {
33    sources = [
34      "./src/buffer_adapter/lite/buffer_adapter.cpp",
35      "./src/buffer_allocator.cpp",
36      "./src/buffer_allocator_factory.cpp",
37      "./src/buffer_allocator_utils.cpp",
38      "./src/buffer_loop_tracking.cpp",
39      "./src/buffer_manager.cpp",
40      "./src/buffer_pool.cpp",
41      "./src/buffer_tracking.cpp",
42      "./src/heap_buffer_allocator/heap_buffer_allocator.cpp",
43      "./src/image_buffer.cpp",
44    ]
45
46    include_dirs = [
47      "./include",
48      "$camera_path/include",
49      "./src/buffer_adapter/lite",
50      "$camera_path/../../display/interfaces/include",
51      "$camera_path/../../base",
52      "$camera_path/../../interfaces/include",
53    ]
54
55    libs = []
56    defines = []
57    external_deps = [
58      "drivers_peripheral_display:hdi_display",
59      "graphic_surface:surface",
60      "hdf_core:libhdf_utils",
61      "hilog_lite:hilog_shared",
62    ]
63
64    public_configs = [ ":buffer_manager_config" ]
65    subsystem_name = "hdf"
66    part_name = "drivers_peripheral_camera"
67  }
68} else {
69  import("//build/ohos.gni")
70  config("buffer_manager_config") {
71    visibility = [ ":*" ]
72
73    cflags = [
74      "-DGST_DISABLE_DEPRECATED",
75      "-DHAVE_CONFIG_H",
76    ]
77
78    ldflags = [ "-Wl" ]
79
80    if (enable_camera_device_utest) {
81      cflags += [
82        "-fprofile-arcs",
83        "-ftest-coverage",
84      ]
85
86      ldflags += [ "--coverage" ]
87    }
88
89    include_dirs = [ "./include" ]
90  }
91
92  ohos_shared_library("peripheral_camera_buffer_manager") {
93    sources = [
94      "./src/buffer_adapter/standard/buffer_adapter.cpp",
95      "./src/buffer_allocator.cpp",
96      "./src/buffer_allocator_factory.cpp",
97      "./src/buffer_allocator_utils.cpp",
98      "./src/buffer_loop_tracking.cpp",
99      "./src/buffer_manager.cpp",
100      "./src/buffer_pool.cpp",
101      "./src/buffer_tracking.cpp",
102      "./src/heap_buffer_allocator/heap_buffer_allocator.cpp",
103      "./src/image_buffer.cpp",
104    ]
105
106    include_dirs = [
107      "./src/buffer_adapter/standard",
108      "$camera_path/include",
109      "$camera_path/../../interfaces/include",
110      "$camera_path/utils/event",
111    ]
112
113    libs = []
114
115    defines = []
116
117    if (enable_camera_device_utest) {
118      defines += [ "CAMERA_DEVICE_UTEST" ]
119    }
120    deps = [ "$camera_path/utils:peripheral_camera_utils" ]
121    if (is_standard_system) {
122      external_deps = [
123        "c_utils:utils",
124        "graphic_surface:surface",
125        "hdf_core:libhdf_utils",
126        "hilog:libhilog",
127      ]
128    } else {
129      external_deps = [ "hilog:libhilog" ]
130    }
131    external_deps += [ "drivers_interface_camera:metadata" ]
132    public_configs = [ ":buffer_manager_config" ]
133    install_images = [ chipset_base_dir ]
134    subsystem_name = "hdf"
135    part_name = "drivers_peripheral_camera"
136  }
137}
138