19750e409Sopenharmony_ci#Copyright (c) 2019-2021 Huawei Device Co., Ltd.
29750e409Sopenharmony_ci#Licensed under the Apache License, Version 2.0 (the "License");
39750e409Sopenharmony_ci#you may not use this file except in compliance with the License.
49750e409Sopenharmony_ci#You may obtain a copy of the License at
59750e409Sopenharmony_ci#
69750e409Sopenharmony_ci#    http://www.apache.org/licenses/LICENSE-2.0
79750e409Sopenharmony_ci#
89750e409Sopenharmony_ci#Unless required by applicable law or agreed to in writing, software
99750e409Sopenharmony_ci#distributed under the License is distributed on an "AS IS" BASIS,
109750e409Sopenharmony_ci#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119750e409Sopenharmony_ci#See the License for the specific language governing permissions and
129750e409Sopenharmony_ci#limitations under the License.
139750e409Sopenharmony_ci
149750e409Sopenharmony_ciif (defined(ohos_lite)) {
159750e409Sopenharmony_ci  config("cjson_config") {
169750e409Sopenharmony_ci    include_dirs = [ "//third_party/cJSON" ]
179750e409Sopenharmony_ci    ldflags = [ "-lm" ]
189750e409Sopenharmony_ci    defines = [ "CJSON_NESTING_LIMIT=(128)" ]
199750e409Sopenharmony_ci  }
209750e409Sopenharmony_ci  cjson_sources = [
219750e409Sopenharmony_ci    "cJSON.c",
229750e409Sopenharmony_ci    "cJSON_Utils.c",
239750e409Sopenharmony_ci  ]
249750e409Sopenharmony_ci
259750e409Sopenharmony_ci  if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") {
269750e409Sopenharmony_ci    cflags = [
279750e409Sopenharmony_ci      "--diag_suppress",
289750e409Sopenharmony_ci      "Pe513",
299750e409Sopenharmony_ci    ]
309750e409Sopenharmony_ci    cflags_cc = cflags
319750e409Sopenharmony_ci  }
329750e409Sopenharmony_ci  static_library("cjson_static") {
339750e409Sopenharmony_ci    sources = cjson_sources
349750e409Sopenharmony_ci    public_configs = [ ":cjson_config" ]
359750e409Sopenharmony_ci  }
369750e409Sopenharmony_ci
379750e409Sopenharmony_ci  shared_library("cjson_shared") {
389750e409Sopenharmony_ci    sources = cjson_sources
399750e409Sopenharmony_ci    public_configs = [ ":cjson_config" ]
409750e409Sopenharmony_ci  }
419750e409Sopenharmony_ci} else {
429750e409Sopenharmony_ci  import("//build/ohos.gni")
439750e409Sopenharmony_ci  config("cJSON_config") {
449750e409Sopenharmony_ci    include_dirs = [ "//third_party/cJSON" ]
459750e409Sopenharmony_ci    defines = [ "CJSON_NESTING_LIMIT=(128)" ]
469750e409Sopenharmony_ci  }
479750e409Sopenharmony_ci  ohos_static_library("cjson_static") {
489750e409Sopenharmony_ci    branch_protector_ret = "pac_ret"
499750e409Sopenharmony_ci    sources = [ "cJSON.c" ]
509750e409Sopenharmony_ci    public_configs = [ ":cJSON_config" ]
519750e409Sopenharmony_ci    part_name = "cJSON"
529750e409Sopenharmony_ci    subsystem_name = "thirdparty"
539750e409Sopenharmony_ci  }
549750e409Sopenharmony_ci  ohos_shared_library("cjson") {
559750e409Sopenharmony_ci    branch_protector_ret = "pac_ret"
569750e409Sopenharmony_ci    sources = [ "cJSON.c" ]
579750e409Sopenharmony_ci    public_configs = [ ":cJSON_config" ]
589750e409Sopenharmony_ci    innerapi_tags = [
599750e409Sopenharmony_ci      "chipsetsdk",
609750e409Sopenharmony_ci      "platformsdk_indirect",
619750e409Sopenharmony_ci    ]
629750e409Sopenharmony_ci    part_name = "cJSON"
639750e409Sopenharmony_ci    subsystem_name = "thirdparty"
649750e409Sopenharmony_ci    install_images = [
659750e409Sopenharmony_ci      "system",
669750e409Sopenharmony_ci      "updater",
679750e409Sopenharmony_ci    ]
689750e409Sopenharmony_ci  }
699750e409Sopenharmony_ci}
70