Update V8 to version 4.7.47.
[chromium-blink-merge.git] / third_party / libusb / BUILD.gn
blob0d7c9297a36443b3a47406314f36444a5cbe58a4
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") {
14   visibility = [ ":*" ]
15   if (is_clang) {
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" ]
20     }
21   }
24 static_library("libusb") {
25   sources = [
26     "src/config.h",
27     "src/libusb/core.c",
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",
33     "src/libusb/io.c",
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",
50     "src/libusb/sync.c",
51     "src/libusb/version.h",
52     "src/libusb/version_nano.h",
53     "src/msvc/config.h",
54     "src/msvc/inttypes.h",
55     "src/msvc/stdint.h",
56   ]
57   deps = []
58   include_dirs = [ "src/libusb/os" ]
60   configs -= [ "//build/config/compiler:chromium_code" ]
61   configs += [
62     "//build/config/compiler:no_chromium_code",
64     # Must be after no_chromium_code for warning flags to be ordered correctly.
65     ":libusb_warnings",
66   ]
68   public_configs = [ ":libusb_config" ]
70   if (is_posix) {
71     defines = [
72       "DEFAULT_VISIBILITY=",
73       "HAVE_GETTIMEOFDAY=1",
74       "HAVE_POLL_H=1",
75       "HAVE_SYS_TIME_H=1",
76       "LIBUSB_DESCRIBE=\"1.0.16\"",
77       "POLL_NFDS_TYPE=nfds_t",
78       "THREADS_POSIX=1",
79     ]
80   }
82   if (is_mac) {
83     defines += [ "OS_DARWIN=1" ]
84   } else {
85     sources -= [
86       "src/libusb/os/darwin_usb.c",
87       "src/libusb/os/darwin_usb.h",
88     ]
89   }
91   if (is_linux) {
92     sources += [
93       "src/libusb/os/linux_usbfs.c",
94       "src/libusb/os/linux_usbfs.h",
95     ]
96     defines += [
97       "OS_LINUX=1",
98       "_GNU_SOURCE=1",
99     ]
100   }
102   if (use_udev) {
103     sources += [ "src/libusb/os/linux_udev.cc" ]
104     defines += [
105       "HAVE_LIBUDEV=1",
106       "USE_UDEV=1",
107     ]
108     deps += [ "//build/linux:udev" ]
109   }
111   if (is_linux && !use_udev) {
112     sources += [ "src/libusb/os/linux_netlink.c" ]
113     defines += [ "HAVE_LINUX_NETLINK_H" ]
114   }
116   if (is_win) {
117     include_dirs += [ "src/msvc" ]
118     sources -= [
119       "src/libusb/os/poll_posix.c",
120       "src/libusb/os/threads_posix.c",
121     ]
122     libs = [ "setupapi.lib" ]
123   } else {
124     include_dirs += [ "src" ]
125     sources -= [
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",
133       "src/msvc/config.h",
134       "src/msvc/inttypes.h",
135       "src/msvc/stdint.h",
136     ]
137   }