[compat] fix libusb when disabled error (solaris, fbsd, etc) #2649

Open
Lizzie wants to merge 2 commits from fix-compat-libusb-1 into master
4 changed files with 16 additions and 38 deletions

View file

@ -155,7 +155,8 @@ option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF) option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
set(YUZU_QT_MIRROR "" CACHE STRING "What mirror to use for downloading the bundled Qt libraries") set(YUZU_QT_MIRROR "" CACHE STRING "What mirror to use for downloading the bundled Qt libraries")
option(ENABLE_CUBEB "Enables the cubeb audio backend" ON) # FreeBSD doesn't have a cubeb port yet, vendoring it isn't required (it's optional anyways)
cmake_dependent_option(ENABLE_CUBEB "Enables the cubeb audio backend" ON "NOT PLATFORM_FREEBSD" OFF)

Cmake dependent option forces it off here if the fourth argument is true, so you should just do

if (PLATFORM_FREEBSD)
    set(CUBEB_DEFAULT OFF)
else()
    set(CUBEB_DEFAULT ON)
endif()

option(ENABLE_CUBEB "Enables the cubeb audio backend" ${ENABLE_CUBEB})

also, it gets vendored either way, so idk if this is even needed

Cmake dependent option *forces* it off here if the fourth argument is true, so you should just do ```cmake if (PLATFORM_FREEBSD) set(CUBEB_DEFAULT OFF) else() set(CUBEB_DEFAULT ON) endif() option(ENABLE_CUBEB "Enables the cubeb audio backend" ${ENABLE_CUBEB}) ``` also, it gets vendored either way, so idk if this is even needed
set(EXT_DEFAULT OFF) set(EXT_DEFAULT OFF)
if (MSVC OR ANDROID) if (MSVC OR ANDROID)
@ -166,7 +167,8 @@ option(YUZU_USE_CPM "Use CPM to fetch system dependencies (fmt, boost, etc) if n
option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${EXT_DEFAULT}) option(YUZU_USE_BUNDLED_FFMPEG "Download bundled FFmpeg" ${EXT_DEFAULT})
cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from source" OFF "NOT WIN32 AND NOT ANDROID" OFF) cmake_dependent_option(YUZU_USE_EXTERNAL_FFMPEG "Build FFmpeg from source" OFF "NOT WIN32 AND NOT ANDROID" OFF)
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "NOT ANDROID" OFF) # Re-allow on FreeBSD once its on mainline ports
cmake_dependent_option(ENABLE_LIBUSB "Enable the use of LibUSB" ON "WIN32 OR PLATFORM_LINUX OR APPLE" OFF)
cmake_dependent_option(ENABLE_OPENGL "Enable OpenGL" ON "NOT WIN32 OR NOT ARCHITECTURE_arm64" OFF) cmake_dependent_option(ENABLE_OPENGL "Enable OpenGL" ON "NOT WIN32 OR NOT ARCHITECTURE_arm64" OFF)
mark_as_advanced(FORCE ENABLE_OPENGL) mark_as_advanced(FORCE ENABLE_OPENGL)

View file

@ -144,32 +144,8 @@ brew install molten-vk vulkan-loader
<details> <details>
<summary>FreeBSD</summary> <summary>FreeBSD</summary>
``` ```sh
devel/cmake sudo pkg install devel/cmake devel/sdl20 devel/boost-libs devel/catch2 devel/libfmt devel/nlohmann-json devel/ninja devel/nasm devel/autoconf devel/pkgconf devel/qt6-base devel/simpleini net/enet multimedia/ffnvcodec-headers multimedia/ffmpeg audio/opus archivers/liblz4 lang/gcc12 graphics/glslang graphics/vulkan-utility-libraries graphics/spirv-tools www/cpp-httplib devel/jwt-cpp devel/unordered-dense devel/zydis
devel/sdl20
devel/boost-libs
devel/catch2
devel/libfmt
devel/nlohmann-json
devel/ninja
devel/nasm
devel/autoconf
devel/pkgconf
devel/qt6-base
net/enet
multimedia/ffnvcodec-headers
multimedia/ffmpeg
audio/opus
archivers/liblz4
lang/gcc12
graphics/glslang
graphics/vulkan-utility-libraries
``` ```
If using FreeBSD 12 or prior, use `devel/pkg-config` instead. If using FreeBSD 12 or prior, use `devel/pkg-config` instead.

