1# Copyright (c) 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 14import("//build/ohos.gni") 15 16# Execute the script and extract jsoncpp 17action("jsoncpp_install_action") { 18 script = "//third_party/jsoncpp/install.py" 19 outputs = [ 20 "${target_gen_dir}/jsoncpp-1.9.5/src/lib_json/json_reader.cpp", 21 "${target_gen_dir}/jsoncpp-1.9.5/src/lib_json/json_value.cpp", 22 "${target_gen_dir}/jsoncpp-1.9.5/src/lib_json/json_writer.cpp", 23 ] 24 25 inputs = [ "//third_party/jsoncpp/jsoncpp-1.9.5.tar.gz" ] 26 27 args = [ 28 "--gen-dir", 29 rebase_path("${target_gen_dir}", root_build_dir), 30 "--source-file", 31 rebase_path("//third_party/jsoncpp"), 32 ] 33} 34 35config("config_static") { 36 cflags = [ 37 "-std=c++17", 38 "-Wno-error=implicit-fallthrough", 39 "-Wno-deprecated-declarations", 40 ] 41 visibility = [ ":*" ] 42} 43 44config("jsoncpp_config") { 45 cflags = [ 46 "-std=c++17", 47 "-Wno-error=implicit-fallthrough", 48 "-Wno-deprecated-declarations", 49 ] 50} 51 52config("flag_config") { 53 cflags_cc = [ "-fexceptions" ] 54} 55 56config("jsoncpp_public_config") { 57 include_dirs = [ get_label_info(":jsoncpp_install_action", "target_gen_dir") + 58 "/jsoncpp-1.9.5/include" ] 59} 60 61ohos_shared_library("jsoncpp") { 62 visibility = [ "*" ] 63 sources = get_target_outputs(":jsoncpp_install_action") 64 use_exceptions = true 65 configs = [ ":jsoncpp_config" ] 66 public_configs = [ ":jsoncpp_public_config" ] 67 innerapi_tags = [ 68 "chipsetsdk", 69 "platformsdk", 70 ] 71 install_images = [ 72 "system", 73 "updater", 74 ] 75 deps = [ ":jsoncpp_install_action" ] 76 part_name = "jsoncpp" 77 subsystem_name = "thirdparty" 78} 79 80ohos_static_library("jsoncpp_static") { 81 sources = get_target_outputs(":jsoncpp_install_action") 82 use_exceptions = true 83 configs = [ 84 ":config_static", 85 ":flag_config", 86 ] 87 public_configs = [ ":jsoncpp_public_config" ] 88 cflags_cc = [ 89 "-Wall", 90 "-Werror", 91 "-Wno-implicit-fallthrough", 92 ] 93 deps = [ ":jsoncpp_install_action" ] 94 part_name = "jsoncpp" 95 subsystem_name = "thirdparty" 96} 97