1# Copyright (C) 2021–2023 Beijing OSWare Technology Co., Ltd 2# This file contains confidential and proprietary information of 3# OSWare Technology Co., Ltd 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16import("//build/ohos.gni") 17import("//device/board/${product_company}/${device_name}/device.gni") 18import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") 19import("//drivers/peripheral/camera/camera.gni") 20import("$hdf_framework_path/tools/hc-gen/hc_gen.gni") 21 22hc_gen("build_camera_host_config") { 23 sources = [ rebase_path( 24 "$product_config_path/hdf_config/uhdf/camera/hdi_impl/camera_host_config.hcs") ] 25} 26 27ohos_prebuilt_etc("camera_host_config.hcb") { 28 deps = [ ":build_camera_host_config" ] 29 hcs_outputs = get_target_outputs(":build_camera_host_config") 30 source = hcs_outputs[0] 31 relative_install_dir = "hdfconfig" 32 install_images = [ chipset_base_dir ] 33 subsystem_name = "osware_products" 34 part_name = "osware_products" 35} 36 37hc_gen_c("generate_source") { 38 sources = [ 39 "$product_config_path/hdf_config/uhdf/camera/pipeline_core/config.hcs", 40 "$product_config_path/hdf_config/uhdf/camera/pipeline_core/params.hcs", 41 ] 42} 43 44action("copy_source") { 45 script = "/usr/bin/env" 46 outputs = [ "$target_out_dir/tmp.c" ] # no use, just for gn complains 47 args = [ 48 "cp", 49 "-f", 50 ] 51 args += rebase_path(get_target_outputs(":generate_source")) 52 args += [ rebase_path( 53 "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/") ] 54 deps = [ ":generate_source" ] 55} 56 57ohos_prebuilt_etc("config.c") { 58 deps = [ ":copy_source" ] 59 source = 60 "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/config.c" 61 exec_script( 62 "/usr/bin/env", 63 [ 64 "touch", 65 rebase_path( 66 "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/config.c"), 67 ]) 68} 69 70ohos_prebuilt_etc("params.c") { 71 deps = [ ":copy_source" ] 72 source = 73 "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/params.c" 74 exec_script( 75 "/usr/bin/env", 76 [ 77 "touch", 78 rebase_path( 79 "$camera_path/pipeline_core/pipeline_impl/src/strategy/config/params.c"), 80 ]) 81} 82 83hc_gen("build_ipp_algo_config") { 84 sources = [ rebase_path( 85 "$product_config_path/hdf_config/uhdf/camera/pipeline_core/ipp_algo_config.hcs") ] 86} 87 88ohos_prebuilt_etc("ipp_algo_config.hcb") { 89 deps = [ ":build_ipp_algo_config" ] 90 hcs_outputs = get_target_outputs(":build_ipp_algo_config") 91 source = hcs_outputs[0] 92 relative_install_dir = "hdfconfig" 93 install_images = [ chipset_base_dir ] 94 subsystem_name = "osware_products" 95 part_name = "osware_products" 96} 97 98config("example_config") { 99 visibility = [ ":*" ] 100 101 cflags = [ 102 "-Wno-error", 103 "-Wno-unused-function", 104 "-Wno-unused-parameter", 105 ] 106} 107 108group("chipset_build") { 109 public_deps = [ 110 ":camera_host_config.hcb", 111 ":config.c", 112 ":ipp_algo_config.hcb", 113 ":params.c", 114 "$board_camera_path/pipeline_core:camera_ipp_algo_example", 115 ] 116} 117 118config("camhdi_impl_config") { 119 visibility = [ ":*" ] 120 cflags = [ 121 "-DGST_DISABLE_DEPRECATED", 122 "-DHAVE_CONFIG_H", 123 ] 124 125 ldflags = [ "-Wl" ] 126 127 if (enable_camera_device_utest) { 128 cflags += [ 129 "-fprofile-arcs", 130 "-ftest-coverage", 131 ] 132 133 ldflags += [ "--coverage" ] 134 } 135} 136 137host_sources = [ 138 "$camera_path/../v4l2/src/camera_device/camera_device_vdi_impl.cpp", 139 "$camera_path/../v4l2/src/camera_dump.cpp", 140 "$camera_path/../v4l2/src/camera_host/camera_host_config.cpp", 141 "$camera_path/../v4l2/src/camera_host/camera_host_vdi_impl.cpp", 142 "$camera_path/../v4l2/src/camera_host/hcs_deal.cpp", 143 "$camera_path/../v4l2/src/offline_stream_operator/offline_stream.cpp", 144 "$camera_path/../v4l2/src/offline_stream_operator/offline_stream_operator_vdi_impl.cpp", 145 "$camera_path/../v4l2/src/stream_operator/capture_message.cpp", 146 "$camera_path/../v4l2/src/stream_operator/capture_request.cpp", 147 "$camera_path/../v4l2/src/stream_operator/stream_base.cpp", 148 "$camera_path/../v4l2/src/stream_operator/stream_operator_vdi_impl.cpp", 149 "$camera_path/../v4l2/src/stream_operator/stream_post_view.cpp", 150 "$camera_path/../v4l2/src/stream_operator/stream_preview.cpp", 151 "$camera_path/../v4l2/src/stream_operator/stream_statistics.cpp", 152 "$camera_path/../v4l2/src/stream_operator/stream_still_capture.cpp", 153 "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard/stream_tunnel.cpp", 154 "$camera_path/../v4l2/src/stream_operator/stream_video.cpp", 155] 156 157host_includes = [ 158 "$camera_path/../../interfaces/include", 159 "$camera_path/include", 160 "$camera_path/metadata_manager/include", 161 "$camera_path/utils/watchdog", 162 "$camera_path/../interfaces", 163 "$camera_path/../v4l2/include", 164 "$camera_path/../v4l2/include/camera_host", 165 "$camera_path/../v4l2/include/camera_device", 166 "$camera_path/../v4l2/include/stream_operator", 167 "$camera_path/../v4l2/src/stream_operator/stream_tunnel/standard", 168 "$camera_path/../v4l2/include/offline_stream_operator", 169 "$camera_path/device_manager/include/", 170 "$camera_path/buffer_manager/src/buffer_adapter/standard", 171 "$camera_path/utils/event", 172 "$camera_path/../../display/interfaces/include", 173 174 #producer 175 "$camera_path/pipeline_core/utils", 176 "$camera_path/pipeline_core/include", 177 "$camera_path/pipeline_core/host_stream/include", 178 "$camera_path/pipeline_core/nodes/include", 179 "$camera_path/pipeline_core/nodes/src/node_base", 180 "$camera_path/pipeline_core/nodes/src/dummy_node", 181 "$camera_path/pipeline_core/pipeline_impl/include", 182 "$camera_path/pipeline_core/pipeline_impl/src", 183 "$camera_path/pipeline_core/pipeline_impl/src/builder", 184 "$camera_path/pipeline_core/pipeline_impl/src/dispatcher", 185 "$camera_path/pipeline_core/pipeline_impl/src/parser", 186 "$camera_path/pipeline_core/pipeline_impl/src/strategy", 187 "$camera_path/pipeline_core/ipp/include", 188] 189 190ohos_shared_library("camera_host_vdi_impl_1.0") { 191 sources = host_sources 192 include_dirs = host_includes 193 194 deps = [ 195 "$board_camera_path/device_manager:camera_device_manager", 196 "$board_camera_path/metadata_manager:camera_metadata_manager", 197 "$board_camera_path/pipeline_core:camera_pipeline_core", 198 "$camera_path/buffer_manager:camera_buffer_manager", 199 "$camera_path/utils:camera_utils", 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 "graphic_chipsetsdk:surface", 214 "hdf_core:libhdf_host", 215 "hdf_core:libhdf_ipc_adapter", 216 "hdf_core:libhdf_utils", 217 "hdf_core:libhdi", 218 "hilog:libhilog", 219 "ipc:ipc_single", 220 ] 221 if (use_hitrace) { 222 external_deps += [ "hitrace:libhitracechain" ] 223 } 224 } else { 225 external_deps = [ "hilog:libhilog" ] 226 } 227 external_deps += [ 228 "drivers_interface_camera:libbuffer_producer_sequenceable_1.0", 229 "drivers_interface_camera:metadata", 230 "hitrace:hitrace_meter", 231 "ipc:ipc_single", 232 ] 233 public_configs = [ ":camhdi_impl_config" ] 234 install_images = [ chipset_base_dir ] 235 subsystem_name = "osware_products" 236 part_name = "osware_products" 237} 238 239ohos_static_library("camera_host_vdi_impl_1.0_static") { 240 sources = host_sources 241 include_dirs = host_includes 242 243 deps = [ 244 "$board_camera_path/device_manager:camera_device_manager", 245 "$board_camera_path/metadata_manager:camera_metadata_manager", 246 "$board_camera_path/pipeline_core:camera_pipeline_core", 247 "$camera_path/buffer_manager:camera_buffer_manager", 248 "$camera_path/utils:camera_utils", 249 ] 250 251 defines = [] 252 if (enable_camera_device_utest) { 253 defines += [ "CAMERA_DEVICE_UTEST" ] 254 } 255 if (use_hitrace) { 256 defines += [ "HITRACE_LOG_ENABLED" ] 257 } 258 259 if (is_standard_system) { 260 external_deps = [ 261 "c_utils:utils", 262 "graphic_chipsetsdk:surface", 263 "hdf_core:libhdf_host", 264 "hdf_core:libhdf_ipc_adapter", 265 "hdf_core:libhdf_utils", 266 "hdf_core:libhdi", 267 "hilog:libhilog", 268 "hitrace:hitrace_meter", 269 "ipc:ipc_single", 270 ] 271 if (use_hitrace) { 272 external_deps += [ "hitrace:libhitracechain" ] 273 } 274 } else { 275 external_deps = [ "hilog:libhilog" ] 276 } 277 external_deps += [ 278 "drivers_interface_camera:libbuffer_producer_sequenceable_1.0", 279 "drivers_interface_camera:metadata", 280 "hitrace:hitrace_meter", 281 "ipc:ipc_single", 282 ] 283 284 public_configs = [ ":camhdi_impl_config" ] 285 subsystem_name = "osware_products" 286 part_name = "osware_products" 287} 288 289group("camera_board_test") { 290 if (target_cpu == "x86_64") { 291 deps = [] 292 } else { 293 testonly = true 294 deps = [ 295 #device manager test 296 "device_manager/test/unittest:camera_board_device_manager_unittest", 297 298 #driver adapter v4l2 test 299 "driver_adapter/test/main_test:v4l2_main", 300 301 #driver adapter v4l2 unittest 302 "driver_adapter/test/unittest:v4l2_adapter_unittest", 303 304 # pipeline core test 305 "pipeline_core/test/unittest:camera_pipeline_core_test_ut", 306 307 # demo test 308 "demo:ohos_camera_demo", 309 ] 310 } 311} 312