• 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_dump.cpp",
143    "$camera_path/../v4l2/src/camera_host/camera_host_config.cpp",
144    "$camera_path/../v4l2/src/camera_host/camera_host_vdi_impl.cpp",
145    "$camera_path/../v4l2/src/camera_host/hcs_deal.cpp",
146    "$camera_path/../v4l2/src/offline_stream_operator/offline_stream.cpp",
147    "$camera_path/../v4l2/src/offline_stream_operator/offline_stream_operator_vdi_impl.cpp",
148    "$camera_path/../v4l2/src/stream_operator/capture_message.cpp",
149    "$camera_path/../v4l2/src/stream_operator/capture_request.cpp",
150    "$camera_path/../v4l2/src/stream_operator/stream_base.cpp",
151    "$camera_path/../v4l2/src/stream_operator/stream_operator_vdi_impl.cpp",
152    "$camera_path/../v4l2/src/stream_operator/stream_post_view.cpp",
153    "$camera_path/../v4l2/src/stream_operator/stream_preview.cpp",
154    "$camera_path/../v4l2/src/stream_operator/stream_statistics.cpp",
155    "$camera_path/../v4l2/src/stream_operator/stream_still_capture.cpp",
156    "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard/stream_tunnel.cpp",
157    "$camera_path/../v4l2/src/stream_operator/stream_video.cpp",
158  ]
159
160  host_includes = [
161    "$camera_path/../../interfaces/include",
162    "$camera_path/include",
163    "$camera_path/metadata_manager/include",
164    "$camera_path/utils/watchdog",
165    "$camera_path/../interfaces",
166    "$camera_path/../v4l2/include",
167    "$camera_path/../v4l2/include/camera_host",
168    "$camera_path/../v4l2/include/camera_device",
169    "$camera_path/../v4l2/include/stream_operator",
170    "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard",
171    "$camera_path/../v4l2/include/offline_stream_operator",
172    "$camera_path/device_manager/include/",
173    "$camera_path/buffer_manager/src/buffer_adapter/standard",
174    "$camera_path/utils/event",
175    "$camera_path/../../display/interfaces/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
210    if (is_standard_system) {
211      external_deps = [
212        "c_utils:utils",
213        "drivers_peripheral_camera:peripheral_camera_buffer_manager",
214        "drivers_peripheral_camera:peripheral_camera_device_manager",
215        "drivers_peripheral_camera:peripheral_camera_metadata_manager",
216        "drivers_peripheral_camera:peripheral_camera_pipeline_core",
217        "drivers_peripheral_camera:peripheral_camera_utils",
218        "drivers_peripheral_camera:peripheral_camera_v4l2_adapter",
219        "graphic_surface:surface",
220        "hdf_core:libhdf_host",
221        "hdf_core:libhdf_ipc_adapter",
222        "hdf_core:libhdf_utils",
223        "hdf_core:libhdi",
224        "hilog:libhilog",
225        "ipc:ipc_single",
226      ]
227      if (use_hitrace) {
228        external_deps += [ "hitrace:libhitracechain" ]
229      }
230    } else {
231      external_deps = [ "hilog:libhilog" ]
232    }
233    external_deps += [
234      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
235      "drivers_interface_camera:metadata",
236      "drivers_interface_display:libdisplay_composer_proxy_1.0",
237      "hitrace:hitrace_meter",
238      "ipc:ipc_single",
239    ]
240    public_configs = [ ":camhdi_impl_config" ]
241    install_images = [ chipset_base_dir ]
242    subsystem_name = "device_rk3588"
243    part_name = "device_rk3588"
244  }
245
246  ohos_static_library("camera_host_vdi_impl_1.0_static") {
247    sources = host_sources
248    include_dirs = host_includes
249
250    deps = [
251      "$board_camera_path/device_manager:camera_device_manager",
252      "$board_camera_path/pipeline_core:camera_pipeline_core",
253    ]
254
255    defines = []
256    if (enable_camera_device_utest) {
257      defines += [ "CAMERA_DEVICE_UTEST" ]
258    }
259    if (use_hitrace) {
260      defines += [ "HITRACE_LOG_ENABLED" ]
261    }
262
263    if (is_standard_system) {
264      external_deps = [
265        "c_utils:utils",
266        "drivers_peripheral_camera:peripheral_camera_buffer_manager",
267        "drivers_peripheral_camera:peripheral_camera_device_manager",
268        "drivers_peripheral_camera:peripheral_camera_metadata_manager",
269        "drivers_peripheral_camera:peripheral_camera_pipeline_core",
270        "drivers_peripheral_camera:peripheral_camera_utils",
271        "graphic_surface:surface",
272        "hdf_core:libhdf_host",
273        "hdf_core:libhdf_ipc_adapter",
274        "hdf_core:libhdf_utils",
275        "hdf_core:libhdi",
276        "hilog:libhilog",
277        "hitrace:hitrace_meter",
278        "ipc:ipc_single",
279      ]
280      if (use_hitrace) {
281        external_deps += [ "hitrace:libhitracechain" ]
282      }
283    } else {
284      external_deps = [ "hilog:libhilog" ]
285    }
286    external_deps += [
287      "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
288      "drivers_interface_camera:metadata",
289      "drivers_interface_display:libdisplay_composer_proxy_1.0",
290      "hitrace:hitrace_meter",
291      "ipc:ipc_single",
292    ]
293
294    public_configs = [ ":camhdi_impl_config" ]
295    subsystem_name = "device_rk3588"
296    part_name = "device_rk3588"
297  }
298
299  ohos_shared_library("camera_pipeline_config") {
300    sources = [
301      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/config.c",
302      "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/params.c",
303    ]
304    include_dirs =
305        [ "$camera_path/pipeline_core/pipeline_impl/src/strategy/config" ]
306    install_images = [ chipset_base_dir ]
307    subsystem_name = "device_rk3588"
308    part_name = "device_rk3588"
309  }
310
311  group("camera_board_vdi_impl") {
312    deps = [
313      ":camera_host_vdi_impl_1.0",
314      ":camera_pipeline_config",
315      ":chipset_build",
316    ]
317  }
318
319  group("camera_board_test") {
320    if (target_cpu == "x86_64") {
321      deps = []
322    } else {
323      testonly = true
324      deps = [
325        #device manager test
326        #"device_manager/test/unittest:camera_board_device_manager_unittest",
327
328        #driver adapter v4l2 test
329        #"driver_adapter/test/v4l2_test:v4l2_main",
330
331        #driver adapter v4l2 unittest
332        #"driver_adapter/test/unittest:v4l2_adapter_unittest",
333
334        # pipeline core test
335        "pipeline_core/test/unittest:camera_pipeline_core_test_ut",
336
337        # demo test
338        #"demo:ohos_camera_demo",
339      ]
340    }
341  }
342}
343