View file

@ -83,7 +83,7 @@ if (ENABLE_LIBUSB)
drivers/gc_adapter.h drivers/gc_adapter.h
) )
target_link_libraries(input_common PRIVATE libusb::usb) target_link_libraries(input_common PRIVATE libusb::usb)
target_compile_definitions(input_common PRIVATE HAVE_LIBUSB) target_compile_definitions(input_common PRIVATE ENABLE_LIBUSB)
endif() endif()
create_target_directory_groups(input_common) create_target_directory_groups(input_common)

View file

@ -19,7 +19,7 @@
#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 #ifdef ENABLE_LIBUSB
#include "input_common/drivers/gc_adapter.h" #include "input_common/drivers/gc_adapter.h"
#endif #endif
#ifdef HAVE_SDL2 #ifdef HAVE_SDL2
@ -76,7 +76,7 @@ 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 #ifdef ENABLE_LIBUSB
RegisterEngine("gcpad", gcadapter); RegisterEngine("gcpad", gcadapter);
#endif #endif
RegisterEngine("cemuhookudp", udp_client); RegisterEngine("cemuhookudp", udp_client);
@ -110,7 +110,7 @@ struct InputSubsystem::Impl {
UnregisterEngine(keyboard); UnregisterEngine(keyboard);
UnregisterEngine(mouse); UnregisterEngine(mouse);
UnregisterEngine(touch_screen); UnregisterEngine(touch_screen);
#ifdef HAVE_LIBUSB #ifdef ENABLE_LIBUSB
UnregisterEngine(gcadapter); UnregisterEngine(gcadapter);
#endif #endif
UnregisterEngine(udp_client); UnregisterEngine(udp_client);
@ -145,7 +145,7 @@ struct InputSubsystem::Impl {
auto android_devices = android->GetInputDevices(); auto android_devices = android->GetInputDevices();
devices.insert(devices.end(), android_devices.begin(), android_devices.end()); devices.insert(devices.end(), android_devices.begin(), android_devices.end());
#endif #endif
#ifdef HAVE_LIBUSB #ifdef ENABLE_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 #endif
@ -178,7 +178,7 @@ struct InputSubsystem::Impl {
return android; return android;
} }
#endif #endif
#ifdef HAVE_LIBUSB #ifdef ENABLE_LIBUSB
if (engine == gcadapter->GetEngineName()) { if (engine == gcadapter->GetEngineName()) {
return gcadapter; return gcadapter;
} }
@ -263,7 +263,7 @@ struct InputSubsystem::Impl {
return true; return true;
} }
#endif #endif
#ifdef HAVE_LIBUSB #ifdef ENABLE_LIBUSB
if (engine == gcadapter->GetEngineName()) { if (engine == gcadapter->GetEngineName()) {
return true; return true;
} }
@ -294,7 +294,7 @@ struct InputSubsystem::Impl {
#ifdef ANDROID #ifdef ANDROID
android->BeginConfiguration(); android->BeginConfiguration();
#endif #endif
#ifdef HAVE_LIBUSB #ifdef ENABLE_LIBUSB
gcadapter->BeginConfiguration(); gcadapter->BeginConfiguration();
#endif #endif
udp_client->BeginConfiguration(); udp_client->BeginConfiguration();
@ -310,7 +310,7 @@ struct InputSubsystem::Impl {
#ifdef ANDROID #ifdef ANDROID
android->EndConfiguration(); android->EndConfiguration();
#endif #endif
#ifdef HAVE_LIBUSB #ifdef ENABLE_LIBUSB
gcadapter->EndConfiguration(); gcadapter->EndConfiguration();
#endif #endif
udp_client->EndConfiguration(); udp_client->EndConfiguration();
@ -343,7 +343,7 @@ 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 #ifdef ENABLE_LIBUSB
std::shared_ptr<GCAdapter> gcadapter; std::shared_ptr<GCAdapter> gcadapter;
#endif #endif