OSDN Git Service

ANDROID: Add target/device support
[android-x86/external-minigbm.git] / Android.bp
index 63a50f7..c3b56e5 100644 (file)
@@ -1,18 +1,11 @@
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
+/*
+ * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
 
 cc_defaults {
-    name: "gralloc.minigbm_intel_defaults",
-    cflags: ["-DDRV_I915"],
-}
-
-cc_defaults {
-    name: "gralloc.minigbm_meson_defaults",
-    cflags: ["-DDRV_MESON"],
-}
-
-cc_defaults {
-    name: "gralloc.minigbm_defaults",
+    name: "minigbm_defaults",
 
     srcs: [
         "amdgpu.c",
@@ -34,11 +27,6 @@ cc_defaults {
         "vc4.c",
         "vgem.c",
         "virtio_gpu.c",
-
-        "cros_gralloc/cros_gralloc_buffer.cc",
-        "cros_gralloc/cros_gralloc_driver.cc",
-        "cros_gralloc/cros_gralloc_helpers.cc",
-        "cros_gralloc/gralloc0/gralloc0.cc",
     ],
 
     cflags: [
@@ -51,41 +39,105 @@ cc_defaults {
         "-Wcast-align",
         "-Wno-unused-parameter",
     ],
+
     cppflags: ["-std=c++14"],
+}
 
-    // The preferred path for vendor HALs is /vendor/lib/hw
-    vendor: true,
-    relative_install_path: "hw",
+cc_defaults {
+    name: "minigbm_gralloc_defaults",
+
+    defaults: ["minigbm_defaults"],
 
     header_libs: [
         "libhardware_headers",
         "libnativebase_headers",
+        "libnativewindow_headers",
+        "libsystem_headers",
+    ],
+
+    export_header_lib_headers: [
+        "libhardware_headers",
+        "libnativebase_headers",
+        "libnativewindow_headers",
         "libsystem_headers",
     ],
 
+    srcs: [
+        "cros_gralloc/cros_gralloc_buffer.cc",
+        "cros_gralloc/cros_gralloc_helpers.cc",
+        "cros_gralloc/cros_gralloc_driver.cc",
+    ],
+
+    static_libs: ["libarect"],
+
+    export_static_lib_headers: ["libarect"],
+
+    vendor: true,
+
     shared_libs: [
         "libcutils",
         "libdrm",
-
         "libnativewindow",
         "libsync",
         "liblog",
     ],
 
-    static_libs: ["libarect"],
+    relative_install_path: "hw",
+}
+
+cc_defaults {
+    name: "gbm_defaults",
+
+    defaults: ["minigbm_defaults"],
+
+    srcs: [
+        "gbm.c",
+        "gbm_helpers.c",
+    ],
+
+    export_include_dirs: ["."],
+}
+
+cc_library {
+    name: "libgbm",
+    defaults: ["gbm_defaults"],
+    host_supported: true,
+
+    target: {
+        host: {
+            // Avoid linking to another host copy of libdrm; this library will cause
+            // binary GPU drivers to be loaded from the host, which might be linked
+            // to a system copy of libdrm, which conflicts with the AOSP one
+            allow_undefined_symbols: true,
+            header_libs: ["libdrm"],
+        },
+        android: {
+            shared_libs: [
+                "libdrm",
+                "liblog"
+            ],
+        },
+    },
+}
+
+cc_library_static {
+    name: "libminigbm_gralloc",
+    defaults: ["minigbm_gralloc_defaults"],
+    shared_libs: ["liblog"],
+    static_libs: ["libdrm"],
+
+    export_include_dirs: ["."],
 }
 
 cc_library_shared {
     name: "gralloc.minigbm",
-    defaults: ["gralloc.minigbm_defaults"],
+    defaults: ["minigbm_gralloc_defaults"],
+    srcs: ["cros_gralloc/gralloc0/gralloc0.cc"],
 }
 
 cc_library_shared {
     name: "gralloc.minigbm_intel",
-    defaults: [
-        "gralloc.minigbm_defaults",
-        "gralloc.minigbm_intel_defaults",
-    ],
+    defaults: ["minigbm_gralloc_defaults"],
     enabled: false,
     arch: {
         x86: {
@@ -95,26 +147,13 @@ cc_library_shared {
             enabled: true,
         },
     },
+    cflags: ["-DDRV_I915"],
+    srcs: ["cros_gralloc/gralloc0/gralloc0.cc"],
 }
 
 cc_library_shared {
     name: "gralloc.minigbm_meson",
-    defaults: [
-        "gralloc.minigbm_defaults",
-        "gralloc.minigbm_meson_defaults",
-    ],
-}
-
-cc_library_shared {
-    name: "libminigbm",
-    defaults: ["gralloc.minigbm_defaults"],
-    shared_libs: ["liblog"],
-    static_libs: ["libdrm"],
-
-    srcs: [
-        "gbm.c",
-        "gbm_helpers.c",
-    ],
-
-    export_include_dirs: ["."],
+    defaults: ["minigbm_gralloc_defaults"],
+    cflags: ["-DDRV_MESON"],
+    srcs: ["cros_gralloc/gralloc0/gralloc0.cc"],
 }