blob: 8e9bcb767182fd02921a6194dd04d669a39f1cd7 [file] [log] [blame]
Dan Willemsen14ca6492016-08-31 23:43:08 -07001// 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
19cc_defaults {
20 name: "libicuuc_defaults",
Victor Chang8acf63e2020-09-03 16:31:23 +010021 defaults: ["icu4c_defaults"],
Dan Willemsen14ca6492016-08-31 23:43:08 -070022 srcs: [
Victor Chang7a8efa82018-09-06 16:10:45 +010023 "*.cpp",
Dan Willemsen14ca6492016-08-31 23:43:08 -070024 ],
Dan Willemsen14ca6492016-08-31 23:43:08 -070025 // We deliberately do not set -DICU_DATA_DIR: ICU4C is configured on Android
26 // using udata_setCommonData.
27 cflags: [
28 "-D_REENTRANT",
29 "-DU_COMMON_IMPLEMENTATION",
30
31 "-O3",
32 "-fvisibility=hidden",
33
Dan Willemsen14ca6492016-08-31 23:43:08 -070034 "-Wno-missing-field-initializers",
35 "-Wno-sign-compare",
Dan Willemsen14ca6492016-08-31 23:43:08 -070036 ],
Dan Willemsen14ca6492016-08-31 23:43:08 -070037 rtti: true,
Dan Willemsen14ca6492016-08-31 23:43:08 -070038 target: {
39 android: {
40 cflags: [
41 "-DPIC",
42 "-fPIC",
43 ],
Victor Chang07c22a82020-10-05 16:24:12 +010044 static_libs: [
45 "libandroidicuinit", // Required to set the data files in libicuuc.
46 "libicuuc_stubdata",
47 ],
48 shared_libs: [
49 "libbase", // required by libandroidicuinit
50 "liblog", // required by libandroidicuinit
51 ],
Dan Willemsen14ca6492016-08-31 23:43:08 -070052 },
Jerome Gaillard25a01bb2020-05-28 15:52:39 +010053 not_windows: {
Victor Chang07c22a82020-10-05 16:24:12 +010054 static_libs: [
55 "libicuuc_stubdata",
56 ],
57 // linkerconfig links libicuuc statically on host, but we need to avoid exposing
58 // libandroidicuinit independently to other modules. Thus, we links the entire
59 // libandroidicuinit into libicuuc on host.
60 whole_static_libs: [
61 "libandroidicuinit", // Required to set the data files in libicuuc in ART testing.
62 ],
Jerome Gaillard25a01bb2020-05-28 15:52:39 +010063 required: ["icu-data_host_i18n_apex"],
64 },
Victor Chang8acf63e2020-09-03 16:31:23 +010065 windows: {
66 // Windows requires importing data as a DLL when building with U_COMMON_IMPLEMENTATION
67 shared_libs: ["libicuuc_stubdata"],
68 },
Dan Willemsen14ca6492016-08-31 23:43:08 -070069 },
70}
71
Victor Changcf91daf2018-12-03 12:15:29 +000072cc_library_headers {
73 name: "libicuuc_headers",
74 host_supported: true,
dimitryfa9b6a32019-05-14 14:12:12 +020075 native_bridge_supported: true,
Paul Duffin22d367a2019-06-25 12:06:26 +010076 header_libs: ["icu4c_extra_headers"],
77 export_header_lib_headers: ["icu4c_extra_headers"],
Victor Changcf91daf2018-12-03 12:15:29 +000078 export_include_dirs: ["."],
Victor Changaaf68452020-05-05 16:02:45 +010079 apex_available: [
80 "com.android.i18n",
81 ],
Victor Changcf91daf2018-12-03 12:15:29 +000082 target: {
83 windows: {
84 enabled: true,
85 },
86 },
87}
88
Dan Willemsen14ca6492016-08-31 23:43:08 -070089//
90// Build for the host and target.
Jerome Gaillard86eb0b22019-08-30 14:36:39 +010091// Allow static builds for host so that they can be statically
92// linked into libandroid_runtime. That enables libandroid_runtime to
93// be shipped on desktops as one file which saves space and complexity.
Jerome Gaillard86eb0b22019-08-30 14:36:39 +010094cc_library {
Dan Willemsen14ca6492016-08-31 23:43:08 -070095 name: "libicuuc",
96 host_supported: true,
97 unique_host_soname: true,
98 defaults: ["libicuuc_defaults"],
Victor Changaaf68452020-05-05 16:02:45 +010099 apex_available: [
100 "com.android.i18n",
101 ],
Jerome Gaillard001c3eb2018-12-06 11:58:40 +0000102 target: {
103 android: {
Jerome Gaillard86eb0b22019-08-30 14:36:39 +0100104 static: {
105 enabled: false,
106 },
Jerome Gaillard001c3eb2018-12-06 11:58:40 +0000107 },
Jerome Gaillardd3494e92020-03-10 15:15:26 +0000108 windows_x86_64: {
109 dist: {
110 targets: ["layoutlib"],
111 dir: "layoutlib_native/windows",
112 },
113 },
Jerome Gaillard001c3eb2018-12-06 11:58:40 +0000114 },
Paul Duffin22d367a2019-06-25 12:06:26 +0100115 header_libs: ["libicuuc_headers"],
116 export_header_lib_headers: ["libicuuc_headers"],
Dan Willemsen14ca6492016-08-31 23:43:08 -0700117}
Victor Chang73229502020-09-17 13:39:19 +0100118
119cc_library_shared {
120 name: "libicuuc_cts_stub",
121 defaults: ["libicuuc_defaults"],
122 host_supported: false,
Victor Chang73229502020-09-17 13:39:19 +0100123 installable: false,
124 stem: "libicuuc",
125 header_libs: ["libicuuc_headers"],
126 visibility: ["//external/icu:__subpackages__"],
127}