Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 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 | |
| 19 | cc_defaults { |
| 20 | name: "libicuuc_defaults", |
Victor Chang | 8acf63e | 2020-09-03 16:31:23 +0100 | [diff] [blame] | 21 | defaults: ["icu4c_defaults"], |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 22 | srcs: [ |
Victor Chang | 7a8efa8 | 2018-09-06 16:10:45 +0100 | [diff] [blame] | 23 | "*.cpp", |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 24 | ], |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 25 | // 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 Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 34 | "-Wno-missing-field-initializers", |
| 35 | "-Wno-sign-compare", |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 36 | ], |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 37 | rtti: true, |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 38 | target: { |
| 39 | android: { |
| 40 | cflags: [ |
| 41 | "-DPIC", |
| 42 | "-fPIC", |
| 43 | ], |
Victor Chang | 07c22a8 | 2020-10-05 16:24:12 +0100 | [diff] [blame] | 44 | 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 Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 52 | }, |
Jerome Gaillard | 25a01bb | 2020-05-28 15:52:39 +0100 | [diff] [blame] | 53 | not_windows: { |
Victor Chang | 07c22a8 | 2020-10-05 16:24:12 +0100 | [diff] [blame] | 54 | 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 Gaillard | 25a01bb | 2020-05-28 15:52:39 +0100 | [diff] [blame] | 63 | required: ["icu-data_host_i18n_apex"], |
| 64 | }, |
Victor Chang | 8acf63e | 2020-09-03 16:31:23 +0100 | [diff] [blame] | 65 | windows: { |
| 66 | // Windows requires importing data as a DLL when building with U_COMMON_IMPLEMENTATION |
| 67 | shared_libs: ["libicuuc_stubdata"], |
| 68 | }, |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 69 | }, |
| 70 | } |
| 71 | |
Victor Chang | cf91daf | 2018-12-03 12:15:29 +0000 | [diff] [blame] | 72 | cc_library_headers { |
| 73 | name: "libicuuc_headers", |
| 74 | host_supported: true, |
dimitry | fa9b6a3 | 2019-05-14 14:12:12 +0200 | [diff] [blame] | 75 | native_bridge_supported: true, |
Paul Duffin | 22d367a | 2019-06-25 12:06:26 +0100 | [diff] [blame] | 76 | header_libs: ["icu4c_extra_headers"], |
| 77 | export_header_lib_headers: ["icu4c_extra_headers"], |
Victor Chang | cf91daf | 2018-12-03 12:15:29 +0000 | [diff] [blame] | 78 | export_include_dirs: ["."], |
Victor Chang | aaf6845 | 2020-05-05 16:02:45 +0100 | [diff] [blame] | 79 | apex_available: [ |
| 80 | "com.android.i18n", |
| 81 | ], |
Victor Chang | cf91daf | 2018-12-03 12:15:29 +0000 | [diff] [blame] | 82 | target: { |
| 83 | windows: { |
| 84 | enabled: true, |
| 85 | }, |
| 86 | }, |
| 87 | } |
| 88 | |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 89 | // |
| 90 | // Build for the host and target. |
Jerome Gaillard | 86eb0b2 | 2019-08-30 14:36:39 +0100 | [diff] [blame] | 91 | // 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 Gaillard | 86eb0b2 | 2019-08-30 14:36:39 +0100 | [diff] [blame] | 94 | cc_library { |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 95 | name: "libicuuc", |
| 96 | host_supported: true, |
| 97 | unique_host_soname: true, |
| 98 | defaults: ["libicuuc_defaults"], |
Victor Chang | aaf6845 | 2020-05-05 16:02:45 +0100 | [diff] [blame] | 99 | apex_available: [ |
| 100 | "com.android.i18n", |
| 101 | ], |
Jerome Gaillard | 001c3eb | 2018-12-06 11:58:40 +0000 | [diff] [blame] | 102 | target: { |
| 103 | android: { |
Jerome Gaillard | 86eb0b2 | 2019-08-30 14:36:39 +0100 | [diff] [blame] | 104 | static: { |
| 105 | enabled: false, |
| 106 | }, |
Jerome Gaillard | 001c3eb | 2018-12-06 11:58:40 +0000 | [diff] [blame] | 107 | }, |
Jerome Gaillard | d3494e9 | 2020-03-10 15:15:26 +0000 | [diff] [blame] | 108 | windows_x86_64: { |
| 109 | dist: { |
| 110 | targets: ["layoutlib"], |
| 111 | dir: "layoutlib_native/windows", |
| 112 | }, |
| 113 | }, |
Jerome Gaillard | 001c3eb | 2018-12-06 11:58:40 +0000 | [diff] [blame] | 114 | }, |
Paul Duffin | 22d367a | 2019-06-25 12:06:26 +0100 | [diff] [blame] | 115 | header_libs: ["libicuuc_headers"], |
| 116 | export_header_lib_headers: ["libicuuc_headers"], |
Dan Willemsen | 14ca649 | 2016-08-31 23:43:08 -0700 | [diff] [blame] | 117 | } |
Victor Chang | 7322950 | 2020-09-17 13:39:19 +0100 | [diff] [blame] | 118 | |
| 119 | cc_library_shared { |
| 120 | name: "libicuuc_cts_stub", |
| 121 | defaults: ["libicuuc_defaults"], |
| 122 | host_supported: false, |
Victor Chang | 7322950 | 2020-09-17 13:39:19 +0100 | [diff] [blame] | 123 | installable: false, |
| 124 | stem: "libicuuc", |
| 125 | header_libs: ["libicuuc_headers"], |
| 126 | visibility: ["//external/icu:__subpackages__"], |
| 127 | } |