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