mirror of
https://github.com/PabloMK7/citra.git
synced 2024-12-26 17:37:19 +00:00
externals: Link SDL2 statically. (#6461)
This commit is contained in:
parent
d8e74a9ff4
commit
71a9981430
|
@ -1,5 +0,0 @@
|
|||
function(copy_citra_SDL_deps target_dir)
|
||||
include(WindowsCopyFiles)
|
||||
set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
|
||||
windows_copy_files(${target_dir} ${SDL2_DLL_DIR} ${DLL_DEST} SDL2.dll)
|
||||
endfunction(copy_citra_SDL_deps)
|
29
externals/libusb/CMakeLists.txt
vendored
29
externals/libusb/CMakeLists.txt
vendored
|
@ -4,7 +4,6 @@ if(MSVC)
|
|||
endif()
|
||||
|
||||
add_library(usb STATIC EXCLUDE_FROM_ALL
|
||||
libusb/libusb/core.c
|
||||
libusb/libusb/core.c
|
||||
libusb/libusb/descriptor.c
|
||||
libusb/libusb/hotplug.c
|
||||
|
@ -42,10 +41,9 @@ endif()
|
|||
|
||||
if(WIN32 OR CYGWIN)
|
||||
target_sources(usb PRIVATE
|
||||
libusb/libusb/os/threads_windows.c
|
||||
libusb/libusb/os/windows_winusb.c
|
||||
libusb/libusb/os/windows_usbdk.c
|
||||
libusb/libusb/os/windows_nt_common.c
|
||||
libusb/libusb/os/windows_common.c
|
||||
)
|
||||
set(OS_WINDOWS TRUE)
|
||||
elseif(APPLE)
|
||||
|
@ -54,10 +52,12 @@ elseif(APPLE)
|
|||
)
|
||||
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(SECURITY_LIBRARY Security)
|
||||
find_library(OBJC_LIBRARY objc)
|
||||
target_link_libraries(usb PRIVATE
|
||||
${COREFOUNDATION_LIBRARY}
|
||||
${IOKIT_LIBRARY}
|
||||
${SECURITY_LIBRARY}
|
||||
${OBJC_LIBRARY}
|
||||
)
|
||||
set(OS_DARWIN TRUE)
|
||||
|
@ -102,7 +102,7 @@ endif()
|
|||
|
||||
if(UNIX)
|
||||
target_sources(usb PRIVATE
|
||||
libusb/libusb/os/poll_posix.c
|
||||
libusb/libusb/os/events_posix.c
|
||||
libusb/libusb/os/threads_posix.c
|
||||
)
|
||||
find_package(Threads REQUIRED)
|
||||
|
@ -112,12 +112,13 @@ if(UNIX)
|
|||
if(CMAKE_THREAD_LIBS_INIT)
|
||||
target_link_libraries(usb PRIVATE "${CMAKE_THREAD_LIBS_INIT}")
|
||||
endif()
|
||||
set(THREADS_POSIX TRUE)
|
||||
set(PLATFORM_POSIX TRUE)
|
||||
elseif(WIN32)
|
||||
target_sources(usb PRIVATE
|
||||
libusb/libusb/os/poll_windows.c
|
||||
libusb/libusb/os/events_windows.c
|
||||
libusb/libusb/os/threads_windows.c
|
||||
)
|
||||
set(PLATFORM_WINDOWS TRUE)
|
||||
endif()
|
||||
|
||||
include(CheckFunctionExists)
|
||||
|
@ -127,7 +128,8 @@ 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_function_exists(eventfd HAVE_EVENTFD)
|
||||
check_function_exists(timerfd_create HAVE_TIMERFD)
|
||||
check_include_files(signal.h HAVE_SIGNAL_H)
|
||||
check_include_files(strings.h HAVE_STRINGS_H)
|
||||
check_type_size("struct timespec" STRUCT_TIMESPEC)
|
||||
|
@ -136,17 +138,6 @@ 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)
|
||||
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES poll.h)
|
||||
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(clock_gettime HAVE_CLOCK_GETTIME)
|
||||
|
||||
configure_file(config.h.in config.h)
|
||||
|
|
21
externals/libusb/config.h.in
vendored
21
externals/libusb/config.h.in
vendored
|
@ -26,8 +26,11 @@
|
|||
/* Define to 1 if you have the <linux/netlink.h> header file. */
|
||||
#cmakedefine HAVE_LINUX_NETLINK_H 1
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#cmakedefine HAVE_POLL_H 1
|
||||
/* Define to 1 if you have eventfd support. */
|
||||
#cmakedefine HAVE_EVENTFD 1
|
||||
|
||||
/* Define to 1 if you have timerfd support. */
|
||||
#cmakedefine HAVE_TIMERFD 1
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#cmakedefine HAVE_SIGNAL_H 1
|
||||
|
@ -53,6 +56,9 @@
|
|||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the 'clock_gettime' function. */
|
||||
#cmakedefine HAVE_CLOCK_GETTIME 1
|
||||
|
||||
/* Darwin backend */
|
||||
#cmakedefine OS_DARWIN 1
|
||||
|
||||
|
@ -68,14 +74,11 @@
|
|||
/* Windows backend */
|
||||
#cmakedefine OS_WINDOWS 1
|
||||
|
||||
/* type of second poll() argument */
|
||||
#define POLL_NFDS_TYPE @POLL_NFDS_TYPE@
|
||||
/* Use POSIX Platform */
|
||||
#cmakedefine PLATFORM_POSIX
|
||||
|
||||
/* Use POSIX Threads */
|
||||
#cmakedefine THREADS_POSIX
|
||||
|
||||
/* timerfd headers available */
|
||||
#cmakedefine USBI_TIMERFD_AVAILABLE 1
|
||||
/* Use Windows Platform */
|
||||
#cmakedefine PLATFORM_WINDOWS
|
||||
|
||||
/* Enable output to system log */
|
||||
#define USE_SYSTEM_LOGGING_FACILITY 1
|
||||
|
|
2
externals/libusb/libusb
vendored
2
externals/libusb/libusb
vendored
|
@ -1 +1 @@
|
|||
Subproject commit e782eeb2514266f6738e242cdcb18e3ae1ed06fa
|
||||
Subproject commit 54350bd83fbcc9555abc57988d6fd73f3b9e9ff8
|
33
externals/sdl2/CMakeLists.txt
vendored
33
externals/sdl2/CMakeLists.txt
vendored
|
@ -1,33 +1,6 @@
|
|||
# Disable building the stuff we don't need.
|
||||
set(SDL_DISKAUDIO OFF CACHE BOOL "")
|
||||
set(SDL_OPENGL ON CACHE BOOL "")
|
||||
set(SDL_OPENGLES ON CACHE BOOL "")
|
||||
set(SDL_OSS OFF CACHE BOOL "")
|
||||
set(SDL_ALSA OFF CACHE BOOL "")
|
||||
set(SDL_JACK OFF CACHE BOOL "")
|
||||
set(SDL_ESD OFF CACHE BOOL "")
|
||||
set(SDL_PIPEWIRE OFF CACHE BOOL "")
|
||||
set(SDL_PULSEAUDIO OFF CACHE BOOL "")
|
||||
set(SDL_ARTS OFF CACHE BOOL "")
|
||||
set(SDL_NAS OFF CACHE BOOL "")
|
||||
set(SDL_SNDIO OFF CACHE BOOL "")
|
||||
set(SDL_FUSIONSOUND OFF CACHE BOOL "")
|
||||
set(SDL_LIBSAMPLERATE OFF CACHE BOOL "")
|
||||
set(SDL_X11 OFF CACHE BOOL "")
|
||||
set(SDL_WAYLAND OFF CACHE BOOL "")
|
||||
set(SDL_RPI OFF CACHE BOOL "")
|
||||
set(SDL_COCOA ON CACHE BOOL "")
|
||||
set(SDL_DIRECTX OFF CACHE BOOL "")
|
||||
set(SDL_WASAPI OFF CACHE BOOL "")
|
||||
set(SDL_RENDER_D3D OFF CACHE BOOL "")
|
||||
set(SDL_RENDER_METAL OFF CACHE BOOL "")
|
||||
set(SDL_VIVANTE OFF CACHE BOOL "")
|
||||
set(SDL_VULKAN OFF CACHE BOOL "")
|
||||
set(SDL_METAL OFF CACHE BOOL "")
|
||||
set(SDL_KMSDRM OFF CACHE BOOL "")
|
||||
set(SDL_OFFSCREEN OFF CACHE BOOL "")
|
||||
set(SDL_SHARED ON CACHE BOOL "")
|
||||
set(SDL_STATIC OFF CACHE BOOL "")
|
||||
# Configure static library build
|
||||
set(SDL_SHARED OFF CACHE BOOL "")
|
||||
set(SDL_STATIC ON CACHE BOOL "")
|
||||
|
||||
# Subsystems
|
||||
set(SDL_ATOMIC ON CACHE BOOL "")
|
||||
|
|
2
externals/sdl2/SDL
vendored
2
externals/sdl2/SDL
vendored
|
@ -1 +1 @@
|
|||
Subproject commit a1d1946dcba6509f0679f507b57e7b228d32e6f8
|
||||
Subproject commit ac13ca9ab691e13e8eebe9684740ddcb0d716203
|
|
@ -29,13 +29,9 @@ if(UNIX AND NOT APPLE)
|
|||
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
include(CopyCitraSDLDeps)
|
||||
copy_citra_SDL_deps(citra)
|
||||
if (ENABLE_WEB_SERVICE AND OPENSSL_DLL_DIR)
|
||||
include(CopyCitraOpensslDeps)
|
||||
copy_citra_openssl_deps(citra)
|
||||
endif()
|
||||
if (MSVC AND ENABLE_WEB_SERVICE AND OPENSSL_DLL_DIR)
|
||||
include(CopyCitraOpensslDeps)
|
||||
copy_citra_openssl_deps(citra)
|
||||
endif()
|
||||
|
||||
if (CITRA_USE_PRECOMPILED_HEADERS)
|
||||
|
|
|
@ -341,9 +341,7 @@ endif()
|
|||
|
||||
if (MSVC)
|
||||
include(CopyCitraQt6Deps)
|
||||
include(CopyCitraSDLDeps)
|
||||
copy_citra_Qt6_deps(citra-qt)
|
||||
copy_citra_SDL_deps(citra-qt)
|
||||
if (ENABLE_WEB_SERVICE AND OPENSSL_DLL_DIR)
|
||||
include(CopyCitraOpensslDeps)
|
||||
copy_citra_openssl_deps(citra-qt)
|
||||
|
|
|
@ -19,13 +19,19 @@
|
|||
#include "common/param_package.h"
|
||||
#include "input_common/gcadapter/gc_adapter.h"
|
||||
|
||||
// Workaround for older libusb versions not having libusb_init_context.
|
||||
// libusb_init is deprecated and causes a compile error in newer versions.
|
||||
#if !defined(LIBUSB_API_VERSION) || (LIBUSB_API_VERSION < 0x0100010A)
|
||||
#define libusb_init_context(a, b, c) libusb_init(a)
|
||||
#endif
|
||||
|
||||
namespace GCAdapter {
|
||||
|
||||
Adapter::Adapter() {
|
||||
if (usb_adapter_handle != nullptr) {
|
||||
return;
|
||||
}
|
||||
const int init_res = libusb_init(&libusb_ctx);
|
||||
const int init_res = libusb_init_context(&libusb_ctx, nullptr, 0);
|
||||
if (init_res == LIBUSB_SUCCESS) {
|
||||
adapter_scan_thread = std::thread(&Adapter::AdapterScanThread, this);
|
||||
} else {
|
||||
|
|
|
@ -57,11 +57,35 @@ typedef struct {
|
|||
|
||||
} SDL_ExtendedGameControllerBind;
|
||||
|
||||
#if SDL_VERSION_ATLEAST(2, 26, 0)
|
||||
/* our hard coded list of mapping support */
|
||||
typedef enum {
|
||||
SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT,
|
||||
SDL_CONTROLLER_MAPPING_PRIORITY_API,
|
||||
SDL_CONTROLLER_MAPPING_PRIORITY_USER,
|
||||
} SDL_ControllerMappingPriority;
|
||||
|
||||
typedef struct _ControllerMapping_t {
|
||||
SDL_JoystickGUID guid;
|
||||
char* name;
|
||||
char* mapping;
|
||||
SDL_ControllerMappingPriority priority;
|
||||
struct _ControllerMapping_t* next;
|
||||
} ControllerMapping_t;
|
||||
#endif
|
||||
|
||||
struct _SDL_GameController {
|
||||
#if SDL_VERSION_ATLEAST(2, 26, 0)
|
||||
const void* magic;
|
||||
#endif
|
||||
|
||||
SDL_Joystick* joystick; /* underlying joystick device */
|
||||
int ref_count;
|
||||
|
||||
const char* name;
|
||||
#if SDL_VERSION_ATLEAST(2, 26, 0)
|
||||
ControllerMapping_t* mapping;
|
||||
#endif
|
||||
int num_bindings;
|
||||
SDL_ExtendedGameControllerBind* bindings;
|
||||
SDL_ExtendedGameControllerBind** last_match_axis;
|
||||
|
|
Loading…
Reference in a new issue