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. 4 5 config("libusb_config") { 6 include_dirs = [ 7 "src/libusb", 8 ] 9 } 10 11 static_library("libusb") { 12 sources = [ 13 "src/config.h", 14 "src/libusb/core.c", 15 "src/libusb/descriptor.c", 16 "src/libusb/hotplug.c", 17 "src/libusb/hotplug.h", 18 "src/libusb/interrupt.c", 19 "src/libusb/interrupt.h", 20 "src/libusb/io.c", 21 "src/libusb/libusb.h", 22 "src/libusb/libusbi.h", 23 "src/libusb/os/darwin_usb.c", 24 "src/libusb/os/darwin_usb.h", 25 "src/libusb/os/linux_udev.c", 26 "src/libusb/os/linux_usbfs.c", 27 "src/libusb/os/linux_usbfs.h", 28 "src/libusb/os/poll_posix.c", 29 "src/libusb/os/poll_posix.h", 30 "src/libusb/os/poll_windows.c", 31 "src/libusb/os/poll_windows.h", 32 "src/libusb/os/threads_posix.c", 33 "src/libusb/os/threads_posix.h", 34 "src/libusb/os/threads_windows.c", 35 "src/libusb/os/threads_windows.h", 36 "src/libusb/os/windows_common.h", 37 "src/libusb/os/windows_usb.c", 38 "src/libusb/os/windows_usb.h", 39 "src/libusb/strerror.c", 40 "src/libusb/sync.c", 41 "src/libusb/version.h", 42 "src/libusb/version_nano.h", 43 "src/msvc/config.h", 44 "src/msvc/inttypes.h", 45 "src/msvc/stdint.h", 46 ] 47 include_dirs = [ 48 "src/libusb/os", 49 ] 50 51 configs -= [ "//build/config/compiler:chromium_code" ] 52 configs += [ "//build/config/compiler:no_chromium_code" ] 53 54 public_configs = [ ":libusb_config" ] 55 56 if (is_posix) { 57 defines = [ 58 "DEFAULT_VISIBILITY=", 59 "HAVE_GETTIMEOFDAY=1", 60 "HAVE_POLL_H=1", 61 "HAVE_SYS_TIME_H=1", 62 "LIBUSB_DESCRIBE=\"1.0.16\"", 63 "POLL_NFDS_TYPE=nfds_t", 64 "THREADS_POSIX=1", 65 ] 66 } 67 68 if (is_mac) { 69 defines += [ "OS_DARWIN=1" ] 70 } else { 71 sources -= [ 72 "src/libusb/os/darwin_usb.c", 73 "src/libusb/os/darwin_usb.h", 74 ] 75 } 76 77 if (is_linux || is_android) { 78 defines += [ 79 "HAVE_LIBUDEV=1", 80 "OS_LINUX=1", 81 "USE_UDEV=1", 82 "_GNU_SOURCE=1", 83 ] 84 configs += [ "//build/config/linux:udev" ] 85 } else { 86 sources -= [ 87 "src/libusb/os/linux_udev.c", 88 "src/libusb/os/linux_usbfs.c", 89 "src/libusb/os/linux_usbfs.h", 90 ] 91 } 92 93 if (is_win) { 94 include_dirs += [ "src/msvc" ] 95 sources -= [ 96 "src/libusb/os/poll_posix.c", 97 "src/libusb/os/threads_posix.c", 98 ] 99 } else { 100 include_dirs += [ "src" ] 101 sources -= [ 102 "src/libusb/os/poll_windows.c", 103 "src/libusb/os/poll_windows.h", 104 "src/libusb/os/threads_windows.c", 105 "src/libusb/os/threads_windows.h", 106 "src/libusb/os/windows_common.h", 107 "src/libusb/os/windows_usb.c", 108 "src/libusb/os/windows_usb.h", 109 "src/msvc/config.h", 110 "src/msvc/inttypes.h", 111 "src/msvc/stdint.h", 112 ] 113 } 114 } 115