diff options
author | R. van Twisk <ries.van.twisk@ing.com> | 2019-12-20 16:17:27 +0100 |
---|---|---|
committer | R. van Twisk <ries.van.twisk@ing.com> | 2019-12-20 16:17:27 +0100 |
commit | 338b007abe10faa7ecf6004f1162b7a85d30f8f0 (patch) | |
tree | 2a757db0a9920922eb00dcedcdf0b08a2e935825 /cmake | |
parent | 96316119fd57b1d5acdfc0ff51e1766a9311f11f (diff) |
Build ps3eye
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindLibUSB.cmake | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/cmake/FindLibUSB.cmake b/cmake/FindLibUSB.cmake new file mode 100644 index 00000000..8d39db62 --- /dev/null +++ b/cmake/FindLibUSB.cmake @@ -0,0 +1,80 @@ +# - Find libusb for portable USB support +# +# If the LibUSB_ROOT environment variable +# is defined, it will be used as base path. +# The following standard variables get defined: +# LibUSB_FOUND: true if LibUSB was found +# LibUSB_INCLUDE_DIR: the directory that contains the include file +# LibUSB_LIBRARIES: the libraries + +IF(PKG_CONFIG_FOUND) + IF(DEPENDS_DIR) #Otherwise use System pkg-config path + SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPENDS_DIR}/libusb/lib/pkgconfig") + ENDIF() + SET(MODULE "libusb-1.0") + IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + SET(MODULE "libusb-1.0>=1.0.20") + ENDIF() + IF(LibUSB_FIND_REQUIRED) + SET(LibUSB_REQUIRED "REQUIRED") + ENDIF() + PKG_CHECK_MODULES(LibUSB ${LibUSB_REQUIRED} ${MODULE}) + + FIND_LIBRARY(LibUSB_LIBRARY + NAMES ${LibUSB_LIBRARIES} + HINTS ${LibUSB_LIBRARY_DIRS} + ) + SET(LibUSB_LIBRARIES ${LibUSB_LIBRARY}) + + RETURN() +ENDIF() + +FIND_PATH(LibUSB_INCLUDE_DIRS + NAMES libusb.h + PATHS + "${DEPENDS_DIR}/libusb" + "${DEPENDS_DIR}/libusbx" + ENV LibUSB_ROOT + PATH_SUFFIXES + include + libusb + include/libusb-1.0 +) + +SET(LIBUSB_NAME libusb) + +FIND_LIBRARY(LibUSB_LIBRARIES + NAMES ${LIBUSB_NAME}-1.0 + PATHS + "${DEPENDS_DIR}/libusb" + "${DEPENDS_DIR}/libusbx" + ENV LibUSB_ROOT + PATH_SUFFIXES + x64/Release/dll + x64/Debug/dll + Win32/Release/dll + Win32/Debug/dll + MS64 + MS64/dll +) + +IF(WIN32) +FIND_FILE(LibUSB_DLL + ${LIBUSB_NAME}-1.0.dll + PATHS + "${DEPENDS_DIR}/libusb" + "${DEPENDS_DIR}/libusbx" + ENV LibUSB_ROOT + PATH_SUFFIXES + x64/Release/dll + x64/Debug/dll + Win32/Release/dll + Win32/Debug/dll + MS64 + MS64/dll +) +ENDIF() + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUSB FOUND_VAR LibUSB_FOUND + REQUIRED_VARS LibUSB_LIBRARIES LibUSB_INCLUDE_DIRS)
\ No newline at end of file |