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("../../camera.gni")
15
16if (defined(ohos_lite)) {
17  import("//build/ohos.gni")
18  import("../../../../hdf_core/adapter/uhdf/uhdf.gni")
19
20  config("camhdi_impl_config") {
21    visibility = [ ":*" ]
22    cflags = [
23      "-DGST_DISABLE_DEPRECATED",
24      "-DHAVE_CONFIG_H",
25    ]
26
27    cflags_cc = [ "-std=c++17" ]
28    ldflags = [ "-Wl" ]
29
30    ldflags += [ "--coverage" ]
31  }
32
33  ohos_shared_library("camera_host_service_1.0") {
34    output_extension = "z.so"
35    sources = [
36      "./src/camera_device_service.cpp",
37      "./src/camera_host_service.cpp",
38      "./src/offline_stream_operator_service.cpp",
39      "./src/stream_operator_service.cpp",
40    ]
41
42    include_dirs = [
43      "$camera_path/../../interfaces/include",
44      "$camera_path/../../interfaces/hdi_passthrough",
45      "$camera_path/include",
46      "$camera_path/utils/watchdog",
47      "$camera_path/../interfaces",
48      "./include",
49    ]
50
51    deps = [ "$camera_path/utils:peripheral_camera_utils" ]
52    external_deps = [
53      "drivers_interface_camera:metadata",
54      "graphic_surface:surface",
55      "hdf_core:libhdf_utils",
56      "hilog_lite:hilog_shared",
57    ]
58    public_configs = [ ":camhdi_impl_config" ]
59    subsystem_name = "hdf"
60    part_name = "drivers_peripheral_camera"
61  }
62} else {
63  import("//build/ohos.gni")
64
65  config("camhdi_impl_config") {
66    visibility = [ ":*" ]
67    cflags = [
68      "-DGST_DISABLE_DEPRECATED",
69      "-DHAVE_CONFIG_H",
70    ]
71
72    ldflags = [ "-Wl" ]
73
74    if (enable_camera_device_utest) {
75      cflags += [
76        "-fprofile-arcs",
77        "-ftest-coverage",
78      ]
79
80      ldflags += [ "--coverage" ]
81    }
82  }
83
84  host_sources = [
85    "$camera_path/../../interfaces/hdi_ipc/camera_host_driver.cpp",
86    "./src/camera_device_service.cpp",
87    "./src/camera_device_service_callback.cpp",
88    "./src/camera_host_service.cpp",
89    "./src/camera_host_service_callback.cpp",
90    "./src/camera_service_type_converter.cpp",
91    "./src/offline_stream_operator_service.cpp",
92    "./src/stream_operator_service.cpp",
93    "./src/stream_operator_service_callback.cpp",
94  ]
95
96  host_includes = [
97    "$camera_path/../../interfaces/include",
98    "$camera_path/../../interfaces/hdi_ipc",
99    "$camera_path/../../interfaces/hdi_ipc/utils/include",
100    "$camera_path/../../interfaces/hdi_ipc/callback/host/include",
101    "$camera_path/../../interfaces/hdi_ipc/callback/device/include",
102    "$camera_path/../../interfaces/hdi_ipc/callback/operator/include",
103    "$camera_path/include",
104    "$camera_path/utils/watchdog",
105    "$camera_path/../interfaces",
106    "./include",
107  ]
108
109  ohos_shared_library("camera_host_service_1.0") {
110    sources = host_sources
111    include_dirs = host_includes
112
113    deps = [ "$camera_path/utils:peripheral_camera_utils" ]
114
115    defines = []
116    if (enable_camera_device_utest) {
117      defines += [ "CAMERA_DEVICE_UTEST" ]
118    }
119    if (use_hitrace) {
120      defines += [ "HITRACE_LOG_ENABLED" ]
121    }
122    if (drivers_peripheral_camera_feature_usb) {
123      defines += [ "CHIP_PROD_CAMERA_HOST_CONFIG" ]
124    }
125
126    if (is_standard_system) {
127      external_deps = [
128        "c_utils:utils",
129        "graphic_surface:surface",
130        "hdf_core:libhdf_host",
131        "hdf_core:libhdf_ipc_adapter",
132        "hdf_core:libhdf_utils",
133        "hdf_core:libhdi",
134        "hilog:libhilog",
135        "ipc:ipc_single",
136      ]
137    } else {
138      external_deps = [ "hilog:libhilog" ]
139    }
140
141    if (use_hitrace) {
142      external_deps += [ "hitrace:hitrace_meter" ]
143    }
144
145    external_deps += [
146      "drivers_interface_camera:libcamera_stub_1.0",
147      "drivers_interface_camera:metadata",
148      "ipc:ipc_single",
149    ]
150    shlib_type = "hdi"
151    public_configs = [ ":camhdi_impl_config" ]
152    install_images = [ chipset_base_dir ]
153    subsystem_name = "hdf"
154    part_name = "drivers_peripheral_camera"
155  }
156
157  ohos_static_library("camera_host_service_1.0_static") {
158    sources = host_sources
159    include_dirs = host_includes
160
161    deps = [ "$camera_path/utils:peripheral_camera_utils" ]
162
163    defines = []
164    if (enable_camera_device_utest) {
165      defines += [ "CAMERA_DEVICE_UTEST" ]
166    }
167    if (use_hitrace) {
168      defines += [ "HITRACE_LOG_ENABLED" ]
169    }
170
171    if (is_standard_system) {
172      external_deps = [
173        "c_utils:utils",
174        "graphic_surface:surface",
175        "hdf_core:libhdf_host",
176        "hdf_core:libhdf_ipc_adapter",
177        "hdf_core:libhdf_utils",
178        "hdf_core:libhdi",
179        "hilog:libhilog",
180        "ipc:ipc_single",
181      ]
182    } else {
183      external_deps = [ "hilog:libhilog" ]
184    }
185
186    if (use_hitrace) {
187      external_deps += [ "hitrace:hitrace_meter" ]
188    }
189
190    external_deps += [
191      "drivers_interface_camera:libcamera_stub_1.0",
192      "drivers_interface_camera:metadata",
193      "ipc:ipc_single",
194    ]
195
196    public_configs = [ ":camhdi_impl_config" ]
197    subsystem_name = "hdf"
198    part_name = "drivers_peripheral_camera"
199  }
200}
201