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("../../vibrator.gni")
15
16HDF_CORE_PATH = "../../../../hdf_core"
17if (defined(ohos_lite)) {
18  import("//build/lite/config/component/lite_component.gni")
19  import("//build/lite/config/test.gni")
20} else {
21  import("//build/ohos.gni")
22  import("//build/test.gni")
23  import("$HDF_CORE_PATH/adapter/uhdf2/uhdf.gni")
24}
25
26if (defined(ohos_lite)) {
27  unittest("hdf_peripheral_test_vibrator") {
28    output_extension = "bin"
29    output_dir = "$root_out_dir/test/unittest/hdf"
30    include_dirs = [
31      "//third_party/bounds_checking_function/include",
32      "../../interfaces/include",
33    ]
34
35    sources = [ "common/hdf_vibrator_test.cpp" ]
36    cflags = [
37      "-Wall",
38      "-Wextra",
39      "-Werror",
40      "-fsigned-char",
41      "-fno-common",
42      "-fno-strict-aliasing",
43    ]
44    public_deps = [
45      "$HDF_CORE_PATH/adapter/build/test_common:libhdf_test_common",
46      "$HDF_CORE_PATH/adapter/uhdf/manager:hdf_core",
47      "$HDF_CORE_PATH/adapter/uhdf/posix:hdf_posix_osal",
48      "../../hal:hdi_vibrator",
49      "//third_party/bounds_checking_function:libsec_shared",
50    ]
51    external_deps = [ "hilog_lite:hilog_shared" ]
52  }
53} else {
54  module_output_path = "hdf/vibrator"
55  ohos_unittest("hdf_unittest_vibrator") {
56    module_out_path = module_output_path
57    include_dirs = []
58
59    sources = [ "common/hdf_vibrator_test.cpp" ]
60    cflags = [
61      "-Wall",
62      "-Wextra",
63      "-Werror",
64      "-fsigned-char",
65      "-fno-common",
66      "-fno-strict-aliasing",
67    ]
68    deps = [ "../../hal:hdi_vibrator" ]
69    if (is_standard_system) {
70      external_deps = [
71        "hdf_core:libhdf_utils",
72        "hilog:libhilog",
73      ]
74      if (c_utils_enable) {
75        external_deps += [ "c_utils:utils" ]
76      }
77    } else {
78      external_deps = [ "hilog:libhilog" ]
79    }
80  }
81}
82