diff --git a/BUILD.gn b/BUILD.gn index b44d800ef69b110e424748fdab73d5217da00204..1a965c2f92efdd61d16ce1d8ea92b1f6dcbbd8d3 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,27 @@ 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" ] + configs += [ ":flag_config" ] + public_configs = [ ":jsoncpp_public_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" +}