aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-03-21 21:05:52 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-03-21 21:05:52 +0000
commit70f260c5d1e65ebce521a36e6b3e2d4477e78e8f (patch)
tree61d32fb0afc56f7017d88b4c61cc681a882d042b
parent1ed9bf08399146945d12c75b0571f9168cca6085 (diff)
parentf5cd69f6bf16597a75bca4f1f0abf70b9ee71892 (diff)
downloadaemu-70f260c5d1e65ebce521a36e6b3e2d4477e78e8f.tar.gz
Merge "Add support for building with bazel" into main
-rw-r--r--BUILD.bazel22
-rw-r--r--base/BUILD.bazel141
-rw-r--r--base/system-native-mac.mm3
-rw-r--r--host-common/BUILD.bazel146
-rw-r--r--snapshot/BUILD.bazel33
5 files changed, 343 insertions, 2 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 0000000..73cb5af
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,22 @@
+load("@rules_license//rules:license.bzl", "license")
+load("@rules_license//rules:license_kind.bzl", "license_kind")
+
+package(
+ default_applicable_licenses = [":license"],
+ default_visibility = ["//visibility:public"],
+)
+
+license(
+ name = "license",
+ license_kinds = [
+ ":SPDX-license-identifier-Apache-2.0",
+ ],
+ license_text = "LICENSE-APACHE",
+ visibility = [":__subpackages__"],
+)
+
+license_kind(
+ name = "SPDX-license-identifier-Apache-2.0",
+ conditions = ["notice"],
+ url = "https://spdx.org/licenses/Apache-2.0.html",
+)
diff --git a/base/BUILD.bazel b/base/BUILD.bazel
new file mode 100644
index 0000000..d199fed
--- /dev/null
+++ b/base/BUILD.bazel
@@ -0,0 +1,141 @@
+# Interface library
+cc_library(
+ name = "aemu-base-headers",
+ hdrs = glob([
+ "include/**/*.h",
+ "include/**/*.hpp",
+ ]),
+ defines = select({
+ "@platforms//os:windows": [
+ "WIN32_LEAN_AND_MEAN",
+ ],
+ "//conditions:default": [],
+ }),
+ includes = ["include"],
+ visibility = ["//visibility:public"],
+ deps = ["//hardware/google/aemu/host-common:aemu-host-common-headers"],
+)
+
+cc_library(
+ name = "aemu-base-metrics",
+ srcs = ["Metrics.cpp"],
+ visibility = ["//visibility:public"],
+ deps = [":aemu-base-headers"],
+)
+
+cc_library(
+ name = "aemu-base-allocator",
+ srcs = ["SubAllocator.cpp"],
+ visibility = ["//visibility:public"],
+ deps = [":aemu-base-headers"],
+)
+
+objc_library(
+ name = "aemu-base-darwin",
+ srcs = [
+ "system-native-mac.mm",
+ ],
+ deps = [":aemu-base-headers"],
+)
+
+cc_library(
+ name = "aemu-base",
+ srcs = [
+ "AlignedBuf.cpp",
+ "CLog.cpp",
+ "CompressingStream.cpp",
+ "CpuTime.cpp",
+ "DecompressingStream.cpp",
+ "FileUtils.cpp",
+ "FunctorThread.cpp",
+ "GLObjectCounter.cpp",
+ "HealthMonitor.cpp",
+ "LayoutResolver.cpp",
+ "MemStream.cpp",
+ "MemoryTracker.cpp",
+ "MessageChannel.cpp",
+ "PathUtils.cpp",
+ "SharedLibrary.cpp",
+ "StdioStream.cpp",
+ "Stream.cpp",
+ "StreamSerializing.cpp",
+ "StringFormat.cpp",
+ "SubAllocator.cpp",
+ "System.cpp",
+ "Tracing.cpp",
+ "ring_buffer.cpp",
+ ] + select({
+ "@platforms//os:windows": [
+ "SharedMemory_win32.cpp",
+ "Thread_win32.cpp",
+ "Win32UnicodeString.cpp",
+ "msvc.cpp",
+ ],
+ "@platforms//os:macos": [
+ "SharedMemory_posix.cpp",
+ "Thread_pthread.cpp",
+ ],
+ "@platforms//os:linux": [
+ "SharedMemory_posix.cpp",
+ "Thread_pthread.cpp",
+ ],
+ }),
+ defines = [
+ "BUILDING_EMUGL_COMMON_SHARED",
+ "LOGGING_API_SHARED",
+ ] + select({
+ "@platforms//os:windows": [
+ "WIN32_LEAN_AND_MEAN",
+ ],
+ "//conditions:default": [],
+ }),
+ linkopts = select({
+ "@platforms//os:linux": [
+ "-ldl",
+ ],
+ "@platforms//os:windows": [
+ "-DEFAULTLIB:Shlwapi.lib",
+ ],
+ "//conditions:default": [],
+ }),
+ visibility = ["//visibility:public"],
+ deps = [
+ ":aemu-base-headers",
+ ":aemu-base-metrics",
+ "//external/lz4",
+ ] + select({
+ "@platforms//os:macos": [
+ ":aemu-base-darwin",
+ ],
+ "//conditions:default": [],
+ }),
+)
+
+cc_test(
+ name = "aemu-base_unittests",
+ srcs = [
+ "AlignedBuf_unittest.cpp",
+ "ArraySize_unittest.cpp",
+ "HealthMonitor_unittest.cpp",
+ "HybridEntityManager_unittest.cpp",
+ "LayoutResolver_unittest.cpp",
+ "LruCache_unittest.cpp",
+ "ManagedDescriptor_unittest.cpp",
+ "Optional_unittest.cpp",
+ "StringFormat_unittest.cpp",
+ "SubAllocator_unittest.cpp",
+ "TypeTraits_unittest.cpp",
+ "WorkerThread_unittest.cpp",
+ "ring_buffer_unittest.cpp",
+ "testing/file_io.cpp",
+ ] + select({
+ "@platforms//os:windows": ["Win32UnicodeString_unittest.cpp"],
+ "//conditions:default": [],
+ }),
+ deps = [
+ ":aemu-base",
+ ":aemu-base-headers",
+ "//hardware/google/aemu/host-common:logging",
+ "@com_google_googletest//:gtest_main",
+ ],
+)
diff --git a/base/system-native-mac.mm b/base/system-native-mac.mm
index f444840..86fa224 100644
--- a/base/system-native-mac.mm
+++ b/base/system-native-mac.mm
@@ -16,11 +16,10 @@
#include "aemu/base/system/Memory.h"
#include "aemu/base/system/System.h"
-#include <Cocoa/Cocoa.h>
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/IOBSD.h>
#include <IOKit/IOKitLib.h>
-#include <Carbon/Carbon.h>
+#include <AppKit/AppKit.h>
#include <IOKit/kext/KextManager.h>
#include <IOKit/storage/IOBlockStorageDevice.h>
diff --git a/host-common/BUILD.bazel b/host-common/BUILD.bazel
new file mode 100644
index 0000000..0be01e0
--- /dev/null
+++ b/host-common/BUILD.bazel
@@ -0,0 +1,146 @@
+# Logging library
+cc_library(
+ name = "logging",
+ srcs = [
+ "GfxstreamFatalError.cpp",
+ "logging.cpp",
+ ],
+ hdrs = ["include/host-common/logging.h"],
+ defines = [
+ "BUILDING_EMUGL_COMMON_SHARED",
+ ] + select({
+ "@platforms//os:windows": [
+ "WIN32_LEAN_AND_MEAN",
+ ],
+ "//conditions:default": [],
+ }),
+ includes = ["include/host-common"],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":aemu-host-common-headers",
+ "//hardware/google/aemu/base:aemu-base-headers",
+ "//hardware/google/aemu/base:aemu-base-metrics",
+ ],
+)
+
+cc_library(
+ name = "aemu-host-common-headers",
+ hdrs = glob([
+ "include/**/*.h",
+ "include/**/*.hpp",
+ ]),
+ includes = ["include"],
+ visibility = ["//visibility:public"],
+)
+
+# Standalone Library (conditional)
+cc_library(
+ name = "aemu-host-common",
+ srcs = [
+ "AndroidPipe.cpp",
+ "DmaMap.cpp",
+ "GoldfishDma.cpp",
+ "GoldfishSyncCommandQueue.cpp",
+ "GraphicsAgentFactory.cpp",
+ "HostmemIdMapping.cpp",
+ "RefcountPipe.cpp",
+ "address_space_device.cpp",
+ "address_space_device_control_ops.cpp",
+ "address_space_graphics.cpp",
+ "address_space_host_media.cpp",
+ "address_space_host_memory_allocator.cpp",
+ "address_space_shared_slots_host_memory_allocator.cpp",
+ "crash_reporter.cpp",
+ "dma_device.cpp",
+ "empty-crash-handler.cpp",
+ "feature_control.cpp",
+ "goldfish_sync.cpp",
+ "hw-config.cpp",
+ "misc.cpp",
+ "sync_device.cpp",
+ "vm_operations.cpp",
+ "window_operations.cpp",
+ ],
+ hdrs = [":aemu-host-common-headers"],
+ copts = [
+ "-Wno-return-type-c-linkage",
+ "-Wno-extern-c-compat",
+ ],
+ defines = [
+ "BUILDING_EMUGL_COMMON_SHARED",
+ ] + select({
+ "@platforms//os:windows": [
+ "WIN32_LEAN_AND_MEAN",
+ ],
+ "//conditions:default": [],
+ }),
+ visibility = ["//visibility:public"],
+ deps = [
+ ":aemu-host-common-headers",
+ ":logging",
+ "//hardware/google/aemu/base:aemu-base-allocator",
+ "//hardware/google/aemu/base:aemu-base-headers",
+ ],
+ alwayslink = 1,
+)
+
+# Override Library
+cc_library(
+ name = "aemu-host-common-product-feature-override",
+ srcs = ["FeatureControlOverride.cpp"],
+ hdrs = glob(["include/**/*.h"]),
+ defines = [
+ "BUILDING_EMUGL_COMMON_SHARED",
+ ] + select({
+ "@platforms//os:windows": [
+ "WIN32_LEAN_AND_MEAN",
+ ],
+ "//conditions:default": [],
+ }),
+ includes = ["include"],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":aemu-host-common-headers",
+ "//hardware/google/aemu/base:aemu-base-headers",
+ ],
+)
+
+# Testing Libraries and Executable (conditional)
+cc_library(
+ name = "aemu-host-common-testing-support",
+ srcs = [
+ "testing/HostAddressSpace.cpp",
+ "testing/MockAndroidEmulatorWindowAgent.cpp",
+ "testing/MockAndroidMultiDisplayAgent.cpp",
+ "testing/MockAndroidVmOperations.cpp",
+ "testing/MockGraphicsAgentFactory.cpp",
+ ],
+ deps = [
+ ":aemu-host-common-headers",
+ "//hardware/google/aemu/base:aemu-base-headers",
+ "@com_google_gmock//:gmock",
+ "@com_google_googletest//:gtest",
+ ],
+)
+
+cc_test(
+ name = "aemu-host-common_unittests",
+ srcs = [
+ "GfxstreamFatalError_unittest.cpp",
+ "HostAddressSpace_unittest.cpp",
+ "HostmemIdMapping_unittest.cpp",
+ "address_space_graphics_unittests.cpp",
+ "address_space_host_memory_allocator_unittests.cpp",
+ "address_space_shared_slots_host_memory_allocator_unittests.cpp",
+ "logging_unittest.cpp",
+ ],
+ deps = [
+ ":aemu-host-common-headers",
+ ":aemu-host-common-testing-support",
+ ":gfxstream_host_common",
+ ":logging",
+ "//common:gfxstream_base",
+ "//hardware/google/aemu/base:aemu-base-headers",
+ "@com_google_googletest//:gtest_main",
+ ],
+)
diff --git a/snapshot/BUILD.bazel b/snapshot/BUILD.bazel
new file mode 100644
index 0000000..549a36f
--- /dev/null
+++ b/snapshot/BUILD.bazel
@@ -0,0 +1,33 @@
+# Interface library
+cc_library(
+ name = "gfxstream-snapshot-headers",
+ hdrs = glob(["include/**/*.h"]),
+ includes = ["include"],
+ visibility = ["//visibility:public"],
+)
+
+# Main library
+cc_library(
+ name = "aemu-snapshot",
+ srcs = [
+ "TextureLoader.cpp",
+ "TextureSaver.cpp",
+ ],
+ hdrs = [":gfxstream-snapshot-headers"],
+ copts = [
+ "-Wno-extern-c-compat",
+ "-Wno-return-type-c-linkage",
+ ],
+ defines = select({
+ "@platforms//os:macos": [
+ "fseeko64=fseek",
+ "ftello64=ftell",
+ ],
+ "//conditions:default": [],
+ }),
+ visibility = ["//visibility:public"],
+ deps = [
+ ":gfxstream-snapshot-headers",
+ "//hardware/google/aemu/base:aemu-base-headers",
+ ],
+)