19c6d7c21Sopenharmony_ci# Copyright (c) 2020 Huawei Device Co., Ltd.
29c6d7c21Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
39c6d7c21Sopenharmony_ci# you may not use this file except in compliance with the License.
49c6d7c21Sopenharmony_ci# You may obtain a copy of the License at
59c6d7c21Sopenharmony_ci#
69c6d7c21Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
79c6d7c21Sopenharmony_ci#
89c6d7c21Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
99c6d7c21Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
109c6d7c21Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119c6d7c21Sopenharmony_ci# See the License for the specific language governing permissions and
129c6d7c21Sopenharmony_ci# limitations under the License.
139c6d7c21Sopenharmony_ci
149c6d7c21Sopenharmony_ciconfig("samgr_adapter_public") {
159c6d7c21Sopenharmony_ci  include_dirs = [
169c6d7c21Sopenharmony_ci    "./",
179c6d7c21Sopenharmony_ci    "//commonlibrary/utils_lite/include",
189c6d7c21Sopenharmony_ci    "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr",
199c6d7c21Sopenharmony_ci  ]
209c6d7c21Sopenharmony_ci}
219c6d7c21Sopenharmony_ci
229c6d7c21Sopenharmony_ciif (ohos_kernel_type == "liteos_m" || ohos_kernel_type == "uniproton") {
239c6d7c21Sopenharmony_ci  static_library("samgr_adapter") {
249c6d7c21Sopenharmony_ci    sources = [
259c6d7c21Sopenharmony_ci      "cmsis/memory_adapter.c",
269c6d7c21Sopenharmony_ci      "cmsis/queue_adapter.c",
279c6d7c21Sopenharmony_ci      "cmsis/thread_adapter.c",
289c6d7c21Sopenharmony_ci      "cmsis/time_adapter.c",
299c6d7c21Sopenharmony_ci    ]
309c6d7c21Sopenharmony_ci
319c6d7c21Sopenharmony_ci    public_configs = [ ":samgr_adapter_public" ]
329c6d7c21Sopenharmony_ci
339c6d7c21Sopenharmony_ci    if (ohos_kernel_type == "liteos_m") {
349c6d7c21Sopenharmony_ci      include_dirs = [
359c6d7c21Sopenharmony_ci        "//kernel/liteos_m/kal/",
369c6d7c21Sopenharmony_ci        "//kernel/liteos_m/kal/cmsis",
379c6d7c21Sopenharmony_ci      ]
389c6d7c21Sopenharmony_ci    }
399c6d7c21Sopenharmony_ci  }
409c6d7c21Sopenharmony_ci}
419c6d7c21Sopenharmony_ci
429c6d7c21Sopenharmony_ciif (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") {
439c6d7c21Sopenharmony_ci  source_set("samgr_adapter") {
449c6d7c21Sopenharmony_ci    sources = [
459c6d7c21Sopenharmony_ci      "posix/lock_free_queue.c",
469c6d7c21Sopenharmony_ci      "posix/memory_adapter.c",
479c6d7c21Sopenharmony_ci      "posix/queue_adapter.c",
489c6d7c21Sopenharmony_ci      "posix/thread_adapter.c",
499c6d7c21Sopenharmony_ci      "posix/time_adapter.c",
509c6d7c21Sopenharmony_ci    ]
519c6d7c21Sopenharmony_ci
529c6d7c21Sopenharmony_ci    public_configs = [ ":samgr_adapter_public" ]
539c6d7c21Sopenharmony_ci
549c6d7c21Sopenharmony_ci    include_dirs = [ "//third_party/bounds_checking_function/include" ]
559c6d7c21Sopenharmony_ci
569c6d7c21Sopenharmony_ci    cflags = [
579c6d7c21Sopenharmony_ci      "-fPIC",
589c6d7c21Sopenharmony_ci      "-Wall",
599c6d7c21Sopenharmony_ci    ]
609c6d7c21Sopenharmony_ci    public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
619c6d7c21Sopenharmony_ci    defines = [ "_GNU_SOURCE" ]
629c6d7c21Sopenharmony_ci    if (ohos_kernel_type == "linux") {
639c6d7c21Sopenharmony_ci      defines += [ "SAMGR_LINUX_ADAPTER" ]
649c6d7c21Sopenharmony_ci    }
659c6d7c21Sopenharmony_ci  }
669c6d7c21Sopenharmony_ci}
67