• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (c) 2020 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15
16import("//build/lite/config/component/lite_component.gni")
17import("//build/lite/ndk/ndk.gni")
18
19config("cjson_config") {
20  include_dirs = [ "//third_party/cJSON" ]
21  ldflags = [ "-lm" ]
22  defines = [ "CJSON_NESTING_LIMIT=(128)" ]
23  if (board_toolchain_type == "iccarm") {
24    cflags = [
25      "--diag_suppress",
26      "Pa084",
27    ]
28  }
29}
30
31cjson_sources = [
32  "//third_party/cJSON/cJSON.c",
33  "//third_party/cJSON/cJSON_Utils.c",
34]
35
36lite_library("cjson_static") {
37  target_type = "static_library"
38  sources = cjson_sources
39  public_configs = [ ":cjson_config" ]
40}
41
42lite_library("cjson_shared") {
43  target_type = "shared_library"
44  sources = cjson_sources
45  public_configs = [ ":cjson_config" ]
46}
47
48ndk_lib("cjson_ndk") {
49  if (board_name != "hispark_pegasus") {
50    lib_extension = ".so"
51    deps = [ ":cjson_shared" ]
52  } else {
53    deps = [ ":cjson_static" ]
54  }
55  head_files = [
56    "//third_party/cJSON/cJSON.h",
57    "//third_party/cJSON/cJSON_Utils.h",
58  ]
59}
60