summaryrefslogtreecommitdiff
path: root/externals/libusb
diff options
context:
space:
mode:
authorGravatar Lioncash2020-08-25 22:21:32 -0400
committerGravatar Lioncash2020-08-26 02:45:11 -0400
commit045255a0a00acc13c4d266fc63d2cb7e304eddaa (patch)
treed77607ab5cb864c71ca475a9bb5fba8365f48fef /externals/libusb
parentexternals: Untrack non-upstream variant of libusb (diff)
downloadyuzu-045255a0a00acc13c4d266fc63d2cb7e304eddaa.tar.gz
yuzu-045255a0a00acc13c4d266fc63d2cb7e304eddaa.tar.xz
yuzu-045255a0a00acc13c4d266fc63d2cb7e304eddaa.zip
externals: Track upstream libusb
We can place the external in an inner folder and manage the custom files necessary to integrate it with CMake directly. This allows us to directly change how we use it with our build system, as opposed to needing to change a fork.
Diffstat (limited to 'externals/libusb')
-rw-r--r--externals/libusb/CMakeLists.txt147
-rw-r--r--externals/libusb/config.h.in90
m---------externals/libusb/libusb0
3 files changed, 237 insertions, 0 deletions
diff --git a/externals/libusb/CMakeLists.txt b/externals/libusb/CMakeLists.txt
new file mode 100644
index 000000000..074ce01d3
--- /dev/null
+++ b/externals/libusb/CMakeLists.txt
@@ -0,0 +1,147 @@
1add_library(usb STATIC EXCLUDE_FROM_ALL
2 libusb/libusb/core.c
3 libusb/libusb/core.c
4 libusb/libusb/descriptor.c
5 libusb/libusb/hotplug.c
6 libusb/libusb/io.c
7 libusb/libusb/strerror.c
8 libusb/libusb/sync.c
9)
10set_target_properties(usb PROPERTIES VERSION 1.0.23)
11if(WIN32)
12 target_include_directories(usb
13 BEFORE
14 PUBLIC
15 libusb/libusb
16
17 PRIVATE
18 "${CMAKE_CURRENT_BINARY_DIR}"
19 )
20
21 if (NOT MINGW)
22 target_include_directories(usb BEFORE PRIVATE libusb/msvc)
23 endif()
24else()
25target_include_directories(usb
26 # turns out other projects also have "config.h", so make sure the
27 # LibUSB one comes first
28 BEFORE
29
30 PUBLIC
31 libusb/libusb
32
33 PRIVATE
34 "${CMAKE_CURRENT_BINARY_DIR}"
35)
36endif()
37
38if(WIN32 OR CYGWIN)
39 target_sources(usb PRIVATE
40 libusb/libusb/os/threads_windows.c
41 libusb/libusb/os/windows_winusb.c
42 libusb/libusb/os/windows_usbdk.c
43 libusb/libusb/os/windows_nt_common.c
44 )
45 set(OS_WINDOWS TRUE)
46elseif(APPLE)
47 target_sources(usb PRIVATE
48 libusb/libusb/os/darwin_usb.c
49 )
50 find_library(COREFOUNDATION_LIBRARY CoreFoundation)
51 find_library(IOKIT_LIBRARY IOKit)
52 find_library(OBJC_LIBRARY objc)
53 target_link_libraries(usb PRIVATE
54 ${COREFOUNDATION_LIBRARY}
55 ${IOKIT_LIBRARY}
56 ${OBJC_LIBRARY}
57 )
58 set(OS_DARWIN TRUE)
59elseif(ANDROID)
60 target_sources(usb PRIVATE
61 libusb/libusb/os/linux_usbfs.c
62 libusb/libusb/os/linux_netlink.c
63 )
64 find_library(LOG_LIBRARY log)
65 target_link_libraries(usb PRIVATE ${LOG_LIBRARY})
66 set(OS_LINUX TRUE)
67elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
68 target_sources(usb PRIVATE
69 libusb/libusb/os/linux_usbfs.c
70 )
71 find_package(Libudev)
72 if(LIBUDEV_FOUND)
73 target_sources(usb PRIVATE
74 libusb/libusb/os/linux_udev.c
75 )
76 target_link_libraries(usb PRIVATE "${LIBUDEV_LIBRARIES}")
77 target_include_directories(usb PRIVATE "${LIBUDEV_INCLUDE_DIR}")
78 set(HAVE_LIBUDEV TRUE)
79 set(USE_UDEV TRUE)
80 else()
81 target_sources(usb PRIVATE
82 libusb/libusb/os/linux_netlink.c
83 )
84 endif()
85 set(OS_LINUX TRUE)
86elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
87 target_sources(usb PRIVATE
88 libusb/libusb/os/netbsd_usb.c
89 )
90 set(OS_NETBSD TRUE)
91elseif(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
92 target_sources(usb PRIVATE
93 libusb/libusb/os/openbsd_usb.c
94 )
95 set(OS_OPENBSD TRUE)
96endif()
97
98if(UNIX)
99 target_sources(usb PRIVATE
100 libusb/libusb/os/poll_posix.c
101 libusb/libusb/os/threads_posix.c
102 )
103 find_package(Threads REQUIRED)
104 if(THREADS_HAVE_PTHREAD_ARG)
105 target_compile_options(usb PUBLIC "-pthread")
106 endif()
107 if(CMAKE_THREAD_LIBS_INIT)
108 target_link_libraries(usb PRIVATE "${CMAKE_THREAD_LIBS_INIT}")
109 endif()
110 set(THREADS_POSIX TRUE)
111elseif(WIN32)
112 target_sources(usb PRIVATE
113 libusb/libusb/os/poll_windows.c
114 libusb/libusb/os/threads_windows.c
115 )
116endif()
117
118include(CheckFunctionExists)
119include(CheckIncludeFiles)
120include(CheckTypeSize)
121check_include_files(asm/types.h HAVE_ASM_TYPES_H)
122check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
123check_include_files(linux/filter.h HAVE_LINUX_FILTER_H)
124check_include_files(linux/netlink.h HAVE_LINUX_NETLINK_H)
125check_include_files(poll.h HAVE_POLL_H)
126check_include_files(signal.h HAVE_SIGNAL_H)
127check_include_files(strings.h HAVE_STRINGS_H)
128check_type_size("struct timespec" STRUCT_TIMESPEC)
129check_function_exists(syslog HAVE_SYSLOG_FUNC)
130check_include_files(syslog.h HAVE_SYSLOG_H)
131check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
132check_include_files(sys/time.h HAVE_SYS_TIME_H)
133check_include_files(sys/types.h HAVE_SYS_TYPES_H)
134
135set(CMAKE_EXTRA_INCLUDE_FILES poll.h)
136check_type_size("nfds_t" nfds_t)
137unset(CMAKE_EXTRA_INCLUDE_FILES)
138if(HAVE_NFDS_T)
139 set(POLL_NFDS_TYPE "nfds_t")
140else()
141 set(POLL_NFDS_TYPE "unsigned int")
142endif()
143
144check_include_files(sys/timerfd.h USBI_TIMERFD_AVAILABLE)
145
146
147configure_file(config.h.in config.h)
diff --git a/externals/libusb/config.h.in b/externals/libusb/config.h.in
new file mode 100644
index 000000000..915b7390f
--- /dev/null
+++ b/externals/libusb/config.h.in
@@ -0,0 +1,90 @@
1/* Default visibility */
2#if defined(__GNUC__) || defined(__clang__)
3 #define DEFAULT_VISIBILITY __attribute__((visibility("default")))
4#elif defined(_MSC_VER)
5 #define DEFAULT_VISIBILITY __declspec(dllexport)
6#endif
7
8/* Start with debug message logging enabled */
9#undef ENABLE_DEBUG_LOGGING
10
11/* Message logging */
12#undef ENABLE_LOGGING
13
14/* Define to 1 if you have the <asm/types.h> header file. */
15#cmakedefine HAVE_ASM_TYPES_H 1
16
17/* Define to 1 if you have the `gettimeofday' function. */
18#cmakedefine HAVE_GETTIMEOFDAY 1
19
20/* Define to 1 if you have the `udev' library (-ludev). */
21#cmakedefine HAVE_LIBUDEV 1
22
23/* Define to 1 if you have the <linux/filter.h> header file. */
24#cmakedefine HAVE_LINUX_FILTER_H 1
25
26/* Define to 1 if you have the <linux/netlink.h> header file. */
27#cmakedefine HAVE_LINUX_NETLINK_H 1
28
29/* Define to 1 if you have the <poll.h> header file. */
30#cmakedefine HAVE_POLL_H 1
31
32/* Define to 1 if you have the <signal.h> header file. */
33#cmakedefine HAVE_SIGNAL_H 1
34
35/* Define to 1 if you have the <strings.h> header file. */
36#cmakedefine HAVE_STRINGS_H 1
37
38/* Define to 1 if the system has the type `struct timespec'. */
39#cmakedefine HAVE_STRUCT_TIMESPEC 1
40
41/* syslog() function available */
42#cmakedefine HAVE_SYSLOG_FUNC 1
43
44/* Define to 1 if you have the <syslog.h> header file. */
45#cmakedefine HAVE_SYSLOG_H 1
46
47/* Define to 1 if you have the <sys/socket.h> header file. */
48#cmakedefine HAVE_SYS_SOCKET_H 1
49
50/* Define to 1 if you have the <sys/time.h> header file. */
51#cmakedefine HAVE_SYS_TIME_H 1
52
53/* Define to 1 if you have the <sys/types.h> header file. */
54#cmakedefine HAVE_SYS_TYPES_H 1
55
56/* Darwin backend */
57#cmakedefine OS_DARWIN 1
58
59/* Linux backend */
60#cmakedefine OS_LINUX 1
61
62/* NetBSD backend */
63#cmakedefine OS_NETBSD 1
64
65/* OpenBSD backend */
66#cmakedefine OS_OPENBSD 1
67
68/* Windows backend */
69#cmakedefine OS_WINDOWS 1
70
71/* type of second poll() argument */
72#define POLL_NFDS_TYPE @POLL_NFDS_TYPE@
73
74/* Use POSIX Threads */
75#cmakedefine THREADS_POSIX
76
77/* timerfd headers available */
78#cmakedefine USBI_TIMERFD_AVAILABLE 1
79
80/* Enable output to system log */
81#define USE_SYSTEM_LOGGING_FACILITY 1
82
83/* Use udev for device enumeration/hotplug */
84#cmakedefine USE_UDEV 1
85
86/* Use GNU extensions */
87#define _GNU_SOURCE
88
89/* Oldest Windows version supported */
90#define WINVER 0x0501
diff --git a/externals/libusb/libusb b/externals/libusb/libusb
new file mode 160000
Subproject e782eeb2514266f6738e242cdcb18e3ae1ed06f