• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2008 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//
16// Common definitions.
17//
18
19package {
20    // See: http://go/android-license-faq
21    // A large-scale-change added 'default_applicable_licenses' to import
22    // all of the 'license_kinds' from "external_icu_icu4c_license"
23    // to get the below license kinds:
24    //   SPDX-license-identifier-Unicode-DFS
25    default_applicable_licenses: ["external_icu_icu4c_license"],
26}
27
28cc_defaults {
29    name: "libicuuc_defaults",
30    defaults: ["icu4c_defaults"],
31    srcs: [
32        "*.cpp",
33    ],
34    // We deliberately do not set -DICU_DATA_DIR: ICU4C is configured on Android
35    // using udata_setCommonData.
36    cflags: [
37        "-D_REENTRANT",
38        "-DU_COMMON_IMPLEMENTATION",
39
40        "-O3",
41        "-fvisibility=hidden",
42
43        "-Wno-missing-field-initializers",
44        "-Wno-sign-compare",
45    ],
46    rtti: true,
47    target: {
48        android: {
49            cflags: [
50                "-DPIC",
51                "-fPIC",
52            ],
53            static_libs: [
54                "libandroidicuinit", // Required to set the data files in libicuuc.
55                "libicuuc_stubdata",
56            ],
57            shared_libs: [
58                "libbase", // required by libandroidicuinit
59                "liblog", // required by libandroidicuinit
60            ],
61        },
62        not_windows: {
63            static_libs: [
64                "libicuuc_stubdata",
65            ],
66            // linkerconfig links libicuuc statically on host, but we need to avoid exposing
67            // libandroidicuinit independently to other modules. Thus, we links the entire
68            // libandroidicuinit into libicuuc on host.
69            whole_static_libs: [
70                "libandroidicuinit", // Required to set the data files in libicuuc in ART testing.
71            ],
72            required: ["icu-data_host_i18n_apex"],
73        },
74        windows: {
75            // Windows requires importing data as a DLL when building with U_COMMON_IMPLEMENTATION
76            shared_libs: ["libicuuc_stubdata"],
77        },
78    },
79}
80
81cc_library_headers {
82    name: "libicuuc_headers",
83    host_supported: true,
84    native_bridge_supported: true,
85    header_libs: ["icu4c_extra_headers"],
86    export_header_lib_headers: ["icu4c_extra_headers"],
87    export_include_dirs: ["."],
88    apex_available: [
89        "com.android.i18n",
90    ],
91    target: {
92        windows: {
93            enabled: true,
94        },
95    },
96}
97
98//
99// Build for the host and target.
100// Allow static builds for host so that they can be statically
101// linked into libandroid_runtime. That enables libandroid_runtime to
102// be shipped on desktops as one file which saves space and complexity.
103cc_library {
104    name: "libicuuc",
105    host_supported: true,
106    unique_host_soname: true,
107    native_bridge_supported: true,
108    defaults: ["libicuuc_defaults"],
109    apex_available: [
110        "com.android.i18n",
111    ],
112    target: {
113        android: {
114            static: {
115                enabled: false,
116            },
117        },
118        windows_x86_64: {
119            dist: {
120                targets: ["layoutlib"],
121                dir: "layoutlib_native/windows",
122            },
123        },
124    },
125    header_libs: ["libicuuc_headers"],
126    export_header_lib_headers: ["libicuuc_headers"],
127}
128
129cc_library_shared {
130    name: "libicuuc_cts_stub",
131    defaults: ["libicuuc_defaults"],
132    host_supported: false,
133    installable: false,
134    stem: "libicuuc",
135    header_libs: ["libicuuc_headers"],
136    visibility: ["//external/icu:__subpackages__"],
137}
138