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 57geocoding_source = [ 58 "src/phonenumbers/geocoding/area_code_map.cc", 59 "src/phonenumbers/geocoding/default_map_storage.cc", 60 "src/phonenumbers/geocoding/geocoding_data.cc", 61 "src/phonenumbers/geocoding/geocoding_warpper.cc", 62 "src/phonenumbers/geocoding/mapping_file_provider.cc", 63 "src/phonenumbers/geocoding/phonenumber_offline_geocoder.cc", 64 "src/phonenumbers/phonenumber.pb.h", 65] 66 67phonenumber_source = [ 68 "src/phonenumbers/phonenumber.cc", 69 "src/phonenumbers/default_logger.cc", 70 "src/phonenumbers/phonenumbermatch.cc", 71 "src/phonenumbers/phonenumbermatcher.cc", 72 "src/phonenumbers/regexp_cache.cc", 73 "src/phonenumbers/phonemetadata.pb.cc", 74 "src/phonenumbers/string_byte_sink.cc", 75 "src/phonenumbers/asyoutypeformatter.cc", 76 "src/phonenumbers/phonenumberutil.cc", 77 "src/phonenumbers/regexp_adapter_icu.cc", 78 "src/phonenumbers/phonenumber.pb.cc", 79 "src/phonenumbers/base/strings/string_piece.cc", 80 "src/phonenumbers/alternate_format.cc", 81 "src/phonenumbers/shortnumberinfo.cc", 82 "src/phonenumbers/utf/unilib.cc", 83 "src/phonenumbers/utf/unicodetext.cc", 84 "src/phonenumbers/metadata.cc", 85 "src/phonenumbers/short_metadata.cc", 86 "src/phonenumbers/regex_based_matcher.cc", 87 "src/phonenumbers/logger.cc", 88 "src/phonenumbers/stringutil.cc", 89 "src/phonenumbers/unicodestring.cc", 90 "src/phonenumbers/utf/rune.c", 91] 92 93phonenumber_deps = [ 94 "//third_party/abseil-cpp:absl_base", 95 "//third_party/abseil-cpp:absl_strings", 96 "//third_party/bounds_checking_function:libsec_shared", 97 "//third_party/icu/icu4c:shared_icui18n", 98 "//third_party/icu/icu4c:shared_icuuc", 99] 100 101phonenumber_defines = [ 102 "I18N_PHONENUMBERS_USE_ALTERNATE_FORMATS", 103 "I18N_PHONENUMBERS_USE_ICU_REGEXP", 104 "HAVE_PTHREAD", 105] 106 107geocoding_defines = [ 108 "I18N_PHONENUMBERS_USE_ALTERNATE_FORMATS", 109 "I18N_PHONENUMBERS_USE_ICU_REGEXP", 110 "HAVE_PTHREAD", 111] 112 113if (is_ohos) { 114 phonenumber_source += [ 115 "src/phonenumbers/ohos/geocoding_data.pb.cc", 116 "src/phonenumbers/ohos/update_libphonenumber.cc", 117 "src/phonenumbers/ohos/update_metadata.cc", 118 ] 119 120 geocoding_source += [ 121 "src/phonenumbers/ohos/geocoding_data.pb.cc", 122 "src/phonenumbers/ohos/update_geocoding.cc", 123 "src/phonenumbers/ohos/update_libgeocoding.cc", 124 ] 125 126 phonenumber_deps += [ ":version_txt" ] 127 128 phonenumber_defines += [ "LIBPHONENUMBER_UPGRADE" ] 129 130 geocoding_defines += [ "LIBPHONENUMBER_UPGRADE" ] 131 132 ohos_prebuilt_etc("version_txt") { 133 source = "./src/phonenumbers/ohos/etc/version.txt" 134 module_install_dir = "etc/LIBPHONENUMBER/generic/" 135 part_name = "libphonenumber" 136 subsystem_name = "thirdparty" 137 } 138} 139 140ohos_shared_library("phonenumber_standard") { 141 branch_protector_ret = "pac_ret" 142 configs = [ ":phonenumber_config" ] 143 public_configs = [ ":phonenumber_public_config" ] 144 sources = phonenumber_source 145 deps = phonenumber_deps 146 public_external_deps = [ "protobuf:protobuf_lite" ] 147 defines = phonenumber_defines 148 innerapi_tags = [ "platformsdk_indirect" ] 149 part_name = "libphonenumber" 150 subsystem_name = "thirdparty" 151 ldflags = [ "-shared" ] 152 install_enable = true 153} 154 155ohos_shared_library("geocoding") { 156 configs = [ ":phonenumber_config" ] 157 sources = geocoding_source 158 deps = [ 159 "//third_party/bounds_checking_function:libsec_shared", 160 "//third_party/icu/icu4c:shared_icuuc", 161 "//third_party/libphonenumber/cpp:phonenumber_standard", 162 ] 163 defines = geocoding_defines 164 part_name = "libphonenumber" 165 relative_install_dir = "platformsdk" 166 subsystem_name = "thirdparty" 167 ldflags = [ "-shared" ] 168 install_enable = true 169} 170