Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10577 from shuffle2/libusb
update libusb to v1.0.26
  • Loading branch information
AdmiralCurtiss committed Apr 21, 2022
2 parents 902e45b + 70507c2 commit 3172199
Show file tree
Hide file tree
Showing 98 changed files with 204 additions and 85,165 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -13,3 +13,6 @@
url = https://github.com/dolphin-emu/ext-win-ffmpeg.git
branch = master
shallow = true
[submodule "libusb"]
path = Externals/libusb/libusb
url = https://github.com/libusb/libusb.git
49 changes: 0 additions & 49 deletions Externals/libusb/.travis.yml

This file was deleted.

119 changes: 0 additions & 119 deletions Externals/libusb/AUTHORS

This file was deleted.

4 changes: 0 additions & 4 deletions Externals/libusb/Brewfile

This file was deleted.

118 changes: 60 additions & 58 deletions Externals/libusb/CMakeLists.txt
@@ -1,79 +1,74 @@
add_library(usb STATIC EXCLUDE_FROM_ALL
libusb/core.c
libusb/core.c
libusb/descriptor.c
libusb/hotplug.c
libusb/io.c
libusb/strerror.c
libusb/sync.c
libusb/libusb/core.c
libusb/libusb/descriptor.c
libusb/libusb/hotplug.c
libusb/libusb/io.c
libusb/libusb/strerror.c
libusb/libusb/sync.c
)
set_target_properties(usb PROPERTIES VERSION 1.0.19)
set_target_properties(usb PROPERTIES VERSION 1.0.26)
if(WIN32)
target_include_directories(usb BEFORE PUBLIC libusb PRIVATE msvc)
target_include_directories(usb BEFORE PUBLIC libusb/libusb PRIVATE libusb/msvc)
else()
target_include_directories(usb
# turns out other projects also have "config.h", so make sure the
# LibUSB one comes first
BEFORE

PUBLIC libusb
PUBLIC libusb/libusb
PRIVATE "${CMAKE_CURRENT_BINARY_DIR}"
)
endif()

