summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt39
-rw-r--r--externals/CMakeLists.txt4
-rw-r--r--externals/find-modules/FindLibUSB.cmake44
-rw-r--r--externals/find-modules/Findlibusb.cmake18
-rw-r--r--externals/libusb/CMakeLists.txt2
-rw-r--r--src/audio_core/CMakeLists.txt6
-rw-r--r--src/input_common/CMakeLists.txt10
-rw-r--r--src/yuzu/CMakeLists.txt6
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp2
-rw-r--r--src/yuzu_cmd/CMakeLists.txt8
10 files changed, 32 insertions, 107 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 523cf81ac..cd59e7485 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,8 +31,6 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSV
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
-option(YUZU_USE_BUNDLED_LIBUSB "Compile bundled libusb" OFF)
-
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" "${WIN32}")
option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
@@ -202,6 +200,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
find_package(enet 1.3)
find_package(fmt 9 REQUIRED)
find_package(inih)
+find_package(libusb 1.0.24)
find_package(lz4 REQUIRED)
find_package(nlohmann_json 3.8 REQUIRED)
find_package(Opus 1.3)
@@ -433,23 +432,13 @@ if (ENABLE_SDL2)
set(SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library")
set(SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll")
- add_library(SDL2 INTERFACE)
- target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
- target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
+ add_library(SDL2::SDL2 INTERFACE IMPORTED)
+ target_link_libraries(SDL2::SDL2 INTERFACE "${SDL2_LIBRARY}")
+ target_include_directories(SDL2::SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
elseif (YUZU_USE_EXTERNAL_SDL2)
message(STATUS "Using SDL2 from externals.")
else()
find_package(SDL2 2.0.18 REQUIRED)
-
- # Some installations don't set SDL2_LIBRARIES
- if("${SDL2_LIBRARIES}" STREQUAL "")
- message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
- set(SDL2_LIBRARIES "SDL2::SDL2")
- endif()
-
- include_directories(SYSTEM ${SDL2_INCLUDE_DIRS})
- add_library(SDL2 INTERFACE)
- target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}")
endif()
endif()
@@ -461,26 +450,6 @@ if (TARGET Boost::boost)
add_library(boost ALIAS Boost::boost)
endif()
-# Ensure libusb is properly configured (based on dolphin libusb include)
-if(NOT YUZU_USE_BUNDLED_LIBUSB)
- find_package(PkgConfig)
- if (PKG_CONFIG_FOUND AND NOT CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD")
- pkg_check_modules(LIBUSB QUIET libusb-1.0>=1.0.24)
- else()
- find_package(LibUSB)
- endif()
-
- if (LIBUSB_FOUND)
- add_library(usb INTERFACE)
- target_include_directories(usb INTERFACE "${LIBUSB_INCLUDEDIR}" "${LIBUSB_INCLUDE_DIRS}")
- target_link_directories(usb INTERFACE "${LIBUSB_LIBRARY_DIRS}")
- target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARIES}")
- else()
- message(WARNING "libusb not found, falling back to externals")
- set(YUZU_USE_BUNDLED_LIBUSB ON)
- endif()
-endif()
-
# List of all FFmpeg components required
set(FFmpeg_COMPONENTS
avcodec
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index fea10d809..4ffafd18c 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -45,8 +45,8 @@ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12" AND CMAKE_CXX_COMPILER
endif()
# libusb
-if (NOT LIBUSB_FOUND OR YUZU_USE_BUNDLED_LIBUSB)
- add_subdirectory(libusb)
+if (NOT TARGET libusb::usb)
+ add_subdirectory(libusb EXCLUDE_FROM_ALL)
endif()
# SDL2
diff --git a/externals/find-modules/FindLibUSB.cmake b/externals/find-modules/FindLibUSB.cmake
deleted file mode 100644
index 617daf9a5..000000000
--- a/externals/find-modules/FindLibUSB.cmake
+++ /dev/null
@@ -1,44 +0,0 @@
-# SPDX-FileCopyrightText: 2009 Michal Cihar <michal@cihar.com>
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-# - Find libusb-1.0 library
-# This module defines
-# LIBUSB_INCLUDE_DIR, where to find bluetooth.h
-# LIBUSB_LIBRARIES, the libraries needed to use libusb-1.0.
-# LIBUSB_FOUND, If false, do not try to use libusb-1.0.
-#
-# vim: expandtab sw=4 ts=4 sts=4:
-
-if(ANDROID)
- set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
- message(STATUS "libusb-1.0 not found.")
-elseif (NOT LIBUSB_FOUND)
- pkg_check_modules (LIBUSB_PKG libusb-1.0)
-
- find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
- PATHS
- ${LIBUSB_PKG_INCLUDE_DIRS}
- /usr/include/libusb-1.0
- /usr/include
- /usr/local/include/libusb-1.0
- /usr/local/include
- )
-
- find_library(LIBUSB_LIBRARIES NAMES usb-1.0 usb
- PATHS
- ${LIBUSB_PKG_LIBRARY_DIRS}
- /usr/lib
- /usr/local/lib
- )
-
- if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
- set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
- message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
- else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
- set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
- message(STATUS "libusb-1.0 not found.")
- endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
-
- mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
-endif ()
-
diff --git a/externals/find-modules/Findlibusb.cmake b/externals/find-modules/Findlibusb.cmake
new file mode 100644
index 000000000..66f61001c
--- /dev/null
+++ b/externals/find-modules/Findlibusb.cmake
@@ -0,0 +1,18 @@
+# SPDX-FileCopyrightText: 2022 Alexandre Bouvier <contact@amb.tf>
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+find_package(PkgConfig QUIET)
+if (PKG_CONFIG_FOUND)
+ pkg_search_module(LIBUSB QUIET IMPORTED_TARGET libusb-1.0)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(libusb
+ REQUIRED_VARS LIBUSB_LINK_LIBRARIES
+ VERSION_VAR LIBUSB_VERSION
+)
+
+if (libusb_FOUND AND NOT TARGET libusb::usb)
+ add_library(libusb::usb ALIAS PkgConfig::LIBUSB)
+endif()
diff --git a/externals/libusb/CMakeLists.txt b/externals/libusb/CMakeLists.txt
index 3cb1b3687..6317ea807 100644
--- a/externals/libusb/CMakeLists.txt
+++ b/externals/libusb/CMakeLists.txt
@@ -273,3 +273,5 @@ else() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
configure_file(config.h.in config.h)
endif() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+
+add_library(libusb::usb ALIAS usb)
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index f573a23e6..420ba62e0 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -227,11 +227,7 @@ if(ENABLE_CUBEB)
target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1)
endif()
if(ENABLE_SDL2)
- if (YUZU_USE_EXTERNAL_SDL2)
- target_link_libraries(audio_core PRIVATE SDL2-static)
- else()
- target_link_libraries(audio_core PRIVATE SDL2)
- endif()
+ target_link_libraries(audio_core PRIVATE SDL2::SDL2)
target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
endif()
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index e41da2726..7932aaab0 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -56,18 +56,12 @@ if (ENABLE_SDL2)
drivers/sdl_driver.cpp
drivers/sdl_driver.h
)
- if (YUZU_USE_EXTERNAL_SDL2)
- target_link_libraries(input_common PRIVATE SDL2-static)
- else()
- target_link_libraries(input_common PRIVATE SDL2)
- endif()
+ target_link_libraries(input_common PRIVATE SDL2::SDL2)
target_compile_definitions(input_common PRIVATE HAVE_SDL2)
endif()
-target_link_libraries(input_common PRIVATE usb)
-
create_target_directory_groups(input_common)
-target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost)
+target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost libusb::usb)
if (YUZU_USE_PRECOMPILED_HEADERS)
target_precompile_headers(input_common PRIVATE precompiled_headers.h)
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 9971bdfab..d23eb2907 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -391,11 +391,7 @@ if (YUZU_USE_BUNDLED_QT AND QT_VERSION VERSION_LESS 6)
endif()
if (ENABLE_SDL2)
- if (YUZU_USE_EXTERNAL_SDL2)
- target_link_libraries(yuzu PRIVATE SDL2-static)
- else()
- target_link_libraries(yuzu PRIVATE SDL2)
- endif()
+ target_link_libraries(yuzu PRIVATE SDL2::SDL2)
target_compile_definitions(yuzu PRIVATE HAVE_SDL2)
endif()
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 8ca683966..e9388daad 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -31,7 +31,7 @@ ConfigureGraphics::ConfigureGraphics(const Core::System& system_, QWidget* paren
ui->backend->addItem(QStringLiteral("GLSL"));
ui->backend->addItem(tr("GLASM (Assembly Shaders, NVIDIA Only)"));
- ui->backend->addItem(QStringLiteral("SPIR-V (Experimental, Mesa Only)"));
+ ui->backend->addItem(tr("SPIR-V (Experimental, Mesa Only)"));
SetupPerGameUI();
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt
index 19b1d258c..f6eeb9d8d 100644
--- a/src/yuzu_cmd/CMakeLists.txt
+++ b/src/yuzu_cmd/CMakeLists.txt
@@ -43,13 +43,7 @@ target_link_libraries(yuzu-cmd PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
create_resource("../../dist/yuzu.bmp" "yuzu_cmd/yuzu_icon.h" "yuzu_icon")
target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
-target_link_libraries(yuzu-cmd PRIVATE Vulkan::Headers)
-
-if (YUZU_USE_EXTERNAL_SDL2)
- target_link_libraries(yuzu-cmd PRIVATE SDL2-static)
-else()
- target_link_libraries(yuzu-cmd PRIVATE SDL2)
-endif()
+target_link_libraries(yuzu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers)
if(UNIX AND NOT APPLE)
install(TARGETS yuzu-cmd)