1cc_library {
2    name: "libusb",
3    host_supported: true,
4
5    srcs: [
6        "libusb/core.c",
7        "libusb/descriptor.c",
8        "libusb/hotplug.c",
9        "libusb/io.c",
10        "libusb/sync.c",
11        "libusb/strerror.c",
12    ],
13
14    local_include_dirs: [
15        "libusb",
16        "libusb/os",
17    ],
18
19    target: {
20        android: {
21            srcs: [
22                "libusb/os/linux_usbfs.c",
23                "libusb/os/poll_posix.c",
24                "libusb/os/threads_posix.c",
25                "libusb/os/linux_netlink.c",
26            ],
27
28            local_include_dirs: [
29                "android",
30            ],
31        },
32
33        darwin: {
34            srcs: [
35                "libusb/os/darwin_usb.c",
36                "libusb/os/poll_posix.c",
37                "libusb/os/threads_posix.c",
38            ],
39
40            local_include_dirs: [
41                "darwin",
42            ],
43
44            host_ldlibs: [
45                "-framework CoreFoundation",
46                "-framework IOKit",
47                "-lobjc"
48            ],
49        },
50
51        linux: {
52            srcs: [
53                "libusb/os/linux_usbfs.c",
54                "libusb/os/poll_posix.c",
55                "libusb/os/threads_posix.c",
56                "libusb/os/linux_netlink.c",
57            ],
58
59            local_include_dirs: [
60                "linux",
61            ],
62
63            host_ldlibs: [
64                "-lrt",
65            ],
66        },
67
68        windows: {
69            srcs: [
70                "libusb/os/poll_windows.c",
71                "libusb/os/threads_windows.c",
72                "libusb/os/windows_nt_common.c",
73                "libusb/os/windows_usbdk.c",
74                "libusb/os/windows_winusb.c",
75            ],
76
77            local_include_dirs: [
78                "windows",
79            ],
80
81            // Not working yet.
82            enabled: false,
83        },
84    },
85
86    shared_libs: ["liblog"],
87    export_include_dirs: ["include"],
88}
89
90