blob: c5341e0213eeb305b2f59ffd6082d7bad0a8ee93 [file] [log] [blame]
Colin Cross09975c32017-08-29 15:01:05 -07001// 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
21cc_defaults {
22 name: "core_native_default_flags",
23 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -070024 cflags: [
25 "-Wall",
26 "-Wextra",
27 "-Werror",
28 ],
Logan Chien568c0bc2018-02-27 16:03:04 +080029 cppflags: ["-DU_USING_ICU_NAMESPACE=0"],
Colin Cross09975c32017-08-29 15:01:05 -070030
31 target: {
32 darwin: {
33 enabled: false,
34 },
35 },
36}
37
38cc_defaults {
39 name: "core_native_default_libs",
Colin Cross09975c32017-08-29 15:01:05 -070040
41 shared_libs: [
Vladimir Marko26a4cb82018-06-07 14:57:30 +000042 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070043 "liblog",
44 "libnativehelper",
45 ],
46}
47
48cc_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 Chien568c0bc2018-02-27 16:03:04 +080056 "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp",
Colin Cross09975c32017-08-29 15:01:05 -070057 ],
Colin Cross09975c32017-08-29 15:01:05 -070058 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +000059 "libandroidio",
Vladimir Marko26a4cb82018-06-07 14:57:30 +000060 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070061 "libcrypto",
62 "libexpat",
63 "libicuuc",
64 "libicui18n",
65 "libnativehelper",
Dan Willemsen82553c72017-09-27 16:22:54 -070066 "libz",
Colin Cross09975c32017-08-29 15:01:05 -070067 ],
68 static_libs: [
69 "libziparchive",
Colin Cross09975c32017-08-29 15:01:05 -070070 ],
Victor Change05511a2018-11-26 17:26:39 +000071 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 Cross09975c32017-08-29 15:01:05 -070081}
82
Pete Bentleyc2d71642019-02-22 17:20:03 +000083cc_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 Cross09975c32017-08-29 15:01:05 -0700100cc_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 Bentleydfc8ce02019-02-06 10:58:56 +0000107 include_dirs: [
108 "libcore/luni/src/main/native",
109 ],
Colin Cross09975c32017-08-29 15:01:05 -0700110 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 Cross09975c32017-08-29 15:01:05 -0700119 ],
120
121 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +0000122 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -0700123 "libcrypto",
124 "libicuuc",
Colin Cross09975c32017-08-29 15:01:05 -0700125 "libnativehelper",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000126 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700127 ],
128 static_libs: ["libfdlibm"],
129
130 target: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700131 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700132 cflags: [ // Sigh.
133 "-D_LARGEFILE64_SOURCE",
134 "-D_GNU_SOURCE",
135 "-DLINUX",
136 "-D__GLIBC__",
137 ],
138 },
Victor Change05511a2018-11-26 17:26:39 +0000139 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 Cross09975c32017-08-29 15:01:05 -0700147 },
148
149 notice: "ojluni/NOTICE",
150}
151
152cc_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.
161cc_library_shared {
162 name: "libopenjdkd",
163 defaults: ["libopenjdk_native_defaults"],
164 shared_libs: [
165 "libopenjdkjvmd",
166 ],
167}
168
169// Test JNI library.
170cc_library_shared {
171 name: "libjavacoretests",
172 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800173 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700174
175 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000176 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700177 "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 Thiererd430cc72017-11-01 14:35:40 +0000180 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700181 ],
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.
197cc_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.
210cc_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
220subdirs = [
221 "luni/src/main/native",
222 "ojluni/src/main/native",
223]