• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2025 - 2026 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
16ut_root_path = ".."
17
18if (defined(ohos_lite)) {
19  import("//build/lite/config/test.gni")
20  import("../../../../../hdf_core/adapter/uhdf/uhdf.gni")
21
22  config("camera_ut_test_config") {
23    visibility = [ ":*" ]
24    cflags_cc = [ "-std=c++17" ]
25    if (enable_camera_coverage) {
26      cflags_cc += [ "--coverage" ]
27      ldflags = [ "--coverage" ]
28    }
29  }
30
31  unittest("camera_utils_ut") {
32    output_extension = "bin"
33    output_dir = "$root_out_dir/test/unittest/hdf"
34    sources = [
35      # camera utils test
36      "$ut_root_path/utils/camera_utils_utest.cpp",
37    ]
38    include_dirs = [
39      # camera common includes
40      "$camera_path/include",
41    ]
42    deps = [ "$camera_path/utils:peripheral_camera_utils" ]
43    external_deps = [
44      "drivers_interface_camera:metadata",
45      "hdf_core:libhdf_utils",
46      "init:libbegetutil",
47    ]
48  }
49} else {
50  import("//build/test.gni")
51
52  module_output_path = "drivers_peripheral_camera/camera"
53
54  config("camera_ut_test_config") {
55    visibility = [ ":*" ]
56
57    cflags_cc = [
58      "-Wno-error",
59      "-std=c++17",
60    ]
61    if (enable_camera_coverage) {
62      ldflags = [ "--coverage" ]
63    }
64  }
65  ohos_unittest("camera_utils_ut") {
66    testonly = true
67    module_out_path = module_output_path
68    sources = [
69      # camera utils test
70      "$ut_root_path/utils/camera_utils_utest.cpp",
71    ]
72
73    include_dirs = [
74      # camera common includes
75      "$camera_path/include",
76    ]
77
78    deps = [ "$camera_path/utils:peripheral_camera_utils" ]
79
80    if (is_standard_system) {
81      external_deps = [
82        "c_utils:utils",
83        "drivers_interface_camera:metadata",
84        "googletest:gmock_main",
85        "googletest:gtest",
86        "googletest:gtest_main",
87        "hdf_core:libhdf_utils",
88        "hilog:libhilog",
89        "init:libbegetutil",
90      ]
91      public_configs = [ ":camera_ut_test_config" ]
92    }
93  }
94}
95