From be43b62d79cc03f9908ce5036f96a94e9053ba65 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 28 Dec 2022 17:26:46 -0500 Subject: cmake: make libusb optional --- src/input_common/main.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/input_common/main.cpp') diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 86deb4c7c..4dc92f482 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp @@ -5,7 +5,6 @@ #include "common/input.h" #include "common/param_package.h" #include "input_common/drivers/camera.h" -#include "input_common/drivers/gc_adapter.h" #include "input_common/drivers/keyboard.h" #include "input_common/drivers/mouse.h" #include "input_common/drivers/tas_input.h" @@ -19,6 +18,10 @@ #include "input_common/input_mapping.h" #include "input_common/input_poller.h" #include "input_common/main.h" + +#ifdef HAVE_LIBUSB +#include "input_common/drivers/gc_adapter.h" +#endif #ifdef HAVE_SDL2 #include "input_common/drivers/sdl_driver.h" #endif @@ -45,7 +48,9 @@ struct InputSubsystem::Impl { RegisterEngine("keyboard", keyboard); RegisterEngine("mouse", mouse); RegisterEngine("touch", touch_screen); +#ifdef HAVE_LIBUSB RegisterEngine("gcpad", gcadapter); +#endif RegisterEngine("cemuhookudp", udp_client); RegisterEngine("tas", tas_input); RegisterEngine("camera", camera); @@ -72,7 +77,9 @@ struct InputSubsystem::Impl { UnregisterEngine(keyboard); UnregisterEngine(mouse); UnregisterEngine(touch_screen); +#ifdef HAVE_LIBUSB UnregisterEngine(gcadapter); +#endif UnregisterEngine(udp_client); UnregisterEngine(tas_input); UnregisterEngine(camera); @@ -95,8 +102,10 @@ struct InputSubsystem::Impl { devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); auto mouse_devices = mouse->GetInputDevices(); devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); +#ifdef HAVE_LIBUSB auto gcadapter_devices = gcadapter->GetInputDevices(); devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); +#endif auto udp_devices = udp_client->GetInputDevices(); devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); #ifdef HAVE_SDL2 @@ -119,9 +128,11 @@ struct InputSubsystem::Impl { if (engine == mouse->GetEngineName()) { return mouse; } +#ifdef HAVE_LIBUSB if (engine == gcadapter->GetEngineName()) { return gcadapter; } +#endif if (engine == udp_client->GetEngineName()) { return udp_client; } @@ -194,9 +205,11 @@ struct InputSubsystem::Impl { if (engine == mouse->GetEngineName()) { return true; } +#ifdef HAVE_LIBUSB if (engine == gcadapter->GetEngineName()) { return true; } +#endif if (engine == udp_client->GetEngineName()) { return true; } @@ -217,7 +230,9 @@ struct InputSubsystem::Impl { void BeginConfiguration() { keyboard->BeginConfiguration(); mouse->BeginConfiguration(); +#ifdef HAVE_LIBUSB gcadapter->BeginConfiguration(); +#endif udp_client->BeginConfiguration(); #ifdef HAVE_SDL2 sdl->BeginConfiguration(); @@ -227,7 +242,9 @@ struct InputSubsystem::Impl { void EndConfiguration() { keyboard->EndConfiguration(); mouse->EndConfiguration(); +#ifdef HAVE_LIBUSB gcadapter->EndConfiguration(); +#endif udp_client->EndConfiguration(); #ifdef HAVE_SDL2 sdl->EndConfiguration(); @@ -248,7 +265,6 @@ struct InputSubsystem::Impl { std::shared_ptr keyboard; std::shared_ptr mouse; - std::shared_ptr gcadapter; std::shared_ptr touch_screen; std::shared_ptr tas_input; std::shared_ptr udp_client; @@ -256,6 +272,10 @@ struct InputSubsystem::Impl { std::shared_ptr virtual_amiibo; std::shared_ptr virtual_gamepad; +#ifdef HAVE_LIBUSB + std::shared_ptr gcadapter; +#endif + #ifdef HAVE_SDL2 std::shared_ptr sdl; #endif -- cgit v1.2.3