1# Copyright (c) 2020 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
14config("samgr_adapter_public") {
15  include_dirs = [
16    "./",
17    "//commonlibrary/utils_lite/include",
18    "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr",
19  ]
20}
21
22if (ohos_kernel_type == "liteos_m" || ohos_kernel_type == "uniproton") {
23  static_library("samgr_adapter") {
24    sources = [
25      "cmsis/memory_adapter.c",
26      "cmsis/queue_adapter.c",
27      "cmsis/thread_adapter.c",
28      "cmsis/time_adapter.c",
29    ]
30
31    public_configs = [ ":samgr_adapter_public" ]
32
33    if (ohos_kernel_type == "liteos_m") {
34      include_dirs = [
35        "//kernel/liteos_m/kal/",
36        "//kernel/liteos_m/kal/cmsis",
37      ]
38    }
39  }
40}
41
42if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") {
43  source_set("samgr_adapter") {
44    sources = [
45      "posix/lock_free_queue.c",
46      "posix/memory_adapter.c",
47      "posix/queue_adapter.c",
48      "posix/thread_adapter.c",
49      "posix/time_adapter.c",
50    ]
51
52    public_configs = [ ":samgr_adapter_public" ]
53
54    include_dirs = [ "//third_party/bounds_checking_function/include" ]
55
56    cflags = [
57      "-fPIC",
58      "-Wall",
59    ]
60    public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
61    defines = [ "_GNU_SOURCE" ]
62    if (ohos_kernel_type == "linux") {
63      defines += [ "SAMGR_LINUX_ADAPTER" ]
64    }
65  }
66}
67