blob: 38f57b364f5f3cf239d5663015648a1beca9c1c3 [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 ],
dimitryb026bae2019-03-20 13:25:28 +0100146 shared_libs: [
147 "libdl_android",
148 ],
Victor Change05511a2018-11-26 17:26:39 +0000149 },
Colin Cross09975c32017-08-29 15:01:05 -0700150 },
151
152 notice: "ojluni/NOTICE",
153}
154
155cc_library_shared {
156 name: "libopenjdk",
157 defaults: ["libopenjdk_native_defaults"],
158 shared_libs: [
159 "libopenjdkjvm",
160 ],
161}
162
163// Debug version of libopenjdk. Depends on libopenjdkjvmd.
164cc_library_shared {
165 name: "libopenjdkd",
166 defaults: ["libopenjdk_native_defaults"],
167 shared_libs: [
168 "libopenjdkjvmd",
169 ],
170}
171
172// Test JNI library.
173cc_library_shared {
174 name: "libjavacoretests",
175 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800176 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700177
178 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000179 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700180 "luni/src/test/native/libcore_java_io_FileTest.cpp",
181 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
182 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000183 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700184 ],
185 target: {
186 android: {
187 shared_libs: ["libnativehelper_compat_libc++"],
188 },
189 host: {
190 shared_libs: ["libnativehelper"],
191 },
192 },
193
194 strip: {
195 keep_symbols: true,
196 },
197}
198
199// Set of gtest unit tests.
200cc_test {
201 name: "libjavacore-unit-tests",
202 defaults: ["core_native_default_flags"],
203
204 // Add -fno-builtin so that the compiler doesn't attempt to inline
205 // memcpy calls that are not really aligned.
206 cflags: ["-fno-builtin"],
207 srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"],
208
209 shared_libs: ["libnativehelper"],
210}
211
212// Set of benchmarks for libjavacore functions.
213cc_benchmark {
214 name: "libjavacore-benchmarks",
215 defaults: ["core_native_default_flags"],
216
217 srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"],
218 test_suites: ["device-tests"],
219
220 shared_libs: ["libnativehelper"],
221}
222
223subdirs = [
224 "luni/src/main/native",
225 "ojluni/src/main/native",
226]