1# Copyright (c) 2020-2022 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("../config.gni")
15
16defines = []
17
18if (defined(config_ohos_systemabilitymgr_samgr_lite_shared_task_size) &&
19    config_ohos_systemabilitymgr_samgr_lite_shared_task_size > 0) {
20  defines += [ "SHARED_TASK_STACK_SIZE=$config_ohos_systemabilitymgr_samgr_lite_shared_task_size" ]
21}
22
23config("external_settings_shared") {
24  defines += [ "LAYER_INIT_SHARED_LIB" ]
25}
26
27config("samgr_public") {
28  include_dirs = [
29    "adapter",
30    "registry",
31    "//commonlibrary/utils_lite/include",
32    "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/registry",
33    "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr",
34  ]
35}
36
37if (ohos_kernel_type == "liteos_m" || ohos_kernel_type == "uniproton") {
38  static_library("samgr") {
39    sources = [
40      "registry/service_registry.c",
41      "source/samgr_lite.c",
42    ]
43
44    public_configs = [ ":samgr_public" ]
45
46    include_dirs =
47        [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
48
49    public_deps = [
50      "//foundation/systemabilitymgr/samgr_lite/samgr/adapter:samgr_adapter",
51      "//foundation/systemabilitymgr/samgr_lite/samgr/source:samgr_source",
52    ]
53
54    if (enable_ohos_systemabilitymgr_samgr_lite_rpc_mini) {
55      defines += [ "MINI_SAMGR_LITE_RPC" ]
56      include_dirs +=
57          [ "//foundation/systemabilitymgr/samgr_lite/samgr_endpoint/source" ]
58      public_deps += [
59        "//foundation/communication/ipc/interfaces/innerkits/c/dbinder:dbinder",
60      ]
61    }
62  }
63}
64
65if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") {
66  shared_library("samgr") {
67    sources = [ "source/samgr_lite.c" ]
68
69    cflags = [
70      "-fPIC",
71      "-Wall",
72    ]
73
74    public_configs = [ ":samgr_public" ]
75
76    include_dirs = [
77      "//third_party/bounds_checking_function/include",
78      "//third_party/cJSON",
79      "//foundation/systemabilitymgr/samgr_lite/samgr_endpoint/source",
80    ]
81
82    public_deps = [
83      "//build/lite/config/component/cJSON:cjson_shared",
84      "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
85      "//foundation/systemabilitymgr/samgr_lite/samgr/source:samgr_source",
86      "//foundation/systemabilitymgr/samgr_lite/samgr_client:client",
87    ]
88    public_configs += [ ":external_settings_shared" ]
89  }
90}
91