BUILD.gn 5.0 KB
Newer Older
M
Mupceet 已提交
1 2 3 4 5 6 7 8 9 10 11 12
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
M
init  
Mupceet 已提交
13
import("//base/startup/init/begetd.gni")
M
Mupceet 已提交
14 15

param_include_dirs = [
16
  "//base/startup/init/interfaces/innerkits/include/syspara",
M
init  
Mupceet 已提交
17 18 19 20 21 22 23
  "//base/startup/init/services/param/include",
  "//base/startup/init/services/param/adapter",
  "//base/startup/init/services/include/param",
  "//base/startup/init/services/include",
  "//base/startup/init/services/init/include",
  "//base/startup/init/services/log",
  "//base/startup/init/services/loopevent/include",
M
Mupceet 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
  "//third_party/bounds_checking_function/include",
  "//third_party/cJSON",
  "//utils/native/lite/include",
]

param_build_defines = [
  "_GNU_SOURCE",
  "INCREMENTAL_VERSION=\"${ohos_version}\"",
  "BUILD_TYPE=\"${ohos_build_type}\"",
  "BUILD_USER=\"${ohos_build_user}\"",
  "BUILD_TIME=\"${ohos_build_time}\"",
  "BUILD_HOST=\"${ohos_build_host}\"",
  "BUILD_ROOTHASH=\"${ohos_build_roothash}\"",
]

M
Mupceet 已提交
39
action("lite_ohos_param_to") {
M
init  
Mupceet 已提交
40
  script = "//base/startup/init/scripts/param_cfg_to_code.py"
M
Mupceet 已提交
41 42 43
  args = [
    "--source",
    rebase_path(
M
init  
Mupceet 已提交
44
        "//base/startup/init/services/etc_lite/param/ohos_const/ohos.para"),
M
Mupceet 已提交
45 46 47
    "--source",
    rebase_path("$ohos_product_adapter_dir/utils/sys_param/vendor.para"),
    "--source",
M
init  
Mupceet 已提交
48
    rebase_path("//base/startup/init/services/etc/param/ohos.para"),
M
Mupceet 已提交
49
    "--dest_dir",
M
init  
Mupceet 已提交
50
    rebase_path("$root_out_dir/gen/init/"),
M
Mupceet 已提交
51 52
  ]
  outputs = [ "$target_gen_dir/${target_name}_param_cfg_to_code.log" ]
M
Mupceet 已提交
53 54 55 56 57
}

config("exported_header_files") {
  visibility = [ ":*" ]
  include_dirs = [
M
init  
Mupceet 已提交
58 59 60
    "//base/startup/init/interfaces/innerkits/include",
    "//base/startup/init/interfaces/service/include/param",
    "//base/startup/init/interfaces/service/param/include",
M
Mupceet 已提交
61 62 63
  ]
}

M
Mupceet 已提交
64
base_sources = [
M
init  
Mupceet 已提交
65 66 67 68 69 70 71 72 73 74 75
  "//base/startup/init/services/log/init_commlog.c",
  "//base/startup/init/services/param/base/param_base.c",
  "//base/startup/init/services/param/base/param_comm.c",
  "//base/startup/init/services/param/base/param_trie.c",
  "//base/startup/init/services/param/liteos/param_client.c",
  "//base/startup/init/services/param/liteos/param_litedac.c",
  "//base/startup/init/services/param/liteos/param_osadp.c",
  "//base/startup/init/services/param/manager/param_manager.c",
  "//base/startup/init/services/param/manager/param_persist.c",
  "//base/startup/init/services/utils/init_hashmap.c",
  "//base/startup/init/services/utils/list.c",
M
Mupceet 已提交
76 77
]

M
Mupceet 已提交
78 79 80
static_library("param_init_lite") {
  defines = []
  deps = []
M
Mupceet 已提交
81
  sources = [
M
init  
Mupceet 已提交
82 83
    "//base/startup/init/services/param/manager/param_manager.c",
    "//base/startup/init/services/param/manager/param_server.c",
M
Mupceet 已提交
84
  ]
M
Mupceet 已提交
85 86 87 88 89 90
  include_dirs = param_include_dirs
  defines += param_build_defines
  public_configs = [ ":exported_header_files" ]

  if (ohos_kernel_type == "liteos_a") {
    sources += [
M
init  
Mupceet 已提交
91 92 93
      "//base/startup/init/services/param/adapter/param_persistadp.c",
      "//base/startup/init/services/param/liteos/param_service.c",
      "//base/startup/init/services/param/manager/param_persist.c",
M
Mupceet 已提交
94 95 96 97 98 99 100 101 102 103 104 105
    ]
    defines += [
      "WORKSPACE_AREA_NEED_MUTEX",
      "PARAM_PERSIST_SAVE_MUTEX",
      "PARAMWORKSPACE_NEED_MUTEX",
      "__LITEOS_A__",
      "PARAM_SUPPORT_CYCLE_CHECK",
    ]
  }
}

static_library("param_client_lite") {
M
Mupceet 已提交
106
  sources = base_sources
M
Mupceet 已提交
107 108 109 110 111 112
  include_dirs = param_include_dirs
  cflags = [ "-fPIC" ]
  defines = param_build_defines
  public_configs = [ ":exported_header_files" ]

  if (ohos_kernel_type == "liteos_a") {
M
Mupceet 已提交
113
    sources +=
M
init  
Mupceet 已提交
114
        [ "//base/startup/init/services/param/adapter/param_persistadp.c" ]
M
Mupceet 已提交
115 116 117 118 119
    defines += [
      "__LITEOS_A__",
      "WORKSPACE_AREA_NEED_MUTEX",
      "PARAM_PERSIST_SAVE_MUTEX",
      "PARAMWORKSPACE_NEED_MUTEX",
M
Mupceet 已提交
120
      "PARAM_SUPPORT_CYCLE_CHECK",
M
Mupceet 已提交
121 122
    ]
  } else if (ohos_kernel_type == "liteos_m") {
M
Mupceet 已提交
123
    sources += [
124 125 126
      "//base/startup/init/services/param/liteos/param_hal.c",
      "//base/startup/init/services/param/liteos/param_service.c",
      "//base/startup/init/services/param/manager/param_server.c",
M
Mupceet 已提交
127
    ]
M
Mupceet 已提交
128
    if (enable_ohos_startup_init_lite_use_posix_file_api) {
M
Mupceet 已提交
129
      defines += [ "PARAM_SUPPORT_POSIX" ]
M
Mupceet 已提交
130 131 132 133 134 135 136
    }
    defines += [
      "__LITEOS_M__",
      "WORKSPACE_AREA_NEED_MUTEX",
      "PARAM_PERSIST_SAVE_MUTEX",
      "PARAMWORKSPACE_NEED_MUTEX",
    ]
M
Mupceet 已提交
137 138 139
    if (config_ohos_startup_init_lite_data_path != "") {
      defines += [ "DATA_PATH=\"${config_ohos_startup_init_lite_data_path}\"" ]
    }
M
Mupceet 已提交
140
    if (enable_ohos_startup_init_feature_begetctl_liteos) {
M
Mupceet 已提交
141
      deps = [ ":lite_ohos_param_to" ]
M
init  
Mupceet 已提交
142
      include_dirs += [ "$root_out_dir/gen/init" ]
M
Mupceet 已提交
143 144 145 146
      defines += [ "PARAM_LOAD_CFG_FROM_CODE" ]
    }
  }
}