Fix BrowserWindowFullScreenControllerTest.TestActivate on 10.11
[chromium-blink-merge.git] / third_party / libusb / BUILD.gn
blobe6d371dbde0cf9e80aa4aae6e5ca2bb3e4298460
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") {
14   sources = [
15     "src/config.h",
16     "src/libusb/core.c",
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",
22     "src/libusb/io.c",
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",
39     "src/libusb/sync.c",
40     "src/libusb/version.h",
41     "src/libusb/version_nano.h",
42     "src/msvc/config.h",
43     "src/msvc/inttypes.h",
44     "src/msvc/stdint.h",
45   ]
46   deps = []
47   include_dirs = [ "src/libusb/os" ]
49   configs -= [ "//build/config/compiler:chromium_code" ]
50   configs += [ "//build/config/compiler:no_chromium_code" ]
52   public_configs = [ ":libusb_config" ]
54   if (is_posix) {
55     defines = [
56       "DEFAULT_VISIBILITY=",
57       "HAVE_GETTIMEOFDAY=1",
58       "HAVE_POLL_H=1",
59       "HAVE_SYS_TIME_H=1",
60       "LIBUSB_DESCRIBE=\"1.0.16\"",
61       "POLL_NFDS_TYPE=nfds_t",
62       "THREADS_POSIX=1",
63     ]
64   }
66   if (is_mac) {
67     defines += [ "OS_DARWIN=1" ]
68   } else {
69     sources -= [
70       "src/libusb/os/darwin_usb.c",
71       "src/libusb/os/darwin_usb.h",
72     ]
73   }
75   if (is_linux) {
76     sources += [
77       "src/libusb/os/linux_usbfs.c",
78       "src/libusb/os/linux_usbfs.h",
79     ]
80     defines += [
81       "OS_LINUX=1",
82       "_GNU_SOURCE=1",
83     ]
84   }
86   if (use_udev) {
87     sources += [ "src/libusb/os/linux_udev.cc" ]
88     defines += [
89       "HAVE_LIBUDEV=1",
90       "USE_UDEV=1",
91     ]
92     deps += [ "//build/config/linux:udev" ]
93   }
95   if (is_linux && !use_udev) {
96     sources += [ "src/libusb/os/linux_netlink.c" ]
97     defines += [ "HAVE_LINUX_NETLINK_H" ]
98     if (is_clang) {
99       cflags += [ "-Wno-pointer-sign" ]
100     }
101   }
103   if (is_win) {
104     include_dirs += [ "src/msvc" ]
105     sources -= [
106       "src/libusb/os/poll_posix.c",
107       "src/libusb/os/threads_posix.c",
108     ]
109     libs = [ "setupapi.lib" ]
110   } else {
111     include_dirs += [ "src" ]
112     sources -= [
113       "src/libusb/os/poll_windows.c",
114       "src/libusb/os/poll_windows.h",
115       "src/libusb/os/threads_windows.c",
116       "src/libusb/os/threads_windows.h",
117       "src/libusb/os/windows_common.h",
118       "src/libusb/os/windows_usb.c",
119       "src/libusb/os/windows_usb.h",
120       "src/msvc/config.h",
121       "src/msvc/inttypes.h",
122       "src/msvc/stdint.h",
123     ]
124   }