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}/${device_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 = "rockchip_products" 37 part_name = "rockchip_products" 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 = "rockchip_products" 98 part_name = "rockchip_products" 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 "ipc:ipc_single", 229 ] 230 if (use_hitrace) { 231 external_deps += [ "hitrace:libhitracechain" ] 232 } 233 } else { 234 external_deps = [ "hilog:libhilog" ] 235 } 236 external_deps += [ 237 "drivers_interface_camera:libbuffer_producer_sequenceable_1.0", 238 "drivers_interface_camera:metadata", 239 "drivers_interface_display:libdisplay_composer_proxy_1.0", 240 "hitrace:hitrace_meter", 241 "ipc:ipc_single", 242 ] 243 public_configs = [ ":camhdi_impl_config" ] 244 install_images = [ chipset_base_dir ] 245 subsystem_name = "rockchip_products" 246 part_name = "rockchip_products" 247 } 248 249 ohos_static_library("camera_host_vdi_impl_1.0_static") { 250 sources = host_sources 251 include_dirs = host_includes 252 253 deps = [ 254 "$board_camera_path/device_manager:camera_device_manager", 255 "$board_camera_path/pipeline_core:camera_pipeline_core", 256 ] 257 258 defines = [] 259 if (enable_camera_device_utest) { 260 defines += [ "CAMERA_DEVICE_UTEST" ] 261 } 262 if (use_hitrace) { 263 defines += [ "HITRACE_LOG_ENABLED" ] 264 } 265 if (drivers_peripheral_camera_feature_usb) { 266 defines += [ "CAMERA_BUILT_ON_USB" ] 267 } 268 269 if (is_standard_system) { 270 external_deps = [ 271 "c_utils:utils", 272 "drivers_peripheral_camera:peripheral_camera_buffer_manager", 273 "drivers_peripheral_camera:peripheral_camera_device_manager", 274 "drivers_peripheral_camera:peripheral_camera_metadata_manager", 275 "drivers_peripheral_camera:peripheral_camera_pipeline_core", 276 "drivers_peripheral_camera:peripheral_camera_utils", 277 "graphic_surface:surface", 278 "hdf_core:libhdf_host", 279 "hdf_core:libhdf_ipc_adapter", 280 "hdf_core:libhdf_utils", 281 "hdf_core:libhdi", 282 "hilog:libhilog", 283 "hitrace:hitrace_meter", 284 "ipc:ipc_single", 285 ] 286 if (use_hitrace) { 287 external_deps += [ "hitrace:libhitracechain" ] 288 } 289 } else { 290 external_deps = [ "hilog:libhilog" ] 291 } 292 external_deps += [ 293 "drivers_interface_camera:libbuffer_producer_sequenceable_1.0", 294 "drivers_interface_camera:metadata", 295 "drivers_interface_display:libdisplay_composer_proxy_1.0", 296 "hitrace:hitrace_meter", 297 "ipc:ipc_single", 298 ] 299 300 public_configs = [ ":camhdi_impl_config" ] 301 subsystem_name = "rockchip_products" 302 part_name = "rockchip_products" 303 } 304 305 ohos_shared_library("camera_pipeline_config") { 306 sources = [ 307 "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/config.c", 308 "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/params.c", 309 ] 310 include_dirs = 311 [ "$camera_path/pipeline_core/pipeline_impl/src/strategy/config" ] 312 install_images = [ chipset_base_dir ] 313 subsystem_name = "rockchip_products" 314 part_name = "rockchip_products" 315 } 316 317 group("camera_board_vdi_impl") { 318 deps = [ 319 ":camera_host_vdi_impl_1.0", 320 ":camera_pipeline_config", 321 ":chipset_build", 322 ] 323 } 324 325 group("camera_board_test") { 326 if (target_cpu == "x86_64") { 327 deps = [] 328 } else { 329 testonly = true 330 deps = [ 331 #device manager test 332 #"device_manager/test/unittest:camera_board_device_manager_unittest", 333 334 #driver adapter v4l2 test 335 #"driver_adapter/test/v4l2_test:v4l2_main", 336 337 #driver adapter v4l2 unittest 338 #"driver_adapter/test/unittest:v4l2_adapter_unittest", 339 340 # pipeline core test 341 "pipeline_core/test/unittest:camera_pipeline_core_test_ut", 342 343 # demo test 344 #"demo:ohos_camera_demo", 345 ] 346 } 347 } 348} 349