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" ]
61 configs += [ "//build/config/compiler:no_chromium_code" ]
62 configs += [ ":libusb_warnings" ]
64 public_configs = [ ":libusb_config" ]
68 "DEFAULT_VISIBILITY=",
69 "HAVE_GETTIMEOFDAY=1",
72 "LIBUSB_DESCRIBE=\"1.0.16\"",
73 "POLL_NFDS_TYPE=nfds_t",
79 defines += [ "OS_DARWIN=1" ]
82 "src/libusb/os/darwin_usb.c",
83 "src/libusb/os/darwin_usb.h",
89 "src/libusb/os/linux_usbfs.c",
90 "src/libusb/os/linux_usbfs.h",
99 sources += [ "src/libusb/os/linux_udev.cc" ]
104 deps += [ "//build/linux:udev" ]
107 if (is_linux && !use_udev) {
108 sources += [ "src/libusb/os/linux_netlink.c" ]
109 defines += [ "HAVE_LINUX_NETLINK_H" ]
113 include_dirs += [ "src/msvc" ]
115 "src/libusb/os/poll_posix.c",
116 "src/libusb/os/threads_posix.c",
118 libs = [ "setupapi.lib" ]
120 include_dirs += [ "src" ]
122 "src/libusb/os/poll_windows.c",
123 "src/libusb/os/poll_windows.h",
124 "src/libusb/os/threads_windows.c",
125 "src/libusb/os/threads_windows.h",
126 "src/libusb/os/windows_common.h",
127 "src/libusb/os/windows_usb.c",
128 "src/libusb/os/windows_usb.h",
130 "src/msvc/inttypes.h",