• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 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("//drivers/peripheral/camera/hal/camera.gni")
15
16if (defined(ohos_lite)) {
17  import("//build/lite/config/test.gni")
18  import("//drivers/hdf_core/adapter/uhdf/uhdf.gni")
19
20  config("mpi_device_config") {
21    visibility = [ ":*" ]
22    cflags_cc = [
23      "-DGST_DISABLE_DEPRECATED",
24      "-DHAVE_CONFIG_H",
25      "-DCOLORSPACE=\"videoconvert\"",
26    ]
27    cflags_cc += [ "-std=c++17" ]
28  }
29
30  unittest("camera_hal_device_manager_unittest") {
31    output_extension = "bin"
32    output_dir = "$root_out_dir/test/unittest/hdf"
33    sources = [ "unittest/mpi/utest_mpi_device_manager.cpp" ]
34    include_dirs = [
35      "$camera_path/device_manager",
36      "$camera_path/device_manager/include",
37      "$camera_path/device_manager/include/mpi",
38      "$camera_path/device_manager/src",
39      "$camera_path/device_manager/src/mpi",
40      "$board_camera_path/driver_adapter/include",
41      "//base/hiviewdfx/interfaces/innerkits/libhilog/include",
42      "$camera_path/include",
43      "$camera_path/device_manager/test/unittest/mpi",
44      "$camera_path/utils/event",
45      "//drivers/hdf_core/adapter/uhdf2/osal/include",
46      "$board_camera_path/device_manager/include",
47      "$camera_path/adapter/platform/mpp/src/device_manager/include",
48      "//drivers/peripheral/camera/interfaces/metadata/include",
49      "//drivers/hdf_core/framework/include/config",
50      "//drivers/hdf_core/framework/include/osal",
51      "//drivers/hdf_core/framework/include/utils",
52    ]
53
54    hispark_taurus_lib_path = "//device/soc/hisilicon/common/hal/media/camera/hi3516dv300/liteos_a/libs/"
55    outdir = rebase_path("$hispark_taurus_lib_path")
56    ldflags = [ "-L$outdir" ]
57    ldflags += [ "-ldriver_adapter" ]
58    deps = [
59      "$camera_path/device_manager:camera_device_manager",
60      "$hdf_uhdf_path/utils:libhdf_utils",
61      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
62      "//drivers/peripheral/camera/interfaces/metadata:metadata",
63    ]
64  }
65} else {
66  import("//build/test.gni")
67  import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
68  need_link_hispark_taurus_lib = true
69  if (need_link_hispark_taurus_lib) {
70    if (use_musl) {
71      hispark_taurus_lib_path = "//device/soc/hisilicon/common/hal/media/camera/hi3516dv300/linux_standard/libs/"
72    } else {
73      hispark_taurus_lib_path = "//device/soc/hisilicon/common/hal/media/camera/hi3516dv300/linux_standard/libs/std"
74    }
75  }
76  module_output_path = "hdf/camera"
77  config("mpi_device_config") {
78    visibility = [ ":*" ]
79    cflags_cc = [
80      "-DGST_DISABLE_DEPRECATED",
81      "-DHAVE_CONFIG_H",
82      "-DCOLORSPACE=\"videoconvert\"",
83    ]
84  }
85  ohos_unittest("camera_hal_device_manager_unittest") {
86    testonly = true
87    module_out_path = module_output_path
88    sources = [ "unittest/mpi/utest_mpi_device_manager.cpp" ]
89    include_dirs = [
90      "$camera_path/device_manager",
91      "$camera_path/device_manager/include",
92      "$camera_path/device_manager/include/mpi",
93      "$camera_path/device_manager/src",
94      "$camera_path/device_manager/src/mpi",
95      "$board_camera_path/driver_adapter/include",
96      "$camera_path/include",
97      "$camera_path/device_manager/test/unittest/mpi",
98      "$camera_path/utils/event",
99      "$camera_path/adapter/platform/mpp/src/device_manager/include",
100      "$board_camera_path/device_manager/include",
101      "//drivers/peripheral/camera/interfaces/metadata/include",
102    ]
103    if (need_link_hispark_taurus_lib) {
104      outdir = rebase_path("$hispark_taurus_lib_path")
105      ldflags = [ "-L$outdir" ]
106      ldflags += [ "-ldriver_adapter.z" ]
107    }
108    deps = [
109      "$camera_path/device_manager:camera_device_manager",
110      "//drivers/peripheral/camera/interfaces/metadata:metadata",
111      "//third_party/googletest:gmock_main",
112      "//third_party/googletest:gtest_main",
113    ]
114    if (is_standard_system) {
115      external_deps = [
116        "c_utils:utils",
117        "hdf_core:libhdf_utils",
118        "hiviewdfx_hilog_native:libhilog",
119      ]
120    } else {
121      external_deps = [ "hilog:libhilog" ]
122    }
123    public_configs = [ ":mpi_device_config" ]
124  }
125}
126