diff --git a/BUILD.gn b/BUILD.gn index 3bcff223d29af908c375a61fc623f8ed1cd1b082..6d7eba8550ad92ae119a822949a6371d75310f88 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -11,7 +11,12 @@ # 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 +27,52 @@ config("jsoncpp_config") { } config("jsoncpp_public_config") { + if (defined(ark_flag)){ + cflags_cc = [ "-fexceptions", "-fPIC",] + } include_dirs = [ "//third_party/jsoncpp/include/" ] } -ohos_shared_library("jsoncpp") { - visibility = [ "*" ] - 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" ] - include_dirs = [ - "//third_party/jsoncpp/include/json/", - "//third_party/jsoncpp/include/", - ] - public_configs = [ ":jsoncpp_public_config" ] - subsystem_name = "distributeddatamgr" +if (!defined(ark_flag)){ + ohos_shared_library("jsoncpp") { + visibility = [ "*" ] + 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" ] + include_dirs = [ + "//third_party/jsoncpp/include/json/", + "//third_party/jsoncpp/include/", + ] + public_configs = [ ":jsoncpp_public_config" ] + subsystem_name = "distributeddatamgr" + } +}else{ + 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", + ] + public_configs = [ ":jsoncpp_config" ] + + include_dirs = [ + "//third_party/jsoncpp/include/json/", + "//third_party/jsoncpp/include/", + ] + public_configs += [ ":jsoncpp_public_config" ] + } + + group("jsoncpp_target") { + # Config to apply to all targets that depend on this one. + public_configs = [ ":jsoncpp_public_config" ] + } + ark_shared_library("jsoncpp") { + visibility = [ "*" ] + deps = [ ":jsoncpp_static" ] + public_deps = [ ":jsoncpp_target" ] + } }