Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 1 | // Copyright (C) 2007 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 | // Definitions for building the native code needed for the core library. |
| 17 | // |
| 18 | |
| 19 | // Defaults that apply to all of the modules |
| 20 | |
| 21 | cc_defaults { |
| 22 | name: "core_native_default_flags", |
| 23 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 24 | cflags: [ |
| 25 | "-Wall", |
| 26 | "-Wextra", |
| 27 | "-Werror", |
| 28 | ], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 29 | cppflags: ["-DU_USING_ICU_NAMESPACE=0"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 30 | |
| 31 | target: { |
| 32 | darwin: { |
| 33 | enabled: false, |
| 34 | }, |
| 35 | }, |
| 36 | } |
| 37 | |
| 38 | cc_defaults { |
| 39 | name: "core_native_default_libs", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 40 | |
| 41 | shared_libs: [ |
Vladimir Marko | 26a4cb8 | 2018-06-07 14:57:30 +0000 | [diff] [blame] | 42 | "libbase", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 43 | "liblog", |
| 44 | "libnativehelper", |
| 45 | ], |
| 46 | } |
| 47 | |
| 48 | cc_library_shared { |
| 49 | name: "libjavacore", |
| 50 | defaults: [ |
| 51 | "core_native_default_flags", |
| 52 | "core_native_default_libs", |
| 53 | ], |
| 54 | srcs: [ |
| 55 | ":luni_native_srcs", |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 56 | "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 57 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 58 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 59 | "libandroidio", |
Vladimir Marko | 26a4cb8 | 2018-06-07 14:57:30 +0000 | [diff] [blame] | 60 | "libbase", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 61 | "libcrypto", |
| 62 | "libexpat", |
| 63 | "libicuuc", |
| 64 | "libicui18n", |
| 65 | "libnativehelper", |
Dan Willemsen | 82553c7 | 2017-09-27 16:22:54 -0700 | [diff] [blame] | 66 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 67 | ], |
| 68 | static_libs: [ |
Neil Fuller | 514286e | 2019-06-12 13:52:19 +0100 | [diff] [blame^] | 69 | "libandroidicuinit", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 70 | "libziparchive", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 71 | ], |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 72 | target: { |
| 73 | android: { |
| 74 | cflags: [ |
| 75 | // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C. |
| 76 | // See external/icu/android_icu4c/include/uconfig_local.h |
| 77 | // for more information. |
| 78 | "-DANDROID_LINK_SHARED_ICU4C", |
| 79 | ], |
| 80 | }, |
| 81 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 82 | } |
| 83 | |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 84 | cc_library_shared { |
| 85 | name: "libandroidio", |
| 86 | defaults: [ |
| 87 | "core_native_default_flags", |
| 88 | ], |
| 89 | shared_libs: [ |
| 90 | "liblog", |
| 91 | ], |
| 92 | srcs: [ |
| 93 | ":libandroidio_srcs", |
| 94 | ], |
| 95 | stubs: { |
| 96 | symbol_file: "libandroidio.map.txt", |
| 97 | versions: ["1"], |
| 98 | }, |
| 99 | } |
| 100 | |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 101 | cc_defaults { |
| 102 | name: "libopenjdk_native_defaults", |
| 103 | defaults: [ |
| 104 | "core_native_default_flags", |
| 105 | "core_native_default_libs", |
| 106 | ], |
| 107 | srcs: [":libopenjdk_native_srcs"], |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 108 | include_dirs: [ |
| 109 | "libcore/luni/src/main/native", |
| 110 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 111 | cflags: [ |
| 112 | // TODO(narayan): Prune down this list of exclusions once the underlying |
| 113 | // issues have been fixed. Most of these are small changes except for |
| 114 | // -Wunused-parameter. |
| 115 | "-Wno-unused-parameter", |
| 116 | "-Wno-unused-variable", |
| 117 | "-Wno-parentheses-equality", |
| 118 | "-Wno-constant-logical-operand", |
| 119 | "-Wno-sometimes-uninitialized", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 120 | ], |
| 121 | |
| 122 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 123 | "libandroidio", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 124 | "libcrypto", |
| 125 | "libicuuc", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 126 | "libnativehelper", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 127 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 128 | ], |
| 129 | static_libs: ["libfdlibm"], |
| 130 | |
| 131 | target: { |
Dan Willemsen | 7f7768f | 2017-10-02 10:41:10 -0700 | [diff] [blame] | 132 | linux_glibc: { |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 133 | cflags: [ // Sigh. |
| 134 | "-D_LARGEFILE64_SOURCE", |
| 135 | "-D_GNU_SOURCE", |
| 136 | "-DLINUX", |
| 137 | "-D__GLIBC__", |
| 138 | ], |
| 139 | }, |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 140 | android: { |
| 141 | cflags: [ |
| 142 | // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C. |
| 143 | // See external/icu/android_icu4c/include/uconfig_local.h |
| 144 | // for more information. |
| 145 | "-DANDROID_LINK_SHARED_ICU4C", |
| 146 | ], |
dimitry | 4f59904 | 2019-03-20 13:25:28 +0100 | [diff] [blame] | 147 | shared_libs: [ |
| 148 | "libdl_android", |
| 149 | ], |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 150 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 151 | }, |
| 152 | |
| 153 | notice: "ojluni/NOTICE", |
| 154 | } |
| 155 | |
| 156 | cc_library_shared { |
| 157 | name: "libopenjdk", |
| 158 | defaults: ["libopenjdk_native_defaults"], |
| 159 | shared_libs: [ |
| 160 | "libopenjdkjvm", |
| 161 | ], |
| 162 | } |
| 163 | |
| 164 | // Debug version of libopenjdk. Depends on libopenjdkjvmd. |
| 165 | cc_library_shared { |
| 166 | name: "libopenjdkd", |
| 167 | defaults: ["libopenjdk_native_defaults"], |
| 168 | shared_libs: [ |
| 169 | "libopenjdkjvmd", |
| 170 | ], |
| 171 | } |
| 172 | |
| 173 | // Test JNI library. |
| 174 | cc_library_shared { |
| 175 | name: "libjavacoretests", |
| 176 | defaults: ["core_native_default_flags"], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 177 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 178 | |
| 179 | srcs: [ |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 180 | "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 181 | "luni/src/test/native/libcore_java_io_FileTest.cpp", |
| 182 | "luni/src/test/native/libcore_java_lang_ThreadTest.cpp", |
| 183 | "luni/src/test/native/libcore_java_nio_BufferTest.cpp", |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 184 | "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 185 | ], |
| 186 | target: { |
| 187 | android: { |
| 188 | shared_libs: ["libnativehelper_compat_libc++"], |
| 189 | }, |
| 190 | host: { |
| 191 | shared_libs: ["libnativehelper"], |
| 192 | }, |
| 193 | }, |
| 194 | |
| 195 | strip: { |
| 196 | keep_symbols: true, |
| 197 | }, |
| 198 | } |
| 199 | |
| 200 | // Set of gtest unit tests. |
| 201 | cc_test { |
| 202 | name: "libjavacore-unit-tests", |
| 203 | defaults: ["core_native_default_flags"], |
| 204 | |
| 205 | // Add -fno-builtin so that the compiler doesn't attempt to inline |
| 206 | // memcpy calls that are not really aligned. |
| 207 | cflags: ["-fno-builtin"], |
| 208 | srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"], |
| 209 | |
| 210 | shared_libs: ["libnativehelper"], |
| 211 | } |
| 212 | |
| 213 | // Set of benchmarks for libjavacore functions. |
| 214 | cc_benchmark { |
| 215 | name: "libjavacore-benchmarks", |
| 216 | defaults: ["core_native_default_flags"], |
| 217 | |
| 218 | srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"], |
| 219 | test_suites: ["device-tests"], |
| 220 | |
| 221 | shared_libs: ["libnativehelper"], |
| 222 | } |
| 223 | |
| 224 | subdirs = [ |
| 225 | "luni/src/main/native", |
| 226 | "ojluni/src/main/native", |
| 227 | ] |