From ddc47e6df8cd9e06d799933f67e75ba6f8952acd Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Thu, 3 Jun 2021 03:49:35 -0400 Subject: cmake: General improvements to libusb linking Delegates libusb external communication to externals/CMakeLists.txt Ensures an interface library `usb` for every pathway input_common just links to the `usb` library now externals/libusb/CMakeLists.txt sets variables to override SDL2's libusb finding Other minor cleanup --- CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index c07be6f57..68d9e5f9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -422,18 +422,22 @@ elseif (TARGET Boost::boost) endif() # Ensure libusb is properly configured (based on dolphin libusb include) -if(NOT APPLE) +if(NOT APPLE AND NOT YUZU_USE_BUNDLED_LIBUSB) include(FindPkgConfig) if (PKG_CONFIG_FOUND) pkg_check_modules(LIBUSB QUIET libusb-1.0>=1.0.24) else() find_package(LibUSB) endif() -endif() -if (NOT LIBUSB_FOUND OR YUZU_USE_BUNDLED_LIBUSB) - add_subdirectory(externals/libusb) - set(LIBUSB_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/libusb/libusb/libusb") - set(LIBUSB_LIBRARIES usb) + + if (NOT LIBUSB_FOUND) + message(WARNING "libusb not found, falling back to externals") + set(YUZU_USE_BUNDLED_LIBUSB ON) + else() + add_library(usb INTERFACE) + target_include_directories(usb INTERFACE "${LIBUSB_INCLUDE_DIRS}") + target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARIES}") + endif() endif() # List of all FFmpeg components required -- cgit v1.2.3