Home | History | Annotate | Download | only in libusb
      1 # Copyright (c) 2013 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   external = true
     13   sources = [
     14     "src/config.h",
     15     "src/libusb/core.c",
     16     "src/libusb/descriptor.c",
     17     "src/libusb/hotplug.c",
     18     "src/libusb/hotplug.h",
     19     "src/libusb/interrupt.c",
     20     "src/libusb/interrupt.h",
     21     "src/libusb/io.c",
     22     "src/libusb/libusb.h",
     23     "src/libusb/libusbi.h",
     24     "src/libusb/os/darwin_usb.c",
     25     "src/libusb/os/darwin_usb.h",
     26     "src/libusb/os/linux_udev.c",
     27     "src/libusb/os/linux_usbfs.c",
     28     "src/libusb/os/linux_usbfs.h",
     29     "src/libusb/os/poll_posix.c",
     30     "src/libusb/os/poll_posix.h",
     31     "src/libusb/os/poll_windows.c",
     32     "src/libusb/os/poll_windows.h",
     33     "src/libusb/os/threads_posix.c",
     34     "src/libusb/os/threads_posix.h",
     35     "src/libusb/os/threads_windows.c",
     36     "src/libusb/os/threads_windows.h",
     37     "src/libusb/os/windows_common.h",
     38     "src/libusb/os/windows_usb.c",
     39     "src/libusb/os/windows_usb.h",
     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   direct_dependent_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   } else {
     96     include_dirs += "src"
     97     sources -= [
     98       "src/libusb/os/poll_windows.c",
     99       "src/libusb/os/poll_windows.h",
    100       "src/libusb/os/threads_windows.c",
    101       "src/libusb/os/threads_windows.h",
    102       "src/libusb/os/windows_common.h",
    103       "src/libusb/os/windows_usb.c",
    104       "src/libusb/os/windows_usb.h",
    105       "src/msvc/config.h",
    106       "src/msvc/inttypes.h",
    107       "src/msvc/stdint.h",
    108     ]
    109   }
    110 }
    111