1//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16subdirs = [
17    "common",
18    "guest",
19    "host",
20]
21
22cc_library_headers {
23    name: "cuttlefish_common_headers",
24    vendor: true,
25    export_include_dirs: ["."],
26    host_supported: true,
27}
28
29// TODO(b/67435044) Update the include paths and remove this
30cc_library_headers {
31    name: "cuttlefish_glog",
32    vendor: true,
33    export_include_dirs: ["common/libs"],
34    host_supported: true,
35}
36
37cc_defaults {
38    name: "cuttlefish_base",
39    gnu_extensions: false,
40    header_libs: [
41        "cuttlefish_common_headers",
42        "cuttlefish_kernel_headers",
43    ],
44    target: {
45        host: {
46            host_ldlibs: ["-lrt"],
47            cflags: ["-DCUTTLEFISH_HOST"],
48            compile_multilib: "64",
49        },
50        // We don't need Darwin host-side builds
51        darwin: {
52            enabled: false,
53        },
54    },
55    cflags: ["-Werror", "-Wall"],
56    vendor: true,
57}
58
59// ARM code should not touch the VSoC window on an x86 CPU.
60cc_defaults {
61    name: "cuttlefish_native_isa",
62    target: {
63        android_arm: {
64            enabled: false,
65        },
66        android_arm64: {
67            enabled: false,
68        },
69    },
70}
71
72cc_defaults {
73    name: "cuttlefish_guest_only",
74    defaults: ["cuttlefish_base"],
75}
76
77cc_defaults {
78    name: "cuttlefish_host_only",
79    device_supported: false,
80    host_supported: true,
81    defaults: ["cuttlefish_base"],
82}
83
84cc_defaults {
85    name: "cuttlefish_host_and_guest",
86    host_supported: true,
87    defaults: ["cuttlefish_base"],
88}
89
90cc_library_shared {
91    name: "vsoc_lib",
92    srcs: [
93        "common/vsoc/lib/compat.cpp",
94        "common/vsoc/lib/audio_data_layout.cpp",
95        "common/vsoc/lib/e2e_test_region_layout.cpp",
96        "common/vsoc/lib/gralloc_layout.cpp",
97        "common/vsoc/lib/input_events_layout.cpp",
98        "common/vsoc/lib/input_events_region_view.cpp",
99        "common/vsoc/lib/lock_common.cpp",
100        "common/vsoc/lib/region_view.cpp",
101        "common/vsoc/lib/ril_layout.cpp",
102        "common/vsoc/lib/ril_region_view.cpp",
103        "common/vsoc/lib/screen_layout.cpp",
104        "common/vsoc/lib/screen_region_view.cpp",
105        "common/vsoc/lib/socket_forward_layout.cpp",
106        "common/vsoc/lib/socket_forward_region_view.cpp",
107        "common/vsoc/lib/vsoc_memory.cpp",
108        "common/vsoc/lib/wifi_exchange_layout.cpp",
109        "common/vsoc/lib/wifi_exchange_view.cpp",
110    ],
111    header_libs: ["cuttlefish_glog"],
112    shared_libs: [
113        "libcuttlefish_fs",
114        "cuttlefish_auto_resources",
115        "libbase",
116        "liblog",
117    ],
118    target: {
119        host: {
120            srcs: [
121                "host/vsoc/lib/gralloc_buffer_region_view.cpp",
122                "host/vsoc/lib/host_lock.cpp",
123                "host/vsoc/lib/region_control.cpp",
124                "host/vsoc/lib/region_view.cpp",
125            ],
126        },
127        android: {
128            srcs: [
129                "guest/vsoc/lib/gralloc_region_view.cpp",
130                "guest/vsoc/lib/guest_lock.cpp",
131                "guest/vsoc/lib/region_control.cpp",
132                "guest/vsoc/lib/region_view.cpp",
133            ],
134        },
135    },
136    defaults: ["cuttlefish_host_and_guest", "cuttlefish_native_isa"],
137}
138
139cc_test_host {
140    name: "circqueue_test",
141    srcs: [
142        "common/vsoc/lib/circqueue_test.cpp",
143    ],
144    shared_libs: [
145        "vsoc_lib",
146        "libbase",
147    ],
148    defaults: ["cuttlefish_host_only"],
149}
150
151cc_binary_host {
152    name: "vsoc_screen_region_view_test",
153    srcs: [
154        "common/vsoc/lib/screen_region_view_test.cpp",
155    ],
156    static_libs: [
157        "libcuttlefish_host_config",
158        "libjsoncpp",
159        "libgflags",
160    ],
161    shared_libs: [
162        "vsoc_lib",
163        "libbase",
164    ],
165    defaults: ["cuttlefish_host_only"],
166}
167
168cc_test_host {
169    name: "lock_test",
170    srcs: [
171        "common/vsoc/lib/lock_test.cpp",
172    ],
173    shared_libs: [
174        "vsoc_lib",
175        "libcuttlefish_fs",
176        "cuttlefish_auto_resources",
177        "libbase",
178    ],
179    static_libs: [
180        "libgtest_host",
181    ],
182    defaults: ["cuttlefish_host_only"],
183}
184
185cc_test_host {
186    name: "vsoc_graphics_test",
187    srcs: [
188        "common/vsoc/lib/graphics_test.cpp",
189    ],
190    shared_libs: [
191        "vsoc_lib",
192        "libbase",
193    ],
194    defaults: ["cuttlefish_host_only"],
195}
196
197cc_binary_host {
198    name: "host_region_e2e_test",
199    srcs: [
200        "host/vsoc/lib/host_region_e2e_test.cpp",
201    ],
202    shared_libs: [
203        "vsoc_lib",
204        "libcuttlefish_fs",
205        "cuttlefish_auto_resources",
206        "libbase",
207    ],
208    static_libs: [
209        "libcuttlefish_host_config",
210        "libjsoncpp",
211        "libgtest_host",
212        "libgflags",
213    ],
214    defaults: ["cuttlefish_host_only"],
215}
216