# Copyright (c) 2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") import("//third_party/icu/icu.gni") ohos_shared_library("icundk") { ldflags = [ "-shared", "-lm", ] configs = [ "//third_party/icu/icu4c:icu_config", "//build/config/compiler:rtti", ] include_dirs = [ "//third_party/icu/icu4c/source/common" ] sources = [ "src/icu_addon.cpp" ] deps = [ ":ohos_icudat", "//third_party/icu/icu4c:shared_icui18n", "//third_party/icu/icu4c:shared_icuuc", ] external_deps = [] defines = [] if (icu_support_libbegetutil && is_ohos) { defines += [ "ICU_SUPPORT_LIBBEGETUTIL" ] external_deps += [ "init:libbegetutil" ] } version_script = "libicu.map" output_name = "icu" output_extension = "so" relative_install_dir = "ndk" subsystem_name = "thirdparty" part_name = "icu" } action("pkg_icudata") { script = "build_data/pkgdata.sh" sources = [ "//third_party/icu/ohos_icu4c/build_data/pkgdata.sh" ] deps = [ "//third_party/icu/icu4c/source:bin_host" ] icu_bin_root_out_dir = get_label_info( "//third_party/icu/icu4c/source:bin_host(${host_toolchain})", "root_out_dir") if ("${build_feature}" == "lite") { icu_data_filter_dir = "lite" } args = [ "-o", "$root_out_dir", "-b", "$icu_bin_root_out_dir", "-f", "$icu_data_filter_dir", "-v", "$icu_dat_name", ] outputs = [ "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" ] } ohos_prebuilt_etc("ohos_icudat") { source = "$root_out_dir/thirdparty/icu/out/$icu_dat_name.dat" deps = [ ":pkg_icudata" ] module_install_dir = "usr/ohos_icu/" part_name = "icu" subsystem_name = "thirdparty" }