1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 assert(!is_android && !is_ios)
7 import("//build/config/features.gni")
9 config("libusb_config") {
10 include_dirs = [ "src/libusb" ]
13 static_library("libusb") {
17 "src/libusb/descriptor.c",
18 "src/libusb/hotplug.c",
19 "src/libusb/hotplug.h",
20 "src/libusb/interrupt.c",
21 "src/libusb/interrupt.h",
23 "src/libusb/libusb.h",
24 "src/libusb/libusbi.h",
25 "src/libusb/os/darwin_usb.c",
26 "src/libusb/os/darwin_usb.h",
27 "src/libusb/os/poll_posix.c",
28 "src/libusb/os/poll_posix.h",
29 "src/libusb/os/poll_windows.c",
30 "src/libusb/os/poll_windows.h",
31 "src/libusb/os/threads_posix.c",
32 "src/libusb/os/threads_posix.h",
33 "src/libusb/os/threads_windows.c",
34 "src/libusb/os/threads_windows.h",
35 "src/libusb/os/windows_common.h",
36 "src/libusb/os/windows_usb.c",
37 "src/libusb/os/windows_usb.h",
38 "src/libusb/strerror.c",
40 "src/libusb/version.h",
41 "src/libusb/version_nano.h",
43 "src/msvc/inttypes.h",
47 include_dirs = [ "src/libusb/os" ]
49 config("libusb_warnings") {
51 # guid_eq in windows_usb.c is unused.
52 cflags = [ "-Wno-unused-function" ]
53 if (is_linux && !use_udev) {
54 cflags += [ "-Wno-pointer-sign" ]
58 configs -= [ "//build/config/compiler:chromium_code" ]
59 configs += [ "//build/config/compiler:no_chromium_code" ]
60 configs += [ ":libusb_warnings" ]
62 public_configs = [ ":libusb_config" ]
66 "DEFAULT_VISIBILITY=",
67 "HAVE_GETTIMEOFDAY=1",
70 "LIBUSB_DESCRIBE=\"1.0.16\"",
71 "POLL_NFDS_TYPE=nfds_t",
77 defines += [ "OS_DARWIN=1" ]
80 "src/libusb/os/darwin_usb.c",
81 "src/libusb/os/darwin_usb.h",
87 "src/libusb/os/linux_usbfs.c",
88 "src/libusb/os/linux_usbfs.h",
97 sources += [ "src/libusb/os/linux_udev.cc" ]
102 deps += [ "//build/config/linux:udev" ]
105 if (is_linux && !use_udev) {
106 sources += [ "src/libusb/os/linux_netlink.c" ]
107 defines += [ "HAVE_LINUX_NETLINK_H" ]
111 include_dirs += [ "src/msvc" ]
113 "src/libusb/os/poll_posix.c",
114 "src/libusb/os/threads_posix.c",
116 libs = [ "setupapi.lib" ]
118 include_dirs += [ "src" ]
120 "src/libusb/os/poll_windows.c",
121 "src/libusb/os/poll_windows.h",
122 "src/libusb/os/threads_windows.c",
123 "src/libusb/os/threads_windows.h",
124 "src/libusb/os/windows_common.h",
125 "src/libusb/os/windows_usb.c",
126 "src/libusb/os/windows_usb.h",
128 "src/msvc/inttypes.h",