early-access version 3191

This commit is contained in:
pineappleEA 2022-12-06 17:31:52 +01:00
parent dd16f58704
commit 80ee8ddb9d
15 changed files with 81 additions and 115 deletions

View file

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

View file

@ -1,7 +1,7 @@
yuzu emulator early access
=============
This is the source code for early-access 3190.
This is the source code for early-access 3191.
## Legal Notice

View file

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

View file

@ -1,19 +1,17 @@
# SPDX-FileCopyrightText: 2022 yuzu Emulator Project
# SPDX-License-Identifier: GPL-2.0-or-later
find_package(PkgConfig)
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(opus IMPORTED_TARGET GLOBAL opus)
if (opus_FOUND)
add_library(Opus::opus ALIAS PkgConfig::opus)
endif()
pkg_search_module(OPUS QUIET IMPORTED_TARGET opus)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Opus
REQUIRED_VARS
opus_LINK_LIBRARIES
opus_FOUND
VERSION_VAR opus_VERSION
REQUIRED_VARS OPUS_LINK_LIBRARIES
VERSION_VAR OPUS_VERSION
)
if (Opus_FOUND AND NOT TARGET Opus::opus)
add_library(Opus::opus ALIAS PkgConfig::OPUS)
endif()

View file

@ -4,10 +4,7 @@
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(ENET QUIET IMPORTED_TARGET GLOBAL libenet)
if (ENET_FOUND)
add_library(enet::enet ALIAS PkgConfig::ENET)
endif()
pkg_search_module(ENET QUIET IMPORTED_TARGET libenet)
endif()
include(FindPackageHandleStandardArgs)
@ -15,3 +12,7 @@ find_package_handle_standard_args(enet
REQUIRED_VARS ENET_LINK_LIBRARIES
VERSION_VAR ENET_VERSION
)
if (enet_FOUND AND NOT TARGET enet::enet)
add_library(enet::enet ALIAS PkgConfig::ENET)
endif()

View file

@ -10,13 +10,14 @@ if (httplib_FOUND)
else()
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(HTTPLIB QUIET IMPORTED_TARGET GLOBAL cpp-httplib)
if (HTTPLIB_FOUND)
add_library(httplib::httplib ALIAS PkgConfig::HTTPLIB)
endif()
pkg_search_module(HTTPLIB QUIET IMPORTED_TARGET cpp-httplib)
endif()
find_package_handle_standard_args(httplib
REQUIRED_VARS HTTPLIB_INCLUDEDIR
VERSION_VAR HTTPLIB_VERSION
)
endif()
if (httplib_FOUND AND NOT TARGET httplib::httplib)
add_library(httplib::httplib ALIAS PkgConfig::HTTPLIB)
endif()

View file

@ -4,10 +4,7 @@
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(INIREADER QUIET IMPORTED_TARGET GLOBAL INIReader)
if (INIREADER_FOUND)
add_library(inih::INIReader ALIAS PkgConfig::INIREADER)
endif()
pkg_search_module(INIREADER QUIET IMPORTED_TARGET INIReader)
endif()
include(FindPackageHandleStandardArgs)
@ -15,3 +12,7 @@ find_package_handle_standard_args(inih
REQUIRED_VARS INIREADER_LINK_LIBRARIES
VERSION_VAR INIREADER_VERSION
)
if (inih_FOUND AND NOT TARGET inih::INIReader)
add_library(inih::INIReader ALIAS PkgConfig::INIREADER)
endif()

18
externals/find-modules/Findlibusb.cmake vendored Executable file
View file

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

View file

@ -6,25 +6,23 @@ include(FindPackageHandleStandardArgs)
find_package(lz4 QUIET CONFIG)
if (lz4_FOUND)
find_package_handle_standard_args(lz4 CONFIG_MODE)
if (NOT TARGET lz4::lz4)
if (TARGET LZ4::lz4_shared)
set_target_properties(LZ4::lz4_shared PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(lz4::lz4 ALIAS LZ4::lz4_shared)
else()
set_target_properties(LZ4::lz4_static PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(lz4::lz4 ALIAS LZ4::lz4_static)
endif()
endif()
else()
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(liblz4 QUIET IMPORTED_TARGET GLOBAL liblz4)
if (liblz4_FOUND)
add_library(lz4::lz4 ALIAS PkgConfig::liblz4)
endif()
pkg_search_module(LZ4 QUIET IMPORTED_TARGET liblz4)
endif()
find_package_handle_standard_args(lz4
REQUIRED_VARS liblz4_LINK_LIBRARIES
VERSION_VAR liblz4_VERSION
REQUIRED_VARS LZ4_LINK_LIBRARIES
VERSION_VAR LZ4_VERSION
)
endif()
if (lz4_FOUND AND NOT TARGET lz4::lz4)
if (TARGET LZ4::lz4_shared)
add_library(lz4::lz4 ALIAS LZ4::lz4_shared)
elseif (TARGET LZ4::lz4_static)
add_library(lz4::lz4 ALIAS LZ4::lz4_static)
else()
add_library(lz4::lz4 ALIAS PkgConfig::LZ4)
endif()
endif()

View file

@ -6,25 +6,23 @@ include(FindPackageHandleStandardArgs)
find_package(zstd QUIET CONFIG)
if (zstd_FOUND)
find_package_handle_standard_args(zstd CONFIG_MODE)
if (NOT TARGET zstd::zstd)
if (TARGET zstd::libzstd_shared)
set_target_properties(zstd::libzstd_shared PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(zstd::zstd ALIAS zstd::libzstd_shared)
else()
set_target_properties(zstd::libzstd_static PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(zstd::zstd ALIAS zstd::libzstd_static)
endif()
endif()
else()
find_package(PkgConfig QUIET)
if (PKG_CONFIG_FOUND)
pkg_search_module(libzstd QUIET IMPORTED_TARGET GLOBAL libzstd)
if (libzstd_FOUND)
add_library(zstd::zstd ALIAS PkgConfig::libzstd)
endif()
pkg_search_module(ZSTD QUIET IMPORTED_TARGET libzstd)
endif()
find_package_handle_standard_args(zstd
REQUIRED_VARS libzstd_LINK_LIBRARIES
VERSION_VAR libzstd_VERSION
REQUIRED_VARS ZSTD_LINK_LIBRARIES
VERSION_VAR ZSTD_VERSION
)
endif()
if (zstd_FOUND AND NOT TARGET zstd::zstd)
if (TARGET zstd::libzstd_shared)
add_library(zstd::zstd ALIAS zstd::libzstd_shared)
elseif (TARGET zstd::libzstd_static)
add_library(zstd::zstd ALIAS zstd::libzstd_static)
else()
add_library(zstd::zstd ALIAS PkgConfig::ZSTD)
endif()
endif()

View file

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

View file

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

View file

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

View file

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

View file

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