if(WIN32 OR CYGWIN)
target_sources(usb PRIVATE
libusb/os/threads_windows.c
libusb/os/windows_winusb.c
libusb/os/windows_usbdk.c
libusb/os/windows_nt_common.c
libusb/libusb/os/threads_windows.c
libusb/libusb/os/windows_common.c
libusb/libusb/os/windows_usbdk.c
libusb/libusb/os/windows_winusb.c
)
set(OS_WINDOWS TRUE)
set(PLATFORM_WINDOWS TRUE)
elseif(APPLE)
target_sources(usb PRIVATE libusb/os/darwin_usb.c)
target_sources(usb PRIVATE libusb/libusb/os/darwin_usb.c)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(IOKIT_LIBRARY IOKit)
find_library(OBJC_LIBRARY objc)
find_library(SECURITY_LIBRARY Security)
target_link_libraries(usb PRIVATE
${COREFOUNDATION_LIBRARY}
${IOKIT_LIBRARY}
${OBJC_LIBRARY}
${SECURITY_LIBRARY}
)
set(OS_DARWIN TRUE)
# # Dolphin on Android doesn't use libusb.
#elseif(ANDROID)
# target_sources(usb PRIVATE
# libusb/os/linux_usbfs.c
# libusb/os/linux_netlink.c
# libusb/libusb/os/linux_usbfs.c
# libusb/libusb/os/linux_netlink.c
# )
# find_library(LOG_LIBRARY log)
# target_link_libraries(usb PRIVATE ${LOG_LIBRARY})
# set(OS_LINUX TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_sources(usb PRIVATE libusb/os/linux_usbfs.c)
find_package(Libudev)
target_sources(usb PRIVATE libusb/libusb/os/linux_usbfs.c)
find_package(LIBUDEV)
if(LIBUDEV_FOUND)
target_sources(usb PRIVATE libusb/os/linux_udev.c)
target_sources(usb PRIVATE libusb/libusb/os/linux_udev.c)
target_link_libraries(usb PRIVATE "${LIBUDEV_LIBRARIES}")
target_include_directories(usb PRIVATE "${LIBUDEV_INCLUDE_DIR}")
set(HAVE_LIBUDEV TRUE)
set(USE_UDEV TRUE)
else()
target_sources(usb PRIVATE libusb/os/linux_netlink.c)
target_sources(usb PRIVATE libusb/libusb/os/linux_netlink.c)
endif()
set(OS_LINUX TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
target_sources(usb PRIVATE libusb/os/netbsd_usb.c)
set(OS_NETBSD TRUE)
target_sources(usb PRIVATE libusb/libusb/os/netbsd_usb.c)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
target_sources(usb PRIVATE libusb/os/openbsd_usb.c)
set(OS_OPENBSD TRUE)
target_sources(usb PRIVATE libusb/libusb/os/openbsd_usb.c)
endif()

if(UNIX)
target_sources(usb PRIVATE
libusb/os/poll_posix.c
libusb/os/threads_posix.c
libusb/libusb/os/events_posix.c
libusb/libusb/os/threads_posix.c
)
find_package(Threads REQUIRED)
if(THREADS_HAVE_PTHREAD_ARG)
Expand All @@ -82,41 +77,48 @@ if(UNIX)
if(CMAKE_THREAD_LIBS_INIT)
target_link_libraries(usb PRIVATE "${CMAKE_THREAD_LIBS_INIT}")
endif()
set(THREADS_POSIX TRUE)
elseif(WIN32)
target_sources(usb PRIVATE
libusb/os/poll_windows.c
libusb/os/threads_windows.c
)
set(PLATFORM_POSIX TRUE)
endif()

# Create config.h

include(CheckFunctionExists)
include(CheckIncludeFiles)
#include(CheckLibraryExists)
include(CheckTypeSize)
include(CheckSymbolExists)

check_include_files(asm/types.h HAVE_ASM_TYPES_H)
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
check_include_files(linux/filter.h HAVE_LINUX_FILTER_H)
check_include_files(linux/netlink.h HAVE_LINUX_NETLINK_H)
check_include_files(poll.h HAVE_POLL_H)
check_include_files(signal.h HAVE_SIGNAL_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_type_size("struct timespec" STRUCT_TIMESPEC)
check_function_exists(syslog HAVE_SYSLOG_FUNC)
check_include_files(syslog.h HAVE_SYSLOG_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
check_symbol_exists(EFD_CLOEXEC "sys/eventfd.h" HAVE_DECL_EFD_CLOEXEC)
check_symbol_exists(EFD_NONBLOCK "sys/eventfd.h" HAVE_DECL_EFD_NONBLOCK)
check_symbol_exists(TFD_CLOEXEC "sys/timerfd.h" HAVE_DECL_TFD_CLOEXEC)
check_symbol_exists(TFD_NONBLOCK "sys/timerfd.h" HAVE_DECL_TFD_NONBLOCK)
check_include_files(dlfcn.h HAVE_DLFCN_H)
check_include_files(sys/eventfd.h HAVE_EVENTFD)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(IOKit/usb/IOUSBHostFamilyDefinitions.h HAVE_IOKIT_USB_IOUSBHOSTFAMILYDEFINITIONS_H)
#check_library_exists(udev HAVE_LIBUDEV)
check_include_files(memory.h HAVE_MEMORY_H)

set(CMAKE_EXTRA_INCLUDE_FILES poll.h)
check_type_size("nfds_t" nfds_t)
check_type_size("nfds_t" NFDS_T)
unset(CMAKE_EXTRA_INCLUDE_FILES)
if(HAVE_NFDS_T)
set(POLL_NFDS_TYPE "nfds_t")
else()
set(POLL_NFDS_TYPE "unsigned int")
endif()

check_include_files(sys/timerfd.h USBI_TIMERFD_AVAILABLE)

check_function_exists(pipe2 HAVE_PIPE2)
check_function_exists(pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK)
check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
check_function_exists(pthread_threadid_np HAVE_PTHREAD_THREADID_NP)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(stdlib.h HAVE_STDLIB_H)
check_include_files(strings.h HAVE_STRINGS_H)
check_include_files(string.h HAVE_STRING_H)
check_type_size("struct timespec" STRUCT_TIMESPEC)
check_function_exists(syslog HAVE_SYSLOG)
check_include_files(sys/stat.h HAVE_SYS_STAT_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/types.h HAVE_SYS_TYPES_H)
check_include_files(sys/timerfd.h HAVE_TIMERFD)
check_include_files(unistd.h HAVE_UNISTD_H)

configure_file(config.h.in config.h)

0 comments on commit 3172199

Please sign in to comment.