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 config("libusb_warnings") {
16 # guid_eq in windows_usb.c is unused.
17 cflags = [ "-Wno-unused-function" ]
18 if (is_linux && !use_udev) {
19 cflags += [ "-Wno-pointer-sign" ]
24 static_library("libusb") {
28 "src/libusb/descriptor.c",
29 "src/libusb/hotplug.c",
30 "src/libusb/hotplug.h",
31 "src/libusb/interrupt.c",
32 "src/libusb/interrupt.h",
34 "src/libusb/libusb.h",
35 "src/libusb/libusbi.h",
36 "src/libusb/os/darwin_usb.c",
37 "src/libusb/os/darwin_usb.h",
38 "src/libusb/os/poll_posix.c",
39 "src/libusb/os/poll_posix.h",
40 "src/libusb/os/poll_windows.c",
41 "src/libusb/os/poll_windows.h",
42 "src/libusb/os/threads_posix.c",
43 "src/libusb/os/threads_posix.h",
44 "src/libusb/os/threads_windows.c",
45 "src/libusb/os/threads_windows.h",
46 "src/libusb/os/windows_common.h",
47 "src/libusb/os/windows_usb.c",
48 "src/libusb/os/windows_usb.h",
49 "src/libusb/strerror.c",
51 "src/libusb/version.h",
52 "src/libusb/version_nano.h",
54 "src/msvc/inttypes.h",
58 include_dirs = [ "src/libusb/os" ]
60 configs -= [ "//build/config/compiler:chromium_code" ]
62 "//build/config/compiler:no_chromium_code",
64 # Must be after no_chromium_code for warning flags to be ordered correctly.
68 public_configs = [ ":libusb_config" ]
72 "DEFAULT_VISIBILITY=",
73 "HAVE_GETTIMEOFDAY=1",
76 "LIBUSB_DESCRIBE=\"1.0.16\"",
77 "POLL_NFDS_TYPE=nfds_t",
83 defines += [ "OS_DARWIN=1" ]
86 "src/libusb/os/darwin_usb.c",
87 "src/libusb/os/darwin_usb.h",
93 "src/libusb/os/linux_usbfs.c",
94 "src/libusb/os/linux_usbfs.h",
103 sources += [ "src/libusb/os/linux_udev.cc" ]
108 deps += [ "//build/linux:udev" ]
111 if (is_linux && !use_udev) {
112 sources += [ "src/libusb/os/linux_netlink.c" ]
113 defines += [ "HAVE_LINUX_NETLINK_H" ]
117 include_dirs += [ "src/msvc" ]
119 "src/libusb/os/poll_posix.c",
120 "src/libusb/os/threads_posix.c",
122 libs = [ "setupapi.lib" ]
124 include_dirs += [ "src" ]
126 "src/libusb/os/poll_windows.c",
127 "src/libusb/os/poll_windows.h",
128 "src/libusb/os/threads_windows.c",
129 "src/libusb/os/threads_windows.h",
130 "src/libusb/os/windows_common.h",
131 "src/libusb/os/windows_usb.c",
132 "src/libusb/os/windows_usb.h",
134 "src/msvc/inttypes.h",