1// *** THIS PACKAGE HAS SPECIAL LICENSING CONDITIONS.  PLEASE
2//     CONSULT THE OWNERS AND [email protected] BEFORE
3//     DEPENDING ON IT IN YOUR PROJECT. ***
4package {
5    default_applicable_licenses: ["hardware_google_gfxstream_license"],
6}
7
8// Added automatically by a large-scale-change that took the approach of
9// 'apply every license found to every target'. While this makes sure we respect
10// every license restriction, it may not be entirely correct.
11//
12// e.g. GPL in an MIT project might only apply to the contrib/ directory.
13//
14// Please consider splitting the single license below into multiple licenses,
15// taking care not to lose any license_kind information, and overriding the
16// default license using the 'licenses: [...]' property on targets as needed.
17//
18// For unused files, consider creating a 'fileGroup' with "//visibility:private"
19// to attach the license to, and including a comment whether the files may be
20// used in the current project.
21// See: http://go/android-license-faq
22license {
23    name: "hardware_google_gfxstream_license",
24    visibility: [
25        "//hardware/google/aemu:__subpackages__",
26        ":__subpackages__",
27    ],
28    license_kinds: [
29        "SPDX-license-identifier-Apache-2.0",
30        "SPDX-license-identifier-BSD",
31        "SPDX-license-identifier-CC-BY-4.0",
32        "SPDX-license-identifier-ISC",
33        "SPDX-license-identifier-MIT",
34        "SPDX-license-identifier-BSL-1.0",
35        "legacy_unencumbered",
36    ],
37}
38
39cc_library_headers {
40    name: "gfxstream_headers",
41    vendor_available: true,
42    host_supported: true,
43    export_include_dirs: [
44        ".",
45        "include",
46        "host",
47        "host/gl",
48        "host/gl/glestranslator/include",
49        "host/vulkan",
50        "utils/include",
51    ],
52    header_libs: [
53        "aemu_common_headers",
54        "gfxstream_magma_headers",
55        "libgfxstream_vulkan_headers",
56    ],
57    export_header_lib_headers: [
58        "aemu_common_headers",
59        "gfxstream_magma_headers",
60        "libgfxstream_vulkan_headers",
61    ],
62    apex_available: [
63        "//apex_available:platform",
64        "com.android.virt",
65    ],
66}
67
68cc_library_headers {
69    name: "gfxstream_x11_headers",
70    vendor_available: true,
71    host_supported: true,
72    export_include_dirs: [
73        "host/apigen-codec-common",
74    ],
75    apex_available: [
76        "//apex_available:platform",
77        "com.android.virt",
78    ],
79}
80
81cc_library_headers {
82    name: "gfxstream_magma_headers",
83    vendor_available: true,
84    host_supported: true,
85    export_include_dirs: [
86        "third-party/fuchsia/magma/include",
87        // TODO(b/274956288): use consistent header paths
88        "third-party/fuchsia/magma/include/lib",
89    ],
90    apex_available: [
91        "//apex_available:platform",
92        "com.android.virt",
93    ],
94}
95
96cc_defaults {
97    name: "gfxstream_cc_defaults",
98    cflags: [
99        "-DGFXSTREAM",
100    ],
101}
102
103soong_config_string_variable {
104    name: "mesa3d_platforms",
105    values: [
106        // Android surfaceless build
107        "none",
108        // The default when variable is not set is Android
109    ],
110}
111
112cc_defaults {
113    name: "gfxstream_guest_cc_defaults",
114    defaults: [
115        "gfxstream_cc_defaults",
116    ],
117    cflags: select(soong_config_variable("gfxstream", "mesa3d_platforms"), {
118        // Android surfaceless build
119        "none": [
120            "-UANDROID",
121            "-U__ANDROID__",
122            "-DLINUX_GUEST_BUILD",
123        ],
124        // The default when variable is not set is Android
125        default: [
126            "-DVK_USE_PLATFORM_ANDROID_KHR",
127        ],
128    }),
129}
130
131cc_defaults {
132    name: "gfxstream_host_cc_defaults",
133    defaults: [
134        "gfxstream_cc_defaults",
135    ],
136    cflags: [
137        "-DGFXSTREAM_BUILD_WITH_SNAPSHOT_SUPPORT=1",
138        "-DGFXSTREAM_BUILD_WITH_TRACING=1",
139    ] + select(soong_config_variable("gfxstream", "mesa3d_platforms"), {
140        // Android surfaceless build
141        "none": [
142            "-DGFXSTREAM_ENABLE_GUEST_VIRTIO_RESOURCE_TILING_CONTROL=1",
143        ],
144        // The default when variable is not set is Android
145        default: [],
146    }),
147    target: {
148        host: {
149            cflags: [
150                "-DGFXSTREAM_BUILD_WITH_SNAPSHOT_FRONTEND_SUPPORT=1",
151            ],
152        }
153    }
154}
155
156cc_defaults {
157    name: "gfxstream_defaults",
158    cflags: [
159        // Android build system has some global cflags that we cannot override (e.g.
160        // -Werror=return-type), so -Wno-return-type and -Wno-return-type-c-linkage will not work.
161        // See build/soong/cc/config/global.go
162        "-DUSING_ANDROID_BP",
163        "-D_FILE_OFFSET_BITS=64",
164        "-DVK_GFXSTREAM_STRUCTURE_TYPE_EXT",
165        "-DGFXSTREAM_ENABLE_HOST_GLES=1",
166        "-Wno-unreachable-code-loop-increment",
167        "-Wno-unused-parameter",
168        "-Wno-unused-function",
169        "-Wno-unused-variable",
170        "-Wno-ignored-qualifiers",
171        "-Wno-reorder-ctor",
172        "-Wno-mismatched-tags",
173        "-Wno-missing-field-initializers",
174        "-Wno-implicit-fallthrough",
175        "-Wno-unused-private-field",
176        "-Wno-macro-redefined",
177    ],
178    header_libs: [
179        "gfxstream_headers",
180        "gfxstream_x11_headers",
181    ],
182    target: {
183        host: {
184            compile_multilib: "64",
185            cflags: [
186                "-U__ANDROID__",
187                "-UANDROID",
188            ],
189        },
190        android: {
191            compile_multilib: "64",
192            shared_libs: ["libnativewindow"],
193        },
194        linux_bionic_arm64: {
195            enabled: true,
196            cflags: ["-Dandroidbionic"],
197        },
198    },
199    host_supported: true,
200    vendor_available: true,
201
202    apex_available: [
203        "//apex_available:platform",
204        "com.android.virt",
205    ],
206}
207