blob: f3b4217077efbfce812059150a7ee9e3e9cf3b8e [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: [
Vladimir Marko26a4cb82018-06-07 14:57:30 +000059 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070060 "libcrypto",
61 "libexpat",
62 "libicuuc",
63 "libicui18n",
64 "libnativehelper",
Dan Willemsen82553c72017-09-27 16:22:54 -070065 "libz",
Colin Cross09975c32017-08-29 15:01:05 -070066 ],
67 static_libs: [
68 "libziparchive",
Colin Cross09975c32017-08-29 15:01:05 -070069 ],
Victor Change05511a2018-11-26 17:26:39 +000070 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 Cross09975c32017-08-29 15:01:05 -070080}
81
82cc_defaults {
83 name: "libopenjdk_native_defaults",
84 defaults: [
85 "core_native_default_flags",
86 "core_native_default_libs",
87 ],
88 srcs: [":libopenjdk_native_srcs"],
89 cflags: [
90 // TODO(narayan): Prune down this list of exclusions once the underlying
91 // issues have been fixed. Most of these are small changes except for
92 // -Wunused-parameter.
93 "-Wno-unused-parameter",
94 "-Wno-unused-variable",
95 "-Wno-parentheses-equality",
96 "-Wno-constant-logical-operand",
97 "-Wno-sometimes-uninitialized",
Colin Cross09975c32017-08-29 15:01:05 -070098 ],
99
100 shared_libs: [
101 "libcrypto",
102 "libicuuc",
Dan Willemsen82553c72017-09-27 16:22:54 -0700103 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700104
105 "libnativehelper",
106 ],
107 static_libs: ["libfdlibm"],
108
109 target: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700110 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700111 cflags: [ // Sigh.
112 "-D_LARGEFILE64_SOURCE",
113 "-D_GNU_SOURCE",
114 "-DLINUX",
115 "-D__GLIBC__",
116 ],
117 },
Victor Change05511a2018-11-26 17:26:39 +0000118 android: {
119 cflags: [
120 // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
121 // See external/icu/android_icu4c/include/uconfig_local.h
122 // for more information.
123 "-DANDROID_LINK_SHARED_ICU4C",
124 ],
125 },
Colin Cross09975c32017-08-29 15:01:05 -0700126 },
127
128 notice: "ojluni/NOTICE",
129}
130
131cc_library_shared {
132 name: "libopenjdk",
133 defaults: ["libopenjdk_native_defaults"],
134 shared_libs: [
135 "libopenjdkjvm",
136 ],
137}
138
139// Debug version of libopenjdk. Depends on libopenjdkjvmd.
140cc_library_shared {
141 name: "libopenjdkd",
142 defaults: ["libopenjdk_native_defaults"],
143 shared_libs: [
144 "libopenjdkjvmd",
145 ],
146}
147
148// Test JNI library.
149cc_library_shared {
150 name: "libjavacoretests",
151 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800152 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700153
154 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000155 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700156 "luni/src/test/native/libcore_java_io_FileTest.cpp",
157 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
158 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000159 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700160 ],
161 target: {
162 android: {
163 shared_libs: ["libnativehelper_compat_libc++"],
164 },
165 host: {
166 shared_libs: ["libnativehelper"],
167 },
168 },
169
170 strip: {
171 keep_symbols: true,
172 },
173}
174
175// Set of gtest unit tests.
176cc_test {
177 name: "libjavacore-unit-tests",
178 defaults: ["core_native_default_flags"],
179
180 // Add -fno-builtin so that the compiler doesn't attempt to inline
181 // memcpy calls that are not really aligned.
182 cflags: ["-fno-builtin"],
183 srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"],
184
185 shared_libs: ["libnativehelper"],
186}
187
188// Set of benchmarks for libjavacore functions.
189cc_benchmark {
190 name: "libjavacore-benchmarks",
191 defaults: ["core_native_default_flags"],
192
193 srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"],
194 test_suites: ["device-tests"],
195
196 shared_libs: ["libnativehelper"],
197}
198
199subdirs = [
200 "luni/src/main/native",
201 "ojluni/src/main/native",
202]