# Copyright (c) 2021 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. import("//build/ohos.gni") # Execute the script and extract jsoncpp action("jsoncpp_install_action") { script = "//third_party/jsoncpp/install.py" outputs = [ "${target_gen_dir}/jsoncpp-1.9.5/src/lib_json/json_reader.cpp", "${target_gen_dir}/jsoncpp-1.9.5/src/lib_json/json_value.cpp", "${target_gen_dir}/jsoncpp-1.9.5/src/lib_json/json_writer.cpp", ] inputs = [ "//third_party/jsoncpp/jsoncpp-1.9.5.tar.gz" ] args = [ "--gen-dir", rebase_path("${target_gen_dir}", root_build_dir), "--source-file", rebase_path("//third_party/jsoncpp"), ] } config("config_static") { cflags = [ "-std=c++17", "-Wno-error=implicit-fallthrough", "-Wno-deprecated-declarations", ] visibility = [ ":*" ] } config("jsoncpp_config") { cflags = [ "-std=c++17", "-Wno-error=implicit-fallthrough", "-Wno-deprecated-declarations", ] } config("flag_config") { cflags_cc = [ "-fexceptions" ] } config("jsoncpp_public_config") { include_dirs = [ get_label_info(":jsoncpp_install_action", "target_gen_dir") + "/jsoncpp-1.9.5/include" ] } ohos_shared_library("jsoncpp") { branch_protector_ret = "pac_ret" visibility = [ "*" ] sources = get_target_outputs(":jsoncpp_install_action") use_exceptions = true configs = [ ":jsoncpp_config" ] public_configs = [ ":jsoncpp_public_config" ] innerapi_tags = [ "chipsetsdk", "platformsdk", ] install_images = [ "system", "updater", ] deps = [ ":jsoncpp_install_action" ] part_name = "jsoncpp" subsystem_name = "thirdparty" } ohos_static_library("jsoncpp_static") { branch_protector_ret = "pac_ret" sources = get_target_outputs(":jsoncpp_install_action") use_exceptions = true configs = [ ":config_static", ":flag_config", ] public_configs = [ ":jsoncpp_public_config" ] cflags_cc = [ "-Wall", "-Werror", "-Wno-implicit-fallthrough", ] deps = [ ":jsoncpp_install_action" ] part_name = "jsoncpp" subsystem_name = "thirdparty" }