Make Bluez optional

This commit is contained in:
capitalistspz 2024-09-26 21:40:10 +01:00
parent d52405935f
commit e17b9d6a3b
2 changed files with 12 additions and 5 deletions

View File

@ -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()

View File

@ -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<WiimoteDevicePtr> 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