1// 2// Copyright (C) 2011 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17cc_defaults { 18 name: "libartbase_defaults", 19 defaults: ["art_defaults"], 20 host_supported: true, 21 srcs: [ 22 "arch/instruction_set.cc", 23 "base/allocator.cc", 24 "base/arena_allocator.cc", 25 "base/arena_bit_vector.cc", 26 "base/bit_vector.cc", 27 "base/enums.cc", 28 "base/file_magic.cc", 29 "base/file_utils.cc", 30 "base/hex_dump.cc", 31 "base/hiddenapi_flags.cc", 32 "base/logging.cc", 33 "base/malloc_arena_pool.cc", 34 "base/membarrier.cc", 35 "base/memfd.cc", 36 "base/memory_region.cc", 37 "base/mem_map.cc", 38 // "base/mem_map_fuchsia.cc", put in target when fuchsia supported by soong 39 "base/os_linux.cc", 40 "base/runtime_debug.cc", 41 "base/safe_copy.cc", 42 "base/scoped_arena_allocator.cc", 43 "base/scoped_flock.cc", 44 "base/socket_peer_is_trusted.cc", 45 "base/time_utils.cc", 46 "base/unix_file/fd_file.cc", 47 "base/unix_file/random_access_file_utils.cc", 48 "base/utils.cc", 49 "base/zip_archive.cc", 50 ], 51 target: { 52 android: { 53 srcs: [ 54 "base/mem_map_unix.cc", 55 ], 56 static_libs: [ 57 // ZipArchive support, the order matters here to get all symbols. 58 "libziparchive", 59 "libz", 60 ], 61 shared_libs: [ 62 "liblog", 63 // For ashmem. 64 "libartpalette", 65 // For common macros. 66 "libbase", 67 ], 68 export_shared_lib_headers: ["libbase"], 69 // Exclude the version script from Darwin host since it's not 70 // supported by the linker there. That means ASan checks on Darwin 71 // might trigger ODR violations. 72 version_script: "libartbase.map", 73 }, 74 not_windows: { 75 srcs: [ 76 "base/mem_map_unix.cc", 77 ], 78 shared_libs: [ 79 "libziparchive", 80 "libz", 81 "liblog", 82 // For ashmem. 83 "libartpalette", 84 // For common macros. 85 "libbase", 86 ], 87 export_shared_lib_headers: ["libbase"], 88 }, 89 linux_glibc: { 90 version_script: "libartbase.map", 91 }, 92 windows: { 93 version_script: "libartbase.map", 94 srcs: [ 95 "base/mem_map_windows.cc", 96 ], 97 static_libs: [ 98 "libziparchive", 99 "libz", 100 "liblog", 101 // For ashmem. 102 "libartpalette", 103 // For common macros. 104 "libbase", 105 ], 106 export_static_lib_headers: ["libbase"], 107 cflags: ["-Wno-thread-safety"], 108 }, 109 darwin: { 110 enabled: true, // for libdexfile. 111 }, 112 }, 113 generated_sources: ["art_libartbase_operator_srcs"], 114 cflags: ["-DBUILDING_LIBART=1"], 115 116 // Utilities used by various ART libs and tools are linked in statically 117 // here to avoid shared lib dependencies outside the ART APEX. No target 118 // there should depend on these separately. 119 whole_static_libs: [ 120 "liblz4", 121 "liblzma", 122 ], 123 124 export_include_dirs: ["."], 125 // ART's macros.h depends on libbase's macros.h. 126 // Note: runtime_options.h depends on cmdline. But we don't really want to export this 127 // generically. dex2oat takes care of it itself. 128} 129 130cc_defaults { 131 name: "libartbase_static_base_defaults", 132 static_libs: [ 133 "libbase", 134 "libartpalette", 135 "liblog", 136 "libz", 137 "libziparchive", 138 ], 139} 140 141cc_defaults { 142 name: "libartbase_static_defaults", 143 defaults: ["libartbase_static_base_defaults"], 144 static_libs: ["libartbase"], 145} 146 147cc_defaults { 148 name: "libartbased_static_defaults", 149 defaults: ["libartbase_static_base_defaults"], 150 static_libs: ["libartbased"], 151} 152 153gensrcs { 154 name: "art_libartbase_operator_srcs", 155 cmd: "$(location generate_operator_out) art/libartbase $(in) > $(out)", 156 tools: ["generate_operator_out"], 157 srcs: [ 158 "arch/instruction_set.h", 159 "base/allocator.h", 160 "base/unix_file/fd_file.h", 161 ], 162 output_extension: "operator_out.cc", 163} 164 165art_cc_library { 166 name: "libartbase", 167 defaults: ["libartbase_defaults"], 168 // Leave the symbols in the shared library so that stack unwinders can 169 // produce meaningful name resolution. 170 strip: { 171 keep_symbols: true, 172 }, 173 shared_libs: [ 174 "libbase", 175 "libziparchive", 176 ], 177 export_shared_lib_headers: ["libbase"], 178 target: { 179 windows: { 180 enabled: true, 181 shared: { 182 enabled: false, 183 }, 184 }, 185 }, 186} 187 188art_cc_library { 189 name: "libartbased", 190 defaults: [ 191 "art_debug_defaults", 192 "libartbase_defaults", 193 ], 194 shared_libs: [ 195 "libbase", 196 "libziparchive", 197 ], 198 export_shared_lib_headers: ["libbase"], 199 target: { 200 windows: { 201 enabled: true, 202 shared: { 203 enabled: false, 204 }, 205 }, 206 }, 207} 208 209art_cc_library { 210 name: "libartbase-art-gtest", 211 defaults: ["libart-gtest-defaults"], 212 srcs: [ 213 "base/common_art_test.cc", 214 ], 215 shared_libs: [ 216 "libartbased", 217 "libdexfiled", 218 "libbase", 219 "libbacktrace", 220 ], 221 header_libs: [ 222 "libnativehelper_header_only", 223 ], 224} 225 226art_cc_test { 227 name: "art_libartbase_tests", 228 defaults: [ 229 "art_gtest_defaults", 230 ], 231 srcs: [ 232 "arch/instruction_set_test.cc", 233 "base/arena_allocator_test.cc", 234 "base/bit_field_test.cc", 235 "base/bit_memory_region_test.cc", 236 "base/bit_string_test.cc", 237 "base/bit_struct_test.cc", 238 "base/bit_table_test.cc", 239 "base/bit_utils_test.cc", 240 "base/bit_vector_test.cc", 241 "base/file_utils_test.cc", 242 "base/hash_set_test.cc", 243 "base/hex_dump_test.cc", 244 "base/histogram_test.cc", 245 "base/indenter_test.cc", 246 "base/leb128_test.cc", 247 "base/logging_test.cc", 248 "base/memfd_test.cc", 249 "base/membarrier_test.cc", 250 "base/memory_region_test.cc", 251 "base/mem_map_test.cc", 252 "base/memory_type_table_test.cc", 253 "base/safe_copy_test.cc", 254 "base/scoped_flock_test.cc", 255 "base/time_utils_test.cc", 256 "base/transform_array_ref_test.cc", 257 "base/transform_iterator_test.cc", 258 "base/unix_file/fd_file_test.cc", 259 "base/utils_test.cc", 260 "base/variant_map_test.cc", 261 "base/zip_archive_test.cc", 262 ], 263 shared_libs: [ 264 "libbase", 265 ], 266} 267 268cc_library_headers { 269 name: "art_libartbase_headers", 270 host_supported: true, 271 export_include_dirs: ["."], 272 shared_libs: ["libbase"], 273 export_shared_lib_headers: ["libbase"], 274} 275