Chromium Code Reviews| Index: third_party/libusb/libusb.gyp |
| diff --git a/third_party/libusb/libusb.gyp b/third_party/libusb/libusb.gyp |
| index 6c5ffd4656d92349bd493d487c2dd36135c77967..7fb333152cd946666aff9ea90b7e9727e5ea1d65 100644 |
| --- a/third_party/libusb/libusb.gyp |
| +++ b/third_party/libusb/libusb.gyp |
| @@ -3,63 +3,90 @@ |
| # found in the LICENSE file. |
| { |
| + 'variables': { |
| + 'use_system_libusb%': 0, |
| + 'required_libusb_version': '1.0.0', |
|
Paweł Hajdan Jr.
2012/05/10 06:36:15
nit: This is not so much needed, because the lates
Garret Kelly
2012/05/10 17:44:01
Done.
|
| + }, |
| 'targets': [ |
| { |
| 'target_name': 'libusb', |
| - 'type': '<(library)', |
| - 'sources': [ |
| - 'libusb/core.c', |
| - 'libusb/descriptor.c', |
| - 'libusb/io.c', |
| - 'libusb/sync.c', |
| - ], |
| - 'include_dirs': [ |
| - '.', |
| - 'libusb', |
| - 'libusb/os', |
| - ], |
| 'conditions': [ |
| - [ 'OS == "linux"', { |
| - 'sources': [ |
| - 'libusb/os/linux_usbfs.c', |
| - '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"', { |
| + ['OS == "linux" and use_system_libusb', { |
| + 'type': 'none', |
| + 'direct_dependent_settings': { |
| + 'defines': [ |
| + 'USE_SYSTEM_LIBUSB', |
| + ], |
| + 'cflags': [ |
| + '<!@(pkg-config --atleast-version=<(required_libusb_version) libusb-1.0)', |
| + '<!@(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': [ |
| - 'libusb/os/poll_windows.c', |
| - 'libusb/os/threads_windows.c', |
| - 'libusb/os/windows_usb.c', |
| - ], |
| - 'include_dirs!': [ |
| - '.', |
| + 'src/libusb/core.c', |
| + 'src/libusb/descriptor.c', |
| + 'src/libusb/io.c', |
| + 'src/libusb/sync.c', |
| ], |
| 'include_dirs': [ |
| - 'msvc', |
| - ], |
| - }], |
| - [ 'OS == "mac"', { |
| - 'sources': [ |
| - 'libusb/os/darwin_usb.c', |
| - 'libusb/os/threads_posix.c', |
| + 'src', |
| + 'src/libusb', |
| + 'src/libusb/os', |
| ], |
| - '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', |
| + 'conditions': [ |
| + [ 'OS == "linux"', { |
| + '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', |
| + ], |
| + }], |
| ], |
| }], |
| ], |