mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-12-26 23:54:16 +01:00
cmake: make libusb optional
This commit is contained in:
parent
3c2aa183a1
commit
be43b62d79
@ -22,6 +22,8 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON
|
|||||||
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
|
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
|
||||||
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF)
|
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF)
|
||||||
|
|
||||||
|
option(ENABLE_LIBUSB "Enable the use of LibUSB" ON)
|
||||||
|
|
||||||
option(ENABLE_OPENGL "Enable OpenGL" ON)
|
option(ENABLE_OPENGL "Enable OpenGL" ON)
|
||||||
mark_as_advanced(FORCE ENABLE_OPENGL)
|
mark_as_advanced(FORCE ENABLE_OPENGL)
|
||||||
option(ENABLE_QT "Enable the Qt frontend" ON)
|
option(ENABLE_QT "Enable the Qt frontend" ON)
|
||||||
@ -206,7 +208,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
|||||||
find_package(enet 1.3)
|
find_package(enet 1.3)
|
||||||
find_package(fmt 9 REQUIRED)
|
find_package(fmt 9 REQUIRED)
|
||||||
find_package(inih)
|
find_package(inih)
|
||||||
find_package(libusb 1.0.24)
|
|
||||||
find_package(lz4 REQUIRED)
|
find_package(lz4 REQUIRED)
|
||||||
find_package(nlohmann_json 3.8 REQUIRED)
|
find_package(nlohmann_json 3.8 REQUIRED)
|
||||||
find_package(Opus 1.3)
|
find_package(Opus 1.3)
|
||||||
@ -214,6 +215,10 @@ find_package(Vulkan 1.3.238)
|
|||||||
find_package(ZLIB 1.2 REQUIRED)
|
find_package(ZLIB 1.2 REQUIRED)
|
||||||
find_package(zstd 1.5 REQUIRED)
|
find_package(zstd 1.5 REQUIRED)
|
||||||
|
|
||||||
|
if (ENABLE_LIBUSB)
|
||||||
|
find_package(libusb 1.0.24)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
|
if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64)
|
||||||
find_package(xbyak 6 QUIET)
|
find_package(xbyak 6 QUIET)
|
||||||
endif()
|
endif()
|
||||||
|
2
externals/CMakeLists.txt
vendored
2
externals/CMakeLists.txt
vendored
@ -45,7 +45,7 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12" AND CMAKE_CXX_COMPILER
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# libusb
|
# libusb
|
||||||
if (NOT TARGET libusb::usb)
|
if (ENABLE_LIBUSB AND NOT TARGET libusb::usb)
|
||||||
add_subdirectory(libusb EXCLUDE_FROM_ALL)
|
add_subdirectory(libusb EXCLUDE_FROM_ALL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -4,14 +4,10 @@
|
|||||||
add_library(input_common STATIC
|
add_library(input_common STATIC
|
||||||
drivers/camera.cpp
|
drivers/camera.cpp
|
||||||
drivers/camera.h
|
drivers/camera.h
|
||||||
drivers/gc_adapter.cpp
|
|
||||||
drivers/gc_adapter.h
|
|
||||||
drivers/keyboard.cpp
|
drivers/keyboard.cpp
|
||||||
drivers/keyboard.h
|
drivers/keyboard.h
|
||||||
drivers/mouse.cpp
|
drivers/mouse.cpp
|
||||||
drivers/mouse.h
|
drivers/mouse.h
|
||||||
drivers/sdl_driver.cpp
|
|
||||||
drivers/sdl_driver.h
|
|
||||||
drivers/tas_input.cpp
|
drivers/tas_input.cpp
|
||||||
drivers/tas_input.h
|
drivers/tas_input.h
|
||||||
drivers/touch_screen.cpp
|
drivers/touch_screen.cpp
|
||||||
@ -62,8 +58,17 @@ if (ENABLE_SDL2)
|
|||||||
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_LIBUSB)
|
||||||
|
target_sources(input_common PRIVATE
|
||||||
|
drivers/gc_adapter.cpp
|
||||||
|
drivers/gc_adapter.h
|
||||||
|
)
|
||||||
|
target_link_libraries(input_common PRIVATE libusb::usb)
|
||||||
|
target_compile_definitions(input_common PRIVATE HAVE_LIBUSB)
|
||||||
|
endif()
|
||||||
|
|
||||||
create_target_directory_groups(input_common)
|
create_target_directory_groups(input_common)
|
||||||
target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost libusb::usb)
|
target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost)
|
||||||
|
|
||||||
if (YUZU_USE_PRECOMPILED_HEADERS)
|
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||||
target_precompile_headers(input_common PRIVATE precompiled_headers.h)
|
target_precompile_headers(input_common PRIVATE precompiled_headers.h)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "common/input.h"
|
#include "common/input.h"
|
||||||
#include "common/param_package.h"
|
#include "common/param_package.h"
|
||||||
#include "input_common/drivers/camera.h"
|
#include "input_common/drivers/camera.h"
|
||||||
#include "input_common/drivers/gc_adapter.h"
|
|
||||||
#include "input_common/drivers/keyboard.h"
|
#include "input_common/drivers/keyboard.h"
|
||||||
#include "input_common/drivers/mouse.h"
|
#include "input_common/drivers/mouse.h"
|
||||||
#include "input_common/drivers/tas_input.h"
|
#include "input_common/drivers/tas_input.h"
|
||||||
@ -19,6 +18,10 @@
|
|||||||
#include "input_common/input_mapping.h"
|
#include "input_common/input_mapping.h"
|
||||||
#include "input_common/input_poller.h"
|
#include "input_common/input_poller.h"
|
||||||
#include "input_common/main.h"
|
#include "input_common/main.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
|
#include "input_common/drivers/gc_adapter.h"
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
#include "input_common/drivers/sdl_driver.h"
|
#include "input_common/drivers/sdl_driver.h"
|
||||||
#endif
|
#endif
|
||||||
@ -45,7 +48,9 @@ struct InputSubsystem::Impl {
|
|||||||
RegisterEngine("keyboard", keyboard);
|
RegisterEngine("keyboard", keyboard);
|
||||||
RegisterEngine("mouse", mouse);
|
RegisterEngine("mouse", mouse);
|
||||||
RegisterEngine("touch", touch_screen);
|
RegisterEngine("touch", touch_screen);
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
RegisterEngine("gcpad", gcadapter);
|
RegisterEngine("gcpad", gcadapter);
|
||||||
|
#endif
|
||||||
RegisterEngine("cemuhookudp", udp_client);
|
RegisterEngine("cemuhookudp", udp_client);
|
||||||
RegisterEngine("tas", tas_input);
|
RegisterEngine("tas", tas_input);
|
||||||
RegisterEngine("camera", camera);
|
RegisterEngine("camera", camera);
|
||||||
@ -72,7 +77,9 @@ struct InputSubsystem::Impl {
|
|||||||
UnregisterEngine(keyboard);
|
UnregisterEngine(keyboard);
|
||||||
UnregisterEngine(mouse);
|
UnregisterEngine(mouse);
|
||||||
UnregisterEngine(touch_screen);
|
UnregisterEngine(touch_screen);
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
UnregisterEngine(gcadapter);
|
UnregisterEngine(gcadapter);
|
||||||
|
#endif
|
||||||
UnregisterEngine(udp_client);
|
UnregisterEngine(udp_client);
|
||||||
UnregisterEngine(tas_input);
|
UnregisterEngine(tas_input);
|
||||||
UnregisterEngine(camera);
|
UnregisterEngine(camera);
|
||||||
@ -95,8 +102,10 @@ struct InputSubsystem::Impl {
|
|||||||
devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end());
|
devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end());
|
||||||
auto mouse_devices = mouse->GetInputDevices();
|
auto mouse_devices = mouse->GetInputDevices();
|
||||||
devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end());
|
devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end());
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
auto gcadapter_devices = gcadapter->GetInputDevices();
|
auto gcadapter_devices = gcadapter->GetInputDevices();
|
||||||
devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end());
|
devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end());
|
||||||
|
#endif
|
||||||
auto udp_devices = udp_client->GetInputDevices();
|
auto udp_devices = udp_client->GetInputDevices();
|
||||||
devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
|
devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
@ -119,9 +128,11 @@ struct InputSubsystem::Impl {
|
|||||||
if (engine == mouse->GetEngineName()) {
|
if (engine == mouse->GetEngineName()) {
|
||||||
return mouse;
|
return mouse;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
if (engine == gcadapter->GetEngineName()) {
|
if (engine == gcadapter->GetEngineName()) {
|
||||||
return gcadapter;
|
return gcadapter;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (engine == udp_client->GetEngineName()) {
|
if (engine == udp_client->GetEngineName()) {
|
||||||
return udp_client;
|
return udp_client;
|
||||||
}
|
}
|
||||||
@ -194,9 +205,11 @@ struct InputSubsystem::Impl {
|
|||||||
if (engine == mouse->GetEngineName()) {
|
if (engine == mouse->GetEngineName()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
if (engine == gcadapter->GetEngineName()) {
|
if (engine == gcadapter->GetEngineName()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (engine == udp_client->GetEngineName()) {
|
if (engine == udp_client->GetEngineName()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -217,7 +230,9 @@ struct InputSubsystem::Impl {
|
|||||||
void BeginConfiguration() {
|
void BeginConfiguration() {
|
||||||
keyboard->BeginConfiguration();
|
keyboard->BeginConfiguration();
|
||||||
mouse->BeginConfiguration();
|
mouse->BeginConfiguration();
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
gcadapter->BeginConfiguration();
|
gcadapter->BeginConfiguration();
|
||||||
|
#endif
|
||||||
udp_client->BeginConfiguration();
|
udp_client->BeginConfiguration();
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
sdl->BeginConfiguration();
|
sdl->BeginConfiguration();
|
||||||
@ -227,7 +242,9 @@ struct InputSubsystem::Impl {
|
|||||||
void EndConfiguration() {
|
void EndConfiguration() {
|
||||||
keyboard->EndConfiguration();
|
keyboard->EndConfiguration();
|
||||||
mouse->EndConfiguration();
|
mouse->EndConfiguration();
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
gcadapter->EndConfiguration();
|
gcadapter->EndConfiguration();
|
||||||
|
#endif
|
||||||
udp_client->EndConfiguration();
|
udp_client->EndConfiguration();
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
sdl->EndConfiguration();
|
sdl->EndConfiguration();
|
||||||
@ -248,7 +265,6 @@ struct InputSubsystem::Impl {
|
|||||||
|
|
||||||
std::shared_ptr<Keyboard> keyboard;
|
std::shared_ptr<Keyboard> keyboard;
|
||||||
std::shared_ptr<Mouse> mouse;
|
std::shared_ptr<Mouse> mouse;
|
||||||
std::shared_ptr<GCAdapter> gcadapter;
|
|
||||||
std::shared_ptr<TouchScreen> touch_screen;
|
std::shared_ptr<TouchScreen> touch_screen;
|
||||||
std::shared_ptr<TasInput::Tas> tas_input;
|
std::shared_ptr<TasInput::Tas> tas_input;
|
||||||
std::shared_ptr<CemuhookUDP::UDPClient> udp_client;
|
std::shared_ptr<CemuhookUDP::UDPClient> udp_client;
|
||||||
@ -256,6 +272,10 @@ struct InputSubsystem::Impl {
|
|||||||
std::shared_ptr<VirtualAmiibo> virtual_amiibo;
|
std::shared_ptr<VirtualAmiibo> virtual_amiibo;
|
||||||
std::shared_ptr<VirtualGamepad> virtual_gamepad;
|
std::shared_ptr<VirtualGamepad> virtual_gamepad;
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBUSB
|
||||||
|
std::shared_ptr<GCAdapter> gcadapter;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SDL2
|
#ifdef HAVE_SDL2
|
||||||
std::shared_ptr<SDLDriver> sdl;
|
std::shared_ptr<SDLDriver> sdl;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user