• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#Copyright (c) 2019-2021 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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16  import("//build/lite/ndk/ndk.gni")
17  config("cjson_config") {
18    include_dirs = [ "." ]
19    ldflags = [ "-lm" ]
20    defines = [ "CJSON_NESTING_LIMIT=(128)" ]
21  }
22  cjson_sources = [
23    "cJSON.c",
24    "cJSON_Utils.c",
25  ]
26
27  lite_library("cjson_static") {
28    target_type = "static_library"
29    sources = cjson_sources
30    public_configs = [ ":cjson_config" ]
31  }
32  lite_library("cjson_shared") {
33    target_type = "shared_library"
34    sources = cjson_sources
35    public_configs = [ ":cjson_config" ]
36  }
37  ndk_lib("cjson_ndk") {
38    if (board_name != "hi3861v100") {
39      lib_extension = ".so"
40      deps = [ ":cjson_shared" ]
41    } else {
42      deps = [ ":cjson_static" ]
43    }
44    head_files = [ "//third_party/cJSON" ]
45  }
46} else {
47  import("//build/ohos.gni")
48  config("cJSON_config") {
49    include_dirs = [ "." ]
50    defines = [ "CJSON_NESTING_LIMIT=(128)" ]
51  }
52  ohos_static_library("cjson_static") {
53    sources = [ "cJSON.c" ]
54    public_configs = [ ":cJSON_config" ]
55  }
56  ohos_shared_library("cjson") {
57    deps = [ ":cjson_static" ]
58    public_configs = [ ":cJSON_config" ]
59    subsystem_name = "hiviewdfx"
60  }
61}
62