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