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.
13
14import("../../../camera.gni")
15
16import("//build/ohos.gni")
17import("//build/test.gni")
18import("../../../../../hdf_core/adapter/uhdf2/uhdf.gni")
19
20module_output_path = "drivers_peripheral_camera/drivers_peripheral_camera"
21
22config("camhdi_host_config") {
23  visibility = [ ":*" ]
24  cflags_cc = [
25    "-DGST_DISABLE_DEPRECATED",
26    "-DHAVE_CONFIG_H",
27    "-DCOLORSPACE=\"videoconvert\"",
28  ]
29}
30
31ohos_fuzztest("camera_host_fuzztest") {
32  testonly = true
33  module_out_path = module_output_path
34  fuzz_config_file = "$camera_path/../../test/fuzztest/camera_host"
35  sources = [
36    "$camera_common_path/v1_0/src/hdi_common.cpp",
37    "$camera_common_path/v1_1/src/hdi_common_v1_1.cpp",
38    "$camera_common_path/v1_2/src/hdi_common_v1_2.cpp",
39    "$camera_common_path/v1_3/src/hdi_common_v1_3.cpp",
40    "./camera_host_fuzzer.cpp",
41  ]
42
43  include_dirs = [
44    # common includes
45    "$camera_common_path/v1_0/include",
46    "$camera_common_path/v1_1/include",
47    "$camera_common_path/v1_2/include",
48    "$camera_common_path/v1_3/include",
49    "$camera_test_path/v1_2/include",
50    "$camera_path/../../../display/interfaces/include",
51    "$camera_path/../../../display/hdi_service/gralloc/include",
52    "$camera_path/../../interfaces/include",
53    "$camera_path/include",
54  ]
55
56  cflags = [
57    "-g",
58    "-O0",
59    "-Wno-unused-variable",
60    "-fno-omit-frame-pointer",
61  ]
62
63  if (is_standard_system) {
64    external_deps = [
65      "c_utils:utils",
66      "hdf_core:libhdf_host",
67      "hdf_core:libhdf_ipc_adapter",
68      "hdf_core:libhdf_utils",
69      "hdf_core:libhdi",
70      "hilog:libhilog",
71      "ipc:ipc_single",
72    ]
73  } else {
74    external_deps = [ "hilog:libhilog" ]
75  }
76
77  external_deps += [
78    "drivers_interface_camera:libbuffer_producer_sequenceable_1.0",
79    "drivers_interface_camera:libcamera_proxy_1.2",
80    "drivers_interface_camera:libcamera_proxy_1.3",
81    "drivers_interface_camera:metadata",
82    "graphic_surface:surface",
83    "samgr:samgr_proxy",
84  ]
85  public_configs = [ ":camhdi_host_config" ]
86}
87
88group("fuzztest") {
89  testonly = true
90  deps = []
91  deps += [
92    # dep file
93    ":camera_host_fuzztest",
94  ]
95}
96