1# Logging library
2cc_library(
3    name = "logging-qemu2",
4    srcs = [
5        "GfxstreamFatalError.cpp",
6        "logging.cpp",
7    ],
8    hdrs = ["include/host-common/logging.h"],
9    defines = [
10        "BUILDING_EMUGL_COMMON_SHARED",
11    ] + select({
12        "@platforms//os:windows": [
13            "WIN32_LEAN_AND_MEAN",
14        ],
15        "//conditions:default": [],
16    }),
17    includes = ["include/host-common"],
18    visibility = ["//visibility:public"],
19    deps = [
20        ":aemu-host-common-headers",
21        "//hardware/google/aemu/base:aemu-base-headers",
22        "//hardware/google/aemu/base:aemu-base-metrics",
23    ],
24)
25
26cc_library(
27    name = "logging",
28    srcs = [
29        "GfxstreamFatalErrorAbsl.cpp",
30        "logging_absl.cpp",
31    ],
32    hdrs = ["include/host-common/logging.h"],
33    defines = [
34        "BUILDING_EMUGL_COMMON_SHARED",
35    ] + select({
36        "@platforms//os:windows": [
37            "WIN32_LEAN_AND_MEAN",
38        ],
39        "//conditions:default": [],
40    }),
41    includes = ["include/host-common"],
42    visibility = ["//visibility:public"],
43    deps = [
44        ":aemu-host-common-headers",
45        "//hardware/google/aemu/base:aemu-base-headers",
46        "//hardware/google/aemu/base:aemu-base-metrics",
47        "@com_google_absl//absl/log",
48        "@com_google_absl//absl/log:absl_log",
49    ],
50)
51
52cc_library(
53    name = "aemu-host-common-headers",
54    hdrs = glob([
55        "include/**/*.h",
56        "include/**/*.hpp",
57    ]),
58    includes = ["include"],
59    visibility = ["//visibility:public"],
60)
61
62# Standalone Library (conditional)
63cc_library(
64    name = "aemu-host-common",
65    srcs = [
66        "AndroidPipe.cpp",
67        "DmaMap.cpp",
68        "GoldfishDma.cpp",
69        "GoldfishSyncCommandQueue.cpp",
70        "GraphicsAgentFactory.cpp",
71        "HostmemIdMapping.cpp",
72        "RefcountPipe.cpp",
73        "address_space_device.cpp",
74        "address_space_device_control_ops.cpp",
75        "address_space_graphics.cpp",
76        "address_space_host_media.cpp",
77        "address_space_host_memory_allocator.cpp",
78        "address_space_shared_slots_host_memory_allocator.cpp",
79        "crash_reporter.cpp",
80        "dma_device.cpp",
81        "empty-crash-handler.cpp",
82        "feature_control.cpp",
83        "goldfish_sync.cpp",
84        "hw-config.cpp",
85        "misc.cpp",
86        "sync_device.cpp",
87        "vm_operations.cpp",
88        "window_operations.cpp",
89    ],
90    hdrs = [":aemu-host-common-headers"],
91    copts = [
92        "-Wno-return-type-c-linkage",
93        "-Wno-extern-c-compat",
94    ],
95    defines = [
96        "BUILDING_EMUGL_COMMON_SHARED",
97    ] + select({
98        "@platforms//os:windows": [
99            "WIN32_LEAN_AND_MEAN",
100        ],
101        "//conditions:default": [],
102    }),
103    visibility = ["//visibility:public"],
104    deps = [
105        ":aemu-host-common-headers",
106        ":logging",
107        "//hardware/google/aemu/base:aemu-base-allocator",
108        "//hardware/google/aemu/base:aemu-base-headers",
109    ],
110    alwayslink = 1,
111)
112
113# Override Library
114cc_library(
115    name = "aemu-host-common-product-feature-override",
116    srcs = ["FeatureControlOverride.cpp"],
117    hdrs = glob(["include/**/*.h"]),
118    defines = [
119        "BUILDING_EMUGL_COMMON_SHARED",
120    ] + select({
121        "@platforms//os:windows": [
122            "WIN32_LEAN_AND_MEAN",
123        ],
124        "//conditions:default": [],
125    }),
126    includes = ["include"],
127    visibility = ["//visibility:public"],
128    deps = [
129        ":aemu-host-common-headers",
130        "//hardware/google/aemu/base:aemu-base-headers",
131    ],
132)
133
134cc_library(
135    name = "aemu-host-common-testing-support",
136    srcs = [
137        "testing/HostAddressSpace.cpp",
138        "testing/MockAndroidEmulatorWindowAgent.cpp",
139        "testing/MockAndroidMultiDisplayAgent.cpp",
140        "testing/MockAndroidVmOperations.cpp",
141        "testing/MockGraphicsAgentFactory.cpp",
142    ],
143    hdrs = [
144        "testing/HostAddressSpace.h",
145        "testing/MockAndroidEmulatorWindowAgent.h",
146        "testing/MockAndroidVmOperations.h",
147        "testing/MockGraphicsAgentFactory.h",
148    ],
149    includes = ["testing"],
150    deps = [
151        ":aemu-host-common-headers",
152        "//hardware/google/aemu/base:aemu-base-headers",
153        "@com_google_googletest//:gtest",
154    ],
155)
156
157# Testing Libraries and Executable (conditional)
158cc_test(
159    name = "aemu-host-logging_unittests",
160    srcs =
161        [
162            # "GfxstreamFatalError_unittest.cpp",
163            # "HostAddressSpace_unittest.cpp",
164            # "HostGoldfishPipe_unittest.cpp",
165            # "HostmemIdMapping_unittest.cpp",
166            # "VmLock_unittest.cpp",
167            "logging_absl_unittest.cpp",
168        ] + glob([
169            "testing/**",
170        ]),
171    includes = ["testing"],
172    deps = [
173        ":aemu-host-common-headers",
174        ":logging",
175        "//hardware/google/aemu:aemu-host-common-test-headers",
176        "//hardware/google/aemu/base:aemu-base",
177        "//hardware/google/aemu/base:aemu-base-allocator",
178        "//hardware/google/aemu/base:aemu-base-headers",
179        "//hardware/google/aemu/host-common:aemu-host-common",
180        "@com_google_absl//absl/log",
181        "@com_google_absl//absl/log:absl_log",
182        "@com_google_absl//absl/log:globals",
183        "@com_google_absl//absl/log:initialize",
184        "@com_google_absl//absl/log:log_sink_registry",
185        "@com_google_googletest//:gtest_main",
186    ],
187)
188