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