From 96f0819b1114d1486cadd5e91b26441183be9945 Mon Sep 17 00:00:00 2001 From: zhangxiao72 Date: Mon, 16 May 2022 14:27:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0static=20=E9=9D=99=E6=80=81?= =?UTF-8?q?=E5=BA=93=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id332fe66661b761dc04c212cec9ee017e602d489 Signed-off-by: zhangxiao72 --- BUILD.gn | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index b44d800..ff3803b 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -13,6 +13,16 @@ import("//build/ohos.gni") +config("config_static") { + cflags = [ + "-std=c++17", + "-Wno-error=implicit-fallthrough", + "-Wno-deprecated-declarations", + ] + visibility = [ ":*" ] + include_dirs = [ "//third_party/jsoncpp/include" ] +} + config("jsoncpp_config") { cflags = [ "-std=c++17", @@ -21,6 +31,10 @@ config("jsoncpp_config") { ] } +config("flag_config") { + cflags_cc = [ "-fexceptions" ] +} + config("jsoncpp_public_config") { include_dirs = [ "//third_party/jsoncpp/include/" ] } @@ -42,3 +56,28 @@ ohos_shared_library("jsoncpp") { part_name = "jsoncpp" subsystem_name = "thirdparty" } + +ohos_static_library("jsoncpp_static") { + sources = [ + "//third_party/jsoncpp/src/lib_json/json_reader.cpp", + "//third_party/jsoncpp/src/lib_json/json_value.cpp", + "//third_party/jsoncpp/src/lib_json/json_writer.cpp", + ] + use_exceptions = true + configs = [ ":config_static" ] + public_configs = [ ":jsoncpp_public_config" ] + public_configs += [ ":jsoncpp_config" ] + public_configs += [ ":flag_config" ] + include_dirs = [ + "//third_party/jsoncpp/include/json/", + "//third_party/jsoncpp/include/", + ] + cflags_cc = [ + "-DJSON_USE_EXCEPTION=0", + "-Wall", + "-Werror", + "-Wno-implicit-fallthrough", + ] + part_name = "jsoncpp" + subsystem_name = "thirdparty" +} -- Gitee