1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15 16group("build_module") { 17 deps = [ 18 ":geocoding", 19 ":phonenumber_standard", 20 ] 21} 22config("phonenumber_config") { 23 include_dirs = [ 24 "//third_party/abseil-cpp/abseil-cpp", 25 "//third_party/bounds_checking_function/include", 26 "//third_party/icu/icu4c/source/common", 27 "//third_party/icu/icu4c/source/i18n", 28 "//third_party/icu/icu4c/source", 29 "//third_party/libphonenumber/cpp/src", 30 "//third_party/protobuf/src", 31 "//third_party/protobuf/src/google", 32 "//third_party/protobuf/src/google/protobuf", 33 ] 34 cflags = [ "-Wno-implicit-fallthrough" ] 35 cflags_cc = [ 36 "-DI18N_PHONENUMBERS_USE_ALTERNATE_FORMATS", 37 "-DI18N_PHONENUMBERS_USE_ICU_REGEXP", 38 "-Dphonenumber_shared_EXPORTS", 39 "-Wall", 40 "-fPIC", 41 "-Wno-sign-compare", 42 "-Wno-error=unused-parameter", 43 "-Wno-error=unused-const-variable", 44 "-Wno-error=unneeded-internal-declaration", 45 "-Wno-implicit-fallthrough", 46 "-Wno-deprecated-builtins", 47 ] 48} 49 50config("phonenumber_public_config") { 51 include_dirs = [ 52 "//third_party/libphonenumber/cpp/src", 53 "//third_party/libphonenumber/cpp/src/phonenumbers", 54 ] 55} 56 57phonenumber_source = [ 58 "src/phonenumbers/phonenumber.cc", 59 "src/phonenumbers/default_logger.cc", 60 "src/phonenumbers/phonenumbermatch.cc", 61 "src/phonenumbers/phonenumbermatcher.cc", 62 "src/phonenumbers/regexp_cache.cc", 63 "src/phonenumbers/phonemetadata.pb.cc", 64 "src/phonenumbers/string_byte_sink.cc", 65 "src/phonenumbers/asyoutypeformatter.cc", 66 "src/phonenumbers/phonenumberutil.cc", 67 "src/phonenumbers/regexp_adapter_icu.cc", 68 "src/phonenumbers/phonenumber.pb.cc", 69 "src/phonenumbers/base/strings/string_piece.cc", 70 "src/phonenumbers/alternate_format.cc", 71 "src/phonenumbers/shortnumberinfo.cc", 72 "src/phonenumbers/utf/unilib.cc", 73 "src/phonenumbers/utf/unicodetext.cc", 74 "src/phonenumbers/metadata.cc", 75 "src/phonenumbers/short_metadata.cc", 76 "src/phonenumbers/regex_based_matcher.cc", 77 "src/phonenumbers/logger.cc", 78 "src/phonenumbers/stringutil.cc", 79 "src/phonenumbers/unicodestring.cc", 80 "src/phonenumbers/utf/rune.c", 81] 82 83phonenumber_deps = [ 84 "//third_party/abseil-cpp:absl_base", 85 "//third_party/abseil-cpp:absl_strings", 86 "//third_party/bounds_checking_function:libsec_shared", 87 "//third_party/icu/icu4c:shared_icui18n", 88 "//third_party/icu/icu4c:shared_icuuc", 89] 90 91phonenumber_defines = [ 92 "I18N_PHONENUMBERS_USE_ALTERNATE_FORMATS", 93 "I18N_PHONENUMBERS_USE_ICU_REGEXP", 94 "HAVE_PTHREAD", 95] 96 97geocoding_defines = [ 98 "I18N_PHONENUMBERS_USE_ALTERNATE_FORMATS", 99 "I18N_PHONENUMBERS_USE_ICU_REGEXP", 100 "HAVE_PTHREAD", 101] 102 103if (is_ohos) { 104 phonenumber_source += [ 105 "src/phonenumbers/ohos/geocoding_data.pb.cc", 106 "src/phonenumbers/ohos/update_geocoding.cc", 107 "src/phonenumbers/ohos/update_libphonenumber.cc", 108 "src/phonenumbers/ohos/update_metadata.cc", 109 ] 110 111 phonenumber_deps += [ ":version_txt" ] 112 113 phonenumber_defines += [ "LIBPHONENUMBER_UPGRADE" ] 114 115 geocoding_defines += [ "LIBPHONENUMBER_UPGRADE" ] 116 117 ohos_prebuilt_etc("version_txt") { 118 source = "./src/phonenumbers/ohos/etc/version.txt" 119 module_install_dir = "etc/LIBPHONENUMBER/generic/" 120 part_name = "libphonenumber" 121 subsystem_name = "thirdparty" 122 } 123} 124 125ohos_shared_library("phonenumber_standard") { 126 branch_protector_ret = "pac_ret" 127 configs = [ ":phonenumber_config" ] 128 public_configs = [ ":phonenumber_public_config" ] 129 sources = phonenumber_source 130 deps = phonenumber_deps 131 public_external_deps = [ "protobuf:protobuf_lite" ] 132 defines = phonenumber_defines 133 innerapi_tags = [ "platformsdk_indirect" ] 134 part_name = "libphonenumber" 135 subsystem_name = "thirdparty" 136 ldflags = [ "-shared" ] 137 install_enable = true 138} 139 140ohos_shared_library("geocoding") { 141 configs = [ ":phonenumber_config" ] 142 sources = [ 143 "src/phonenumbers/geocoding/area_code_map.cc", 144 "src/phonenumbers/geocoding/default_map_storage.cc", 145 "src/phonenumbers/geocoding/geocoding_data.cc", 146 "src/phonenumbers/geocoding/geocoding_warpper.cc", 147 "src/phonenumbers/geocoding/mapping_file_provider.cc", 148 "src/phonenumbers/geocoding/phonenumber_offline_geocoder.cc", 149 "src/phonenumbers/phonenumber.pb.h", 150 ] 151 deps = [ 152 "//third_party/bounds_checking_function:libsec_shared", 153 "//third_party/icu/icu4c:shared_icuuc", 154 "//third_party/libphonenumber/cpp:phonenumber_standard", 155 ] 156 defines = geocoding_defines 157 part_name = "libphonenumber" 158 relative_install_dir = "platformsdk" 159 subsystem_name = "thirdparty" 160 ldflags = [ "-shared" ] 161 install_enable = true 162} 163