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#
14
15import("//build/ohos.gni")
16import("../sensor.gni")
17
18if (defined(ohos_lite)) {
19  config("libhdi_sensor_pub_config") {
20    visibility = [ ":*" ]
21  }
22
23  ohos_shared_library("hdi_sensor") {
24    output_extension = "z.so"
25    public_configs = [ ":libhdi_sensor_pub_config" ]
26    sources = [
27      "src/sensor_channel.c",
28      "src/sensor_controller.c",
29      "src/sensor_manager.c",
30    ]
31
32    include_dirs = [
33      "include",
34      "../interfaces/include",
35      "../utils/include",
36    ]
37
38    external_deps = [
39      "hdf_core:libhdf_utils",
40      "hilog_lite:hilog_shared",
41    ]
42    cflags = [
43      "-Wall",
44      "-Wextra",
45      "-Werror",
46      "-fsigned-char",
47      "-fno-common",
48      "-fno-strict-aliasing",
49    ]
50    if (ohos_build_compiler != "clang") {
51      cflags += [
52        "-Wno-format",
53        "-Wno-format-extra-args",
54      ]
55    }
56    subsystem_name = "hdf"
57    part_name = "drivers_peripheral_sensor"
58  }
59} else {
60  config("libhdi_sensor_pub_config") {
61    visibility = [ ":*" ]
62
63    include_dirs = [ "../interfaces/include" ]
64  }
65
66  ohos_shared_library("hdi_sensor") {
67    public_configs = [ ":libhdi_sensor_pub_config" ]
68    sources = [
69      "src/sensor_channel.c",
70      "src/sensor_controller.c",
71      "src/sensor_dump.c",
72      "src/sensor_manager.c",
73    ]
74
75    include_dirs = [
76      "include",
77      " ../interfaces/include",
78      "../utils/include",
79    ]
80    defines = [ "__OHOS__USER__" ]
81    cflags = [
82      "-Wall",
83      "-Wextra",
84      "-Werror",
85      "-fsigned-char",
86      "-fno-common",
87      "-fno-strict-aliasing",
88    ]
89    install_images = [ chipset_base_dir ]
90    subsystem_name = "hdf"
91    part_name = "drivers_peripheral_sensor"
92    if (is_standard_system) {
93      external_deps = [
94        "hdf_core:libhdf_host",
95        "hdf_core:libhdf_utils",
96        "hilog:libhilog",
97      ]
98      if (c_utils_enable) {
99        external_deps += [ "c_utils:utils" ]
100      }
101    } else {
102      external_deps = [ "hilog:libhilog" ]
103    }
104  }
105}
106