From e17b9d6a3b889a2abab7f3b590a74cf743f02956 Mon Sep 17 00:00:00 2001 From: capitalistspz Date: Thu, 26 Sep 2024 21:40:10 +0100 Subject: [PATCH] Make Bluez optional --- CMakeLists.txt | 8 +++++++- src/input/api/Wiimote/WiimoteControllerProvider.cpp | 9 +++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e014ed6d..cf04b235 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ endif() if (UNIX AND NOT APPLE) option(ENABLE_WAYLAND "Build with Wayland support" ON) option(ENABLE_FERAL_GAMEMODE "Enables Feral Interactive GameMode Support" ON) + option(ENABLE_BLUEZ "Build with Bluez support" ON) endif() option(ENABLE_OPENGL "Enables the OpenGL backend" ON) @@ -178,7 +179,12 @@ if (UNIX AND NOT APPLE) add_compile_definitions(HAS_WAYLAND) endif() find_package(GTK3 REQUIRED) - find_package(bluez REQUIRED) + + if(ENABLE_BLUEZ) + find_package(bluez REQUIRED) + set(ENABLE_WIIMOTE ON) + add_compile_definitions(HAS_BLUEZ) + endif() endif() diff --git a/src/input/api/Wiimote/WiimoteControllerProvider.cpp b/src/input/api/Wiimote/WiimoteControllerProvider.cpp index bb063a87..830d987e 100644 --- a/src/input/api/Wiimote/WiimoteControllerProvider.cpp +++ b/src/input/api/Wiimote/WiimoteControllerProvider.cpp @@ -1,10 +1,11 @@ #include "input/api/Wiimote/WiimoteControllerProvider.h" #include "input/api/Wiimote/NativeWiimoteController.h" #include "input/api/Wiimote/WiimoteMessages.h" -#if HAS_HIDAPI + +#ifdef HAS_HIDAPI #include "input/api/Wiimote/hidapi/HidapiWiimote.h" #endif -#if BOOST_OS_LINUX +#ifdef HAS_BLUEZ #include "input/api/Wiimote/l2cap/L2CapWiimote.h" #endif @@ -150,11 +151,11 @@ void WiimoteControllerProvider::connectionThread() while (m_running.load(std::memory_order_relaxed)) { std::vector devices; -#if HAS_HIDAPI +#ifdef HAS_HIDAPI const auto& hidDevices = HidapiWiimote::get_devices(); std::ranges::move(hidDevices, std::back_inserter(devices)); #endif -#if BOOST_OS_LINUX +#ifdef HAS_BLUEZ const auto& l2capDevices = L2CapWiimote::get_devices(); std::ranges::move(l2capDevices, std::back_inserter(devices)); #endif