From ae939d40ab4ffa136a359a062a0b498190028e25 Mon Sep 17 00:00:00 2001 From: swx1119547 Date: Wed, 9 Feb 2022 17:02:39 +0800 Subject: [PATCH] extract source_set Signed-off-by: swx1119547 --- BUILD.gn | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 3bcff22..68b4ef4 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -11,7 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/ohos.gni") +if (!defined(ark_flag)){ + import("//build/ohos.gni") +}else{ + import("//build/ark.gni") +} config("jsoncpp_config") { cflags = [ @@ -22,22 +26,41 @@ config("jsoncpp_config") { } config("jsoncpp_public_config") { + cflags_cc = [ "-fexceptions", "-fPIC",] include_dirs = [ "//third_party/jsoncpp/include/" ] } -ohos_shared_library("jsoncpp") { - visibility = [ "*" ] +source_set("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 = [ ":jsoncpp_config" ] + public_configs = [ ":jsoncpp_config" ] + include_dirs = [ "//third_party/jsoncpp/include/json/", "//third_party/jsoncpp/include/", ] - public_configs = [ ":jsoncpp_public_config" ] - subsystem_name = "distributeddatamgr" + public_configs += [ ":jsoncpp_public_config" ] +} + +group("jsoncpp_target") { + # Config to apply to all targets that depend on this one. + public_configs = [ ":jsoncpp_public_config" ] +} + +if (!defined(ark_flag)){ + ohos_shared_library("jsoncpp") { + visibility = [ "*" ] + deps = [ ":jsoncpp_static" ] + public_deps = [ ":jsoncpp_target" ] + subsystem_name = "distributeddatamgr" + } +}else { + ark_shared_library("jsoncpp") { + visibility = [ "*" ] + deps = [ ":jsoncpp_static" ] + public_deps = [ ":jsoncpp_target" ] + } } -- Gitee