• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
13if (product_name == "rk3568_mini_system") {
14  group("camera_board_vdi_impl") {
15  }
16  group("camera_board_test") {
17  }
18} else {
19  import("//build/ohos.gni")
20  import("//device/board/${product_company}/${product_name}/device.gni")
21  import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
22  import("//drivers/peripheral/camera/camera.gni")
23  import("$hdf_framework_path/tools/hc-gen/hc_gen.gni")
24
25  hc_gen("build_camera_host_config") {
26    sources = [ rebase_path(
27            "$product_config_path/hdf_config/uhdf/camera/hdi_impl/camera_host_config.hcs") ]
28  }
29
30  ohos_prebuilt_etc("camera_host_config.hcb") {
31    deps = [ ":build_camera_host_config" ]
32    hcs_outputs = get_target_outputs(":build_camera_host_config")
33    source = hcs_outputs[0]
34    relative_install_dir = "hdfconfig"
35    install_images = [ chipset_base_dir ]
36    subsystem_name = "device_rk3588"
37    part_name = "device_rk3588"
38  }
39
40  hc_gen_c("generate_source") {
41    sources = [
42      "$product_config_path/hdf_config/uhdf/camera/pipeline_core/config.hcs",
43      "$product_config_path/hdf_config/uhdf/camera/pipeline_core/params.hcs",
44    ]
45  }
46
47  action("copy_source") {
48    script = "/usr/bin/env"
49    outputs = [ "$target_out_dir/tmp.c" ]  # no use, just for gn complains
50    args = [
51      "cp",
52      "-f",
53    ]
54    args += rebase_path(get_target_outputs(":generate_source"))
55    args += [ rebase_path(
56            "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/") ]
57    deps = [ ":generate_source" ]
58  }
59
60  ohos_prebuilt_etc("config.c") {
61    deps = [ ":copy_source" ]
62    source =
63        "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/config.c"
64    exec_script(
65        "/usr/bin/env",
66        [
67          "touch",
68          rebase_path(
69              "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/config.c"),
70        ])
71  }
72
73  ohos_prebuilt_etc("params.c") {
74    deps = [ ":copy_source" ]
75    source =
76        "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/params.c"
77    exec_script(
78        "/usr/bin/env",
79        [
80          "touch",
81          rebase_path(
82              "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/params.c"),
83        ])
84  }
85
86  hc_gen("build_ipp_algo_config") {
87    sources = [ rebase_path(
88            "$product_config_path/hdf_config/uhdf/camera/pipeline_core/ipp_algo_config.hcs") ]
89  }
90
91  ohos_prebuilt_etc("ipp_algo_config.hcb") {
92    deps = [ ":build_ipp_algo_config" ]
93    hcs_outputs = get_target_outputs(":build_ipp_algo_config")
94    source = hcs_outputs[0]
95    relative_install_dir = "hdfconfig"
96    install_images = [ chipset_base_dir ]
97    subsystem_name = "device_rk3588"
98    part_name = "device_rk3588"
99  }
100
101  config("example_config") {
102    visibility = [ ":*" ]
103
104    cflags = [
105      "-Wno-error",
106      "-Wno-unused-function",
107      "-Wno-unused-parameter",
108    ]
109  }
110
111  group("chipset_build") {
112    public_deps = [
113      ":camera_host_config.hcb",
114      ":config.c",
115      ":ipp_algo_config.hcb",
116      ":params.c",
117      "$board_camera_path/pipeline_core:camera_ipp_algo_example",
118    ]
119  }
120
121  config("camhdi_impl_config") {
122    visibility = [ ":*" ]
123    cflags = [
124      "-DGST_DISABLE_DEPRECATED",
125      "-DHAVE_CONFIG_H",
126    ]
127
128    ldflags = [ "-Wl" ]
129
130    if (enable_camera_device_utest) {
131      cflags += [
132        "-fprofile-arcs",
133        "-ftest-coverage",
134      ]
135
136      ldflags += [ "--coverage" ]
137    }
138  }
139
140  host_sources = [
141    "$camera_path/../v4l2/src/camera_device/camera_device_vdi_impl.cpp",
142    "$camera_path/../v4l2/src/camera_host/camera_host_config.cpp",
143    "$camera_path/../v4l2/src/camera_host/camera_host_vdi_impl.cpp",
144    "$camera_path/../v4l2/src/camera_host/hcs_deal.cpp",
145    "$camera_path/../v4l2/src/offline_stream_operator/offline_stream.cpp",
146    "$camera_path/../v4l2/src/offline_stream_operator/offline_stream_operator_vdi_impl.cpp",
147    "$camera_path/../v4l2/src/stream_operator/capture_message.cpp",
148    "$camera_path/../v4l2/src/stream_operator/capture_request.cpp",
149    "$camera_path/../v4l2/src/stream_operator/stream_base.cpp",
150    "$camera_path/../v4l2/src/stream_operator/stream_operator_vdi_impl.cpp",
151    "$camera_path/../v4l2/src/stream_operator/stream_post_view.cpp",
152    "$camera_path/../v4l2/src/stream_operator/stream_preview.cpp",
153    "$camera_path/../v4l2/src/stream_operator/stream_statistics.cpp",
154    "$camera_path/../v4l2/src/stream_operator/stream_still_capture.cpp",
155    "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard/stream_tunnel.cpp",
156    "$camera_path/../v4l2/src/stream_operator/stream_video.cpp",
157  ]
158
159  host_includes = [
160    "$camera_path/../../interfaces/include",
161    "$camera_path/include",
162    "$camera_path/metadata_manager/include",
163    "$camera_path/utils/watchdog",
164    "$camera_path/../interfaces",
165    "$camera_path/../v4l2/include",
166    "$camera_path/../v4l2/include/camera_host",
167    "$camera_path/../v4l2/include/camera_device",
168    "$camera_path/../v4l2/include/stream_operator",
169    "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard",
170    "$camera_path/../v4l2/include/offline_stream_operator",
171    "$camera_path/device_manager/include/",
172    "$camera_path/buffer_manager/src/buffer_adapter/standard",
173    "$camera_path/utils/event",
174    "$camera_path/../../display/interfaces/include",
175    "$camera_path/dump/include",
176
177    #producer
178    "$camera_path/pipeline_core/utils",
179    "$camera_path/pipeline_core/include",
180    "$camera_path/pipeline_core/host_stream/include",
181    "$camera_path/pipeline_core/nodes/include",
182    "$camera_path/pipeline_core/nodes/src/node_base",
183    "$camera_path/pipeline_core/nodes/src/dummy_node",
184    "$camera_path/pipeline_core/pipeline_impl/include",
185    "$camera_path/pipeline_core/pipeline_impl/src",
186    "$camera_path/pipeline_core/pipeline_impl/src/builder",
187    "$camera_path/pipeline_core/pipeline_impl/src/dispatcher",
188    "$camera_path/pipeline_core/pipeline_impl/src/parser",
189    "$camera_path/pipeline_core/pipeline_impl/src/strategy",
190    "$camera_path/pipeline_core/ipp/include",
191  ]
192
193  ohos_shared_library("camera_host_vdi_impl_1.0") {
194    sources = host_sources
195    include_dirs = host_includes
196
197    deps = [
198      "$board_camera_path/device_manager:camera_device_manager",
199      "$board_camera_path/pipeline_core:camera_pipeline_core",
200    ]
201
202    defines = []
203    if (enable_camera_device_utest) {
204      defines += [ "CAMERA_DEVICE_UTEST" ]
205    }
206    if (use_hitrace) {
207      defines += [ "HITRACE_LOG_ENABLED" ]
208    }
209    if (drivers_peripheral_camera_feature_usb) {
210      defines += [ "CAMERA_BUILT_ON_USB" ]
211    }
212
213    if (is_standard_system) {
214      external_deps = [
215        "c_utils:utils",
216        "drivers_peripheral_camera:peripheral_camera_buffer_manager",
217        "drivers_peripheral_camera:peripheral_camera_device_manager",
218        "drivers_peripheral_camera:peripheral_camera_metadata_manager",
219        "drivers_peripheral_camera:peripheral_camera_pipeline_core",
220        "drivers_peripheral_camera:peripheral_camera_utils",
221        "drivers_peripheral_camera:peripheral_camera_v4l2_adapter",
222        "graphic_surface:surface",
223        "hdf_core:libhdf_host",
224        "hdf_core:libhdf_ipc_adapter",
225        "hdf_core:libhdf_utils",
226        "hdf_core:libhdi",
227        "hilog:libhilog",
228        "hisysevent:libhisysevent",
229        "ipc:ipc_single",
230      ]
231      if (use_hitrace) {
232        external_deps += [ "hitrace:libhitracechain" ]
233      }
234    } else {
235      external_deps = [ "hilog:libhilog" ]
236    }
237    external_deps += [
238      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
239      "drivers_interface_camera:metadata",
240      "drivers_interface_display:libdisplay_composer_proxy_1.0",
241      "hitrace:hitrace_meter",
242      "ipc:ipc_single",
243    ]
244    public_configs = [ ":camhdi_impl_config" ]
245    install_images = [ chipset_base_dir ]
246    subsystem_name = "device_rk3588"
247    part_name = "device_rk3588"
248  }
249
250  ohos_static_library("camera_host_vdi_impl_1.0_static") {
251    sources = host_sources
252    include_dirs = host_includes
253
254    deps = [
255      "$board_camera_path/device_manager:camera_device_manager",
256      "$board_camera_path/pipeline_core:camera_pipeline_core",
257    ]
258
259    defines = []
260    if (enable_camera_device_utest) {
261      defines += [ "CAMERA_DEVICE_UTEST" ]
262    }
263    if (use_hitrace) {
264      defines += [ "HITRACE_LOG_ENABLED" ]
265    }
266    if (drivers_peripheral_camera_feature_usb) {
267      defines += [ "CAMERA_BUILT_ON_USB" ]
268    }
269
270    if (is_standard_system) {
271      external_deps = [
272        "c_utils:utils",
273        "drivers_peripheral_camera:peripheral_camera_buffer_manager",
274        "drivers_peripheral_camera:peripheral_camera_device_manager",
275        "drivers_peripheral_camera:peripheral_camera_metadata_manager",
276        "drivers_peripheral_camera:peripheral_camera_pipeline_core",
277        "drivers_peripheral_camera:peripheral_camera_utils",
278        "graphic_surface:surface",
279        "hdf_core:libhdf_host",
280        "hdf_core:libhdf_ipc_adapter",
281        "hdf_core:libhdf_utils",
282        "hdf_core:libhdi",
283        "hilog:libhilog",
284        "hisysevent:libhisysevent",
285        "hitrace:hitrace_meter",
286        "ipc:ipc_single",
287      ]
288      if (use_hitrace) {
289        external_deps += [ "hitrace:libhitracechain" ]
290      }
291    } else {
292      external_deps = [ "hilog:libhilog" ]
293    }
294    external_deps += [
295      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
296      "drivers_interface_camera:metadata",
297      "drivers_interface_display:libdisplay_composer_proxy_1.0",
298      "hitrace:hitrace_meter",
299      "ipc:ipc_single",
300    ]
301
302    public_configs = [ ":camhdi_impl_config" ]
303    subsystem_name = "device_rk3588"
304    part_name = "device_rk3588"
305  }
306
307  ohos_shared_library("camera_pipeline_config") {
308    sources = [
309      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/config.c",
310      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/params.c",
311    ]
312    include_dirs =
313        [ "$camera_path/pipeline_core/pipeline_impl/src/strategy/config" ]
314    install_images = [ chipset_base_dir ]
315    subsystem_name = "device_rk3588"
316    part_name = "device_rk3588"
317  }
318
319  group("camera_board_vdi_impl") {
320    deps = [
321      ":camera_host_vdi_impl_1.0",
322      ":camera_pipeline_config",
323      ":chipset_build",
324    ]
325  }
326
327  group("camera_board_test") {
328    if (target_cpu == "x86_64") {
329      deps = []
330    } else {
331      testonly = true
332      deps = [
333        #device manager test
334        #"device_manager/test/unittest:camera_board_device_manager_unittest",
335
336        #driver adapter v4l2 test
337        #"driver_adapter/test/v4l2_test:v4l2_main",
338
339        #driver adapter v4l2 unittest
340        #"driver_adapter/test/unittest:v4l2_adapter_unittest",
341
342        # pipeline core test
343        "pipeline_core/test/unittest:camera_pipeline_core_test_ut",
344
345        # demo test
346        #"demo:ohos_camera_demo",
347      ]
348    }
349  }
350}
351