1# Interface library 2cc_library( 3 name = "aemu-base-headers", 4 hdrs = glob([ 5 "include/**/*.h", 6 "include/**/*.hpp", 7 ]), 8 defines = select({ 9 "@platforms//os:windows": [ 10 "WIN32_LEAN_AND_MEAN", 11 ], 12 "//conditions:default": [], 13 }), 14 includes = ["include"], 15 visibility = ["//visibility:public"], 16 deps = [ 17 "//hardware/google/aemu/host-common:aemu-host-common-headers", 18 "@com_google_absl//absl/strings:str_format", 19 ] + select({ 20 "@platforms//os:windows": [ 21 "//hardware/google/aemu/windows:compat-hdrs", 22 ], 23 "//conditions:default": [], 24 }), 25) 26 27cc_library( 28 name = "aemu-base-metrics", 29 srcs = ["Metrics.cpp"], 30 visibility = ["//visibility:public"], 31 deps = [":aemu-base-headers"], 32) 33 34cc_library( 35 name = "aemu-base-allocator", 36 srcs = ["SubAllocator.cpp"], 37 visibility = ["//visibility:public"], 38 deps = [":aemu-base-headers"], 39) 40 41objc_library( 42 name = "aemu-base-darwin", 43 srcs = [ 44 "system-native-mac.mm", 45 ], 46 sdk_frameworks = [ 47 "IOkit", 48 "AppKit", 49 ], 50 deps = [":aemu-base-headers"], 51 alwayslink = True, 52) 53 54cc_library( 55 name = "aemu-base", 56 srcs = [ 57 "AlignedBuf.cpp", 58 "CLog.cpp", 59 "CompressingStream.cpp", 60 "CpuTime.cpp", 61 "DecompressingStream.cpp", 62 "FileUtils.cpp", 63 "FunctorThread.cpp", 64 "GLObjectCounter.cpp", 65 "GraphicsObjectCounter.cpp", 66 "HealthMonitor.cpp", 67 "LayoutResolver.cpp", 68 "MemStream.cpp", 69 "MemoryTracker.cpp", 70 "MessageChannel.cpp", 71 "PathUtils.cpp", 72 "SharedLibrary.cpp", 73 "StdioStream.cpp", 74 "Stream.cpp", 75 "StreamSerializing.cpp", 76 "StringFormat.cpp", 77 "SubAllocator.cpp", 78 "System.cpp", 79 "Tracing.cpp", 80 "ring_buffer.cpp", 81 ] + select({ 82 "@platforms//os:windows": [ 83 "SharedMemory_win32.cpp", 84 "Thread_win32.cpp", 85 "Win32UnicodeString.cpp", 86 ], 87 "@platforms//os:macos": [ 88 "SharedMemory_posix.cpp", 89 "Thread_pthread.cpp", 90 ], 91 "@platforms//os:linux": [ 92 "SharedMemory_posix.cpp", 93 "Thread_pthread.cpp", 94 ], 95 }), 96 defines = [ 97 "BUILDING_EMUGL_COMMON_SHARED", 98 "LOGGING_API_SHARED", 99 ] + select({ 100 "@platforms//os:windows": [ 101 "WIN32_LEAN_AND_MEAN", 102 ], 103 "//conditions:default": [], 104 }), 105 linkopts = select({ 106 "@platforms//os:linux": [ 107 "-ldl", 108 "-lrt", 109 ], 110 "@platforms//os:windows": [ 111 "-DEFAULTLIB:Shlwapi.lib", 112 ], 113 "@platforms//os:macos": [ 114 "-framework Foundation", 115 "-framework AppKit", 116 "-framework IOKit", 117 ], 118 "//conditions:default": [], 119 }), 120 visibility = ["//visibility:public"], 121 deps = [ 122 ":aemu-base-headers", 123 ":aemu-base-metrics", 124 "//external/lz4", 125 "//hardware/google/aemu/host-common:logging", 126 ] + select({ 127 "@platforms//os:macos": [ 128 ":aemu-base-darwin", 129 ], 130 "@platforms//os:windows": [ 131 "//external/qemu/google/compat/windows:compat", 132 ], 133 "//conditions:default": [], 134 }), 135) 136 137cc_library( 138 name = "test-io", 139 srcs = [ 140 "testing/file_io.cpp", 141 ], 142 visibility = [ 143 "//visibility:public", 144 ], 145 deps = [ 146 ":aemu-base", 147 ":aemu-base-headers", 148 ], 149 alwayslink = True, 150) 151 152cc_library( 153 name = "test-matchers", 154 srcs = [ 155 "testing/ProtobufMatchers.cpp", 156 ], 157 visibility = [ 158 "//visibility:public", 159 ], 160 deps = [ 161 ":aemu-base", 162 ":aemu-base-headers", 163 "@com_google_absl//absl/log", 164 "@com_google_absl//absl/log:check", 165 "@com_google_googletest//:gtest", 166 "@com_google_protobuf//:protobuf", 167 ], 168 alwayslink = True, 169) 170 171cc_test( 172 name = "aemu-base_unittests", 173 srcs = [ 174 "AlignedBuf_unittest.cpp", 175 "ArraySize_unittest.cpp", 176 "HealthMonitor_unittest.cpp", 177 "HybridEntityManager_unittest.cpp", 178 "LayoutResolver_unittest.cpp", 179 "LruCache_unittest.cpp", 180 "ManagedDescriptor_unittest.cpp", 181 "NoDestructor_unittest.cpp", 182 "Optional_unittest.cpp", 183 "RecurrentTask_unittest.cpp", 184 "StringFormat_unittest.cpp", 185 "SubAllocator_unittest.cpp", 186 "TypeTraits_unittest.cpp", 187 "WorkerThread_unittest.cpp", 188 "ring_buffer_unittest.cpp", 189 ] + select({ 190 "@platforms//os:windows": [ 191 "Win32UnicodeString_unittest.cpp", 192 ], 193 "//conditions:default": [], 194 }), 195 linkopts = [ 196 "-undefined error", 197 ], 198 deps = [ 199 ":aemu-base", 200 ":aemu-base-headers", 201 "//hardware/generic/goldfish/android/logging:backend", 202 "//hardware/generic/goldfish/android/looper", 203 "//hardware/generic/goldfish/android/sockets", 204 "//hardware/google/aemu/base:aemu-base-metrics", 205 "//hardware/google/aemu/host-common:logging", 206 "@com_google_absl//absl/log", 207 "@com_google_absl//absl/strings", 208 "@com_google_absl//absl/strings:str_format", 209 "@com_google_googletest//:gtest_main", 210 ], 211) 212