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/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 include_dirs = [ 47 "src/libusb/os", 48 ] 49 50 configs -= [ "//build/config/compiler:chromium_code" ] 51 configs += [ "//build/config/compiler:no_chromium_code" ] 52 53 direct_dependent_configs = [ ":libusb_config" ] 54 55 if (is_posix) { 56 defines = [ 57 "DEFAULT_VISIBILITY=", 58 "HAVE_GETTIMEOFDAY=1", 59 "HAVE_POLL_H=1", 60 "HAVE_SYS_TIME_H=1", 61 "LIBUSB_DESCRIBE=\"1.0.16\"", 62 "POLL_NFDS_TYPE=nfds_t", 63 "THREADS_POSIX=1", 64 ] 65 } 66 67 if (is_mac) { 68 defines += [ "OS_DARWIN=1" ] 69 } else { 70 sources -= [ 71 "src/libusb/os/darwin_usb.c", 72 "src/libusb/os/darwin_usb.h", 73 ] 74 } 75 76 if (is_linux || is_android) { 77 defines += [ 78 "HAVE_LIBUDEV=1", 79 "OS_LINUX=1", 80 "USE_UDEV=1", 81 "_GNU_SOURCE=1", 82 ] 83 configs += [ "//build/config/linux:udev" ] 84 } else { 85 sources -= [ 86 "src/libusb/os/linux_udev.c", 87 "src/libusb/os/linux_usbfs.c", 88 "src/libusb/os/linux_usbfs.h", 89 ] 90 } 91 92 if (is_win) { 93 include_dirs += [ "src/msvc" ] 94 sources -= [ 95 "src/libusb/os/poll_posix.c", 96 "src/libusb/os/threads_posix.c", 97 ] 98 } else { 99 include_dirs += [ "src" ] 100 sources -= [ 101 "src/libusb/os/poll_windows.c", 102 "src/libusb/os/poll_windows.h", 103 "src/libusb/os/threads_windows.c", 104 "src/libusb/os/threads_windows.h", 105 "src/libusb/os/windows_common.h", 106 "src/libusb/os/windows_usb.c", 107 "src/libusb/os/windows_usb.h", 108 "src/msvc/config.h", 109 "src/msvc/inttypes.h", 110 "src/msvc/stdint.h", 111 ] 112 } 113 } 114