summaryrefslogtreecommitdiffstats
path: root/third_party/libusb/libusb.gyp
blob: d3ca1ead90a2ec72cbca8bd0cb77efd46094e5db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'variables': {
    'use_system_libusb%': 0,
  },
  'targets': [
    {
      'target_name': 'libusb',
      'conditions': [
        ['OS == "linux" and use_system_libusb', {
          'type': 'none',
          'direct_dependent_settings': {
            'defines': [
              'USE_SYSTEM_LIBUSB',
            ],
            'cflags': [
              '<!@(pkg-config --cflags libusb-1.0)',
            ],
            'link_settings': {
              'ldflags': [
                '<!@(pkg-config --libs-only-L --libs-only-other libusb-1.0)',
              ],
              'libraries': [
                '<!@(pkg-config --libs-only-l libusb-1.0)',
              ],
            },
          },
        }, {
          'type': '<(library)',
          'sources': [
            'src/libusb/core.c',
            'src/libusb/descriptor.c',
            'src/libusb/io.c',
            'src/libusb/sync.c',
          ],
          'include_dirs': [
            'src',
            'src/libusb',
            'src/libusb/os',
          ],
          'conditions': [
            [ 'OS == "linux" or OS == "android"', {
              'sources': [
                'src/libusb/os/linux_usbfs.c',
                'src/libusb/os/threads_posix.c',
              ],
              'defines': [
                'DEFAULT_VISIBILITY=',
                'HAVE_POLL_H=1',
                'HAVE_SYS_TIME_H=1',
                'OS_LINUX=1',
                'POLL_NFDS_TYPE=nfds_t',
                'THREADS_POSIX=1',
                '_GNU_SOURCE=1',
              ],
            }],
            ['OS == "win"', {
              'sources': [
                'src/libusb/os/poll_windows.c',
                'src/libusb/os/threads_windows.c',
                'src/libusb/os/windows_usb.c',
              ],
              'include_dirs!': [
                'src',
              ],
              'include_dirs': [
                'src/msvc',
              ],
            }],
            ['OS == "mac"', {
              'sources': [
                'src/libusb/os/darwin_usb.c',
                'src/libusb/os/threads_posix.c',
              ],
              'defines': [
                'DEFAULT_VISIBILITY=',
                'HAVE_POLL_H=1',
                'HAVE_SYS_TIME_H=1',
                'OS_DARWIN=1',
                'POLL_NFDS_TYPE=nfds_t',
                'THREADS_POSIX=1',
                '_GNU_SOURCE=1',
              ],
            }],
          ],
        }],
      ],
    },
  ],
}