1
0
Fork 0
forked from suyu/suyu

Replace externals with Conan (#3735)

* Remove git submodules that will be loaded through conan

* Move custom Find modules to their own folder

* Use conan for downloading missing external dependencies

* CI: Change the yuzu source folder user to the user that the containers run on

* Attempt to remove dirty mingw build hack

* Install conan on the msvc build

* Only set release build type when using not using multi config generator

* Re-add qt bundled to workaround an issue with conan qt not downloading prebuilt binaries

* Add workaround for submodules that use legacy CMAKE variables

* Re-add USE_BUNDLED_QT on the msvc build bot
This commit is contained in:
James Rowe 2020-05-08 15:09:29 -06:00 committed by GitHub
parent 50c27d5ae1
commit bc30a591ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 579 additions and 17864 deletions

View file

@ -1,4 +1,7 @@
#!/bin/bash -ex #!/bin/bash -ex
chmod a+x ./.ci/scripts/format/docker.sh chmod a+x ./.ci/scripts/format/docker.sh
# the UID for the container yuzu user is 1027
sudo chown -R 1027 ./
docker run -v $(pwd):/yuzu yuzuemu/build-environments:linux-clang-format /bin/bash -ex /yuzu/.ci/scripts/format/docker.sh docker run -v $(pwd):/yuzu yuzuemu/build-environments:linux-clang-format /bin/bash -ex /yuzu/.ci/scripts/format/docker.sh
sudo chown -R $UID ./

View file

@ -2,4 +2,7 @@
mkdir -p "ccache" || true mkdir -p "ccache" || true
chmod a+x ./.ci/scripts/linux/docker.sh chmod a+x ./.ci/scripts/linux/docker.sh
# the UID for the container yuzu user is 1027
sudo chown -R 1027 ./
docker run -e ENABLE_COMPATIBILITY_REPORTING -e CCACHE_DIR=/yuzu/ccache -v $(pwd):/yuzu yuzuemu/build-environments:linux-fresh /bin/bash /yuzu/.ci/scripts/linux/docker.sh $1 docker run -e ENABLE_COMPATIBILITY_REPORTING -e CCACHE_DIR=/yuzu/ccache -v $(pwd):/yuzu yuzuemu/build-environments:linux-fresh /bin/bash /yuzu/.ci/scripts/linux/docker.sh $1
sudo chown -R $UID ./

View file

@ -4,22 +4,10 @@ cd /yuzu
ccache -s ccache -s
# Dirty hack to trick unicorn makefile into believing we are in a MINGW system
mv /bin/uname /bin/uname1 && echo -e '#!/bin/sh\necho MINGW64' >> /bin/uname
chmod +x /bin/uname
# Dirty hack to trick unicorn makefile into believing we have cmd
echo '' >> /bin/cmd
chmod +x /bin/cmd
mkdir build || true && cd build mkdir build || true && cd build
cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_UNICORN=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release cmake .. -G Ninja -DDISPLAY_VERSION=$1 -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_UNICORN=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release
ninja ninja
# Clean up the dirty hacks
rm /bin/uname && mv /bin/uname1 /bin/uname
rm /bin/cmd
ccache -s ccache -s
echo "Tests skipped" echo "Tests skipped"

View file

@ -2,4 +2,7 @@
mkdir -p "ccache" || true mkdir -p "ccache" || true
chmod a+x ./.ci/scripts/windows/docker.sh chmod a+x ./.ci/scripts/windows/docker.sh
# the UID for the container yuzu user is 1027
sudo chown -R 1027 ./
docker run -e CCACHE_DIR=/yuzu/ccache -v $(pwd):/yuzu yuzuemu/build-environments:linux-mingw /bin/bash -ex /yuzu/.ci/scripts/windows/docker.sh $1 docker run -e CCACHE_DIR=/yuzu/ccache -v $(pwd):/yuzu yuzuemu/build-environments:linux-mingw /bin/bash -ex /yuzu/.ci/scripts/windows/docker.sh $1
sudo chown -R $UID ./

View file

@ -4,7 +4,9 @@ parameters:
version: '' version: ''
steps: steps:
- script: mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 --config Release -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_BUNDLED_UNICORN=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cd .. - script: python -m pip install --upgrade pip conan
displayName: 'Install conan'
- script: mkdir build && cd build && cmake -G "Visual Studio 16 2019" -A x64 --config Release -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_UNICORN=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON -DDISPLAY_VERSION=${{ parameters['version'] }} .. && cd ..
displayName: 'Configure CMake' displayName: 'Configure CMake'
- task: MSBuild@1 - task: MSBuild@1
displayName: 'Build' displayName: 'Build'

30
.gitmodules vendored
View file

@ -1,54 +1,30 @@
[submodule "inih"] [submodule "inih"]
path = externals/inih/inih path = externals/inih/inih
url = https://github.com/svn2github/inih url = https://github.com/svn2github/inih
[submodule "boost"]
path = externals/boost
url = https://github.com/yuzu-emu/ext-boost.git
[submodule "catch"]
path = externals/catch
url = https://github.com/philsquared/Catch.git
[submodule "cubeb"] [submodule "cubeb"]
path = externals/cubeb path = externals/cubeb
url = https://github.com/kinetiknz/cubeb.git url = https://github.com/kinetiknz/cubeb.git
[submodule "dynarmic"] [submodule "dynarmic"]
path = externals/dynarmic path = externals/dynarmic
url = https://github.com/MerryMage/dynarmic.git url = https://github.com/MerryMage/dynarmic.git
[submodule "fmt"]
path = externals/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "lz4"]
path = externals/lz4
url = https://github.com/lz4/lz4.git
[submodule "unicorn"] [submodule "unicorn"]
path = externals/unicorn path = externals/unicorn
url = https://github.com/yuzu-emu/unicorn url = https://github.com/yuzu-emu/unicorn
[submodule "mbedtls"]
path = externals/mbedtls
url = https://github.com/DarkLordZach/mbedtls
[submodule "opus"]
path = externals/opus/opus
url = https://github.com/xiph/opus.git
[submodule "soundtouch"] [submodule "soundtouch"]
path = externals/soundtouch path = externals/soundtouch
url = https://github.com/citra-emu/ext-soundtouch.git url = https://github.com/citra-emu/ext-soundtouch.git
[submodule "libressl"]
path = externals/libressl
url = https://github.com/citra-emu/ext-libressl-portable.git
[submodule "discord-rpc"] [submodule "discord-rpc"]
path = externals/discord-rpc path = externals/discord-rpc
url = https://github.com/discordapp/discord-rpc.git url = https://github.com/discordapp/discord-rpc.git
[submodule "Vulkan-Headers"] [submodule "Vulkan-Headers"]
path = externals/Vulkan-Headers path = externals/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git url = https://github.com/KhronosGroup/Vulkan-Headers.git
[submodule "externals/zstd"]
path = externals/zstd
url = https://github.com/facebook/zstd
[submodule "sirit"] [submodule "sirit"]
path = externals/sirit path = externals/sirit
url = https://github.com/ReinUsesLisp/sirit url = https://github.com/ReinUsesLisp/sirit
[submodule "mbedtls"]
path = externals/mbedtls
url = https://github.com/DarkLordZach/mbedtls
[submodule "libzip"] [submodule "libzip"]
path = externals/libzip/libzip path = externals/libzip/libzip
url = https://github.com/nih-at/libzip.git url = https://github.com/nih-at/libzip.git
[submodule "zlib"]
path = externals/zlib/zlib
url = https://github.com/madler/zlib.git

View file

@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.7) cmake_minimum_required(VERSION 3.11)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/find-modules")
include(DownloadExternals) include(DownloadExternals)
include(CMakeDependentOption) include(CMakeDependentOption)
@ -10,10 +11,9 @@ project(yuzu)
# Set bundled sdl2/qt as dependent options. # Set bundled sdl2/qt as dependent options.
# OFF by default, but if ENABLE_SDL2 and MSVC are true then ON # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
option(ENABLE_QT "Enable the Qt frontend" ON) option(ENABLE_QT "Enable the Qt frontend" ON)
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_QT;MSVC" OFF) CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" OFF "ENABLE_QT;MSVC" OFF)
option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
@ -29,6 +29,13 @@ option(ENABLE_VULKAN "Enables Vulkan backend" ON)
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF) option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
# Default to a Release build
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT IS_MULTI_CONFIG AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
message(STATUS "Defaulting to a Release build")
endif()
if(EXISTS ${PROJECT_SOURCE_DIR}/hooks/pre-commit AND NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/pre-commit) if(EXISTS ${PROJECT_SOURCE_DIR}/hooks/pre-commit AND NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/pre-commit)
message(STATUS "Copying pre-commit hook") message(STATUS "Copying pre-commit hook")
file(COPY hooks/pre-commit file(COPY hooks/pre-commit
@ -53,7 +60,6 @@ endfunction()
if(EXISTS ${PROJECT_SOURCE_DIR}/.gitmodules) if(EXISTS ${PROJECT_SOURCE_DIR}/.gitmodules)
check_submodules_present() check_submodules_present()
endif() endif()
configure_file(${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.qrc configure_file(${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.qrc
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
COPYONLY) COPYONLY)
@ -115,49 +121,211 @@ message(STATUS "Target architecture: ${ARCHITECTURE}")
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# System imported libraries
# ======================
find_package(Boost 1.66.0 QUIET)
if (NOT Boost_FOUND)
message(STATUS "Boost 1.66.0 or newer not found, falling back to externals")
set(BOOST_ROOT "${PROJECT_SOURCE_DIR}/externals/boost")
set(Boost_NO_SYSTEM_PATHS OFF)
find_package(Boost QUIET REQUIRED)
endif()
# Output binaries to bin/ # Output binaries to bin/
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
# Prefer the -pthread flag on Linux. # System imported libraries
set(THREADS_PREFER_PTHREAD_FLAG ON) # If not found, download any missing through Conan
find_package(Threads REQUIRED) # =======================================================================
set(CONAN_CMAKE_SILENT_OUTPUT TRUE)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
if (YUZU_CONAN_INSTALLED)
if (IS_MULTI_CONFIG)
include(${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake)
else()
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")
conan_basic_setup()
message(STATUS "Adding conan installed libraries to the search path")
endif()
if (ENABLE_SDL2) macro(yuzu_find_packages)
if (YUZU_USE_BUNDLED_SDL2) set(options FORCE_REQUIRED)
# Detect toolchain and platform cmake_parse_arguments(FN "${options}" "" "" ${ARGN})
# Cmake has a *serious* lack of 2D array or associative array...
# Capitalization matters here. We need the naming to match the generated paths from Conan
set(REQUIRED_LIBS
# Cmake Pkg Prefix Version Conan Pkg
"Boost 1.71 boost/1.72.0"
"Catch2 2.11 catch2/2.11.0"
"fmt 6.2 fmt/6.2.0"
"OpenSSL 1.1 openssl/1.1.1f"
# can't use until https://github.com/bincrafters/community/issues/1173
#"libzip 1.5 libzip/1.5.2@bincrafters/stable"
"lz4 1.8 lz4/1.9.2"
"nlohmann_json 3.7 nlohmann_json/3.7.3"
"opus 1.3 opus/1.3.1"
"ZLIB 1.2 zlib/1.2.11"
"zstd 1.4 zstd/1.4.4"
)
foreach(PACKAGE ${REQUIRED_LIBS})
string(REGEX REPLACE "[ \t\r\n]+" ";" PACKAGE_SPLIT ${PACKAGE})
list(GET PACKAGE_SPLIT 0 PACKAGE_PREFIX)
list(GET PACKAGE_SPLIT 1 PACKAGE_VERSION)
list(GET PACKAGE_SPLIT 2 PACKAGE_CONAN)
# This function is called twice, once to check if the packages exist on the system already
# and a second time to check if conan installed them properly. The second check passes in FORCE_REQUIRED
if (NOT ${PACKAGE_PREFIX}_FOUND)
if (FN_FORCE_REQUIRED)
find_package(${PACKAGE_PREFIX} ${PACKAGE_VERSION} REQUIRED)
else()
find_package(${PACKAGE_PREFIX} ${PACKAGE_VERSION})
endif()
endif()
if (NOT ${PACKAGE_PREFIX}_FOUND)
list(APPEND CONAN_REQUIRED_LIBS ${PACKAGE_CONAN})
else()
# Set a legacy findPackage.cmake style PACKAGE_LIBRARIES variable for subprojects that rely on this
set(${PACKAGE_PREFIX}_LIBRARIES "${PACKAGE_PREFIX}::${PACKAGE_PREFIX}")
endif()
endforeach()
unset(FN_FORCE_REQUIRED)
endmacro()
# Attempt to locate any packages that are required and report the missing ones in CONAN_REQUIRED_LIBS
yuzu_find_packages()
# Qt5 requires that we find components, so it doesn't fit our pretty little find package function
if(ENABLE_QT)
# We want to load the generated conan qt config so that we get the QT_ROOT var so that we can use the official
# Qt5Config inside the root folder instead of the conan generated one.
if(EXISTS ${CMAKE_BINARY_DIR}/qtConfig.cmake)
include(${CMAKE_BINARY_DIR}/qtConfig.cmake)
list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}")
list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}")
endif()
# Workaround for an issue where conan tries to build Qt from scratch instead of download prebuilt binaries
set(QT_PREFIX_HINT)
if(YUZU_USE_BUNDLED_QT)
if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64)
set(SDL2_VER "SDL2-2.0.8") set(QT_VER qt-5.12.0-msvc2017_64)
else() else()
message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.")
endif() endif()
if (DEFINED SDL2_VER) if (DEFINED QT_VER)
download_bundled_external("sdl2/" ${SDL2_VER} SDL2_PREFIX) download_bundled_external("qt/" ${QT_VER} QT_PREFIX)
endif() endif()
set(SDL2_FOUND YES) set(QT_PREFIX_HINT HINTS "${QT_PREFIX}")
set(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include" CACHE PATH "Path to SDL2 headers") endif()
set(SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library") find_package(Qt5 5.9 COMPONENTS Widgets OpenGL ${QT_PREFIX_HINT})
set(SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll") if (NOT Qt5_FOUND)
list(APPEND CONAN_REQUIRED_LIBS "qt/5.14.1@bincrafters/stable")
endif()
endif()
# find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the yuzu_find_package
if(ENABLE_SDL2)
if(EXISTS ${CMAKE_BINARY_DIR}/sdl2Config.cmake)
include(${CMAKE_BINARY_DIR}/sdl2Config.cmake)
list(APPEND CMAKE_MODULE_PATH "${CONAN_SDL2_ROOT_RELEASE}")
list(APPEND CMAKE_PREFIX_PATH "${CONAN_SDL2_ROOT_RELEASE}")
endif()
find_package(SDL2)
if (NOT SDL2_FOUND)
# otherwise add this to the list of libraries to install
list(APPEND CONAN_REQUIRED_LIBS "sdl2/2.0.12@bincrafters/stable")
endif()
endif()
add_library(SDL2 INTERFACE) # Install any missing dependencies with conan install
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") if (CONAN_REQUIRED_LIBS)
target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") message(STATUS "Packages ${CONAN_REQUIRED_LIBS} not found!")
# Use Conan to fetch the libraries that aren't found
# Download conan.cmake automatically, you can also just copy the conan.cmake file
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://github.com/conan-io/cmake-conan/raw/v0.15/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
set(CONAN_LIB_OPTIONS
libzip:with_openssl=False
libzip:enable_windows_crypto=False
)
conan_check(VERSION 1.24.0 REQUIRED)
# Add the bincrafters remote
conan_add_remote(NAME bincrafters
URL https://api.bintray.com/conan/bincrafters/public-conan)
# Manually add iconv to fix a dep conflict between qt and sdl2
# We don't need to add it through find_package or anything since the other two can find it just fine
if ("${CONAN_REQUIRED_LIBS}" MATCHES "qt" AND "${CONAN_REQUIRED_LIBS}" MATCHES "sdl")
list(APPEND CONAN_REQUIRED_LIBS "libiconv/1.16")
endif()
if (IS_MULTI_CONFIG)
conan_cmake_run(REQUIRES ${CONAN_REQUIRED_LIBS}
OPTIONS ${CONAN_LIB_OPTIONS}
BUILD missing
CONFIGURATION_TYPES "Release;Debug"
GENERATORS cmake_multi cmake_find_package_multi)
include(${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake)
else() else()
conan_cmake_run(REQUIRES ${CONAN_REQUIRED_LIBS}
OPTIONS ${CONAN_LIB_OPTIONS}
BUILD missing
GENERATORS cmake cmake_find_package_multi)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")
conan_basic_setup()
set(YUZU_CONAN_INSTALLED TRUE CACHE BOOL "If true, the following builds will add conan to the lib search path" FORCE)
# Now that we've installed what we are missing, try to locate them again,
# this time with required, so we bail if its not found.
yuzu_find_packages(FORCE_REQUIRED)
# Due to issues with variable scopes in functions, we need to also find_package(qt5) outside of the function
if(ENABLE_QT)
list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}")
list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}")
find_package(Qt5 5.9 REQUIRED COMPONENTS Widgets OpenGL)
if (YUZU_USE_QT_WEB_ENGINE)
find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets)
endif()
endif()
if(ENABLE_SDL2)
list(APPEND CMAKE_MODULE_PATH "${CONAN_SDL2_ROOT_RELEASE}")
list(APPEND CMAKE_PREFIX_PATH "${CONAN_SDL2_ROOT_RELEASE}")
find_package(SDL2 REQUIRED) find_package(SDL2 REQUIRED)
endif()
endif()
# Reexport some targets that are named differently when using the upstream CmakeConfig vs the generated Conan config
# In order to ALIAS targets to a new name, they first need to be IMPORTED_GLOBAL
# Dynarmic checks for target `boost` and so we want to make sure it can find it through our system instead of using their external
if (TARGET Boost::Boost)
set_target_properties(Boost::Boost PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(Boost::boost ALIAS Boost::Boost)
add_library(boost ALIAS Boost::Boost)
elseif (TARGET Boost::boost)
set_target_properties(Boost::boost PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(boost ALIAS Boost::boost)
endif()
if (NOT TARGET OpenSSL::SSL)
set_target_properties(OpenSSL::OpenSSL PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(OpenSSL::SSL ALIAS OpenSSL::OpenSSL)
endif()
if (NOT TARGET OpenSSL::Crypto)
set_target_properties(OpenSSL::OpenSSL PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(OpenSSL::Crypto ALIAS OpenSSL::OpenSSL)
endif()
if (TARGET sdl2::sdl2)
# imported from the conan generated sdl2Config.cmake
set_target_properties(sdl2::sdl2 PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(SDL2 ALIAS sdl2::sdl2)
elseif(SDL2_FOUND)
# found through the system package manager
# Some installations don't set SDL2_LIBRARIES # Some installations don't set SDL2_LIBRARIES
if("${SDL2_LIBRARIES}" STREQUAL "") if("${SDL2_LIBRARIES}" STREQUAL "")
message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2") message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
@ -168,9 +336,10 @@ if (ENABLE_SDL2)
add_library(SDL2 INTERFACE) add_library(SDL2 INTERFACE)
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}")
endif() endif()
else()
set(SDL2_FOUND NO) # Prefer the -pthread flag on Linux.
endif() set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
# If unicorn isn't found, msvc -> download bundled unicorn; everyone else -> build external # If unicorn isn't found, msvc -> download bundled unicorn; everyone else -> build external
if (YUZU_USE_BUNDLED_UNICORN) if (YUZU_USE_BUNDLED_UNICORN)
@ -212,8 +381,12 @@ if (YUZU_USE_BUNDLED_UNICORN)
find_package(PythonInterp 2.7 REQUIRED) find_package(PythonInterp 2.7 REQUIRED)
if (MINGW) if (MINGW)
# Intentionally call the unicorn makefile directly instead of using make.sh so that we can override the
# UNAME_S makefile variable to MINGW. This way we don't have to hack at the uname binary to build
# Additionally, overriding DO_WINDOWS_EXPORT prevents unicorn from patching the static unicorn.a by using msvc and cmd,
# which are both things we don't have in a mingw cross compiling environment.
add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY} add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY}
COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" /bin/sh make.sh cross-win64 COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar RANLIB=x86_64-w64-mingw32-gcc-ranlib make UNAME_S=MINGW DO_WINDOWS_EXPORT=0
WORKING_DIRECTORY ${UNICORN_PREFIX} WORKING_DIRECTORY ${UNICORN_PREFIX}
) )
else() else()
@ -243,32 +416,6 @@ else()
message(FATAL_ERROR "Could not find or build unicorn which is required.") message(FATAL_ERROR "Could not find or build unicorn which is required.")
endif() endif()
if (ENABLE_QT)
if (YUZU_USE_BUNDLED_QT)
if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64)
set(QT_VER qt-5.12.0-msvc2017_64)
else()
message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.")
endif()
if (DEFINED QT_VER)
download_bundled_external("qt/" ${QT_VER} QT_PREFIX)
endif()
set(QT_PREFIX_HINT HINTS "${QT_PREFIX}")
else()
# Passing an empty HINTS seems to cause default system paths to get ignored in CMake 2.8 so
# make sure to not pass anything if we don't have one.
set(QT_PREFIX_HINT)
endif()
find_package(Qt5 REQUIRED COMPONENTS Widgets OpenGL ${QT_PREFIX_HINT})
if (YUZU_USE_QT_WEB_ENGINE)
find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets ${QT_PREFIX_HINT})
endif ()
endif()
# Platform-specific library requirements # Platform-specific library requirements
# ====================================== # ======================================
@ -299,7 +446,7 @@ find_program(CLANG_FORMAT
PATHS ${PROJECT_BINARY_DIR}/externals) PATHS ${PROJECT_BINARY_DIR}/externals)
# if find_program doesn't find it, try to download from externals # if find_program doesn't find it, try to download from externals
if (NOT CLANG_FORMAT) if (NOT CLANG_FORMAT)
if (WIN32) if (WIN32 AND NOT CMAKE_CROSSCOMPILING)
message(STATUS "Clang format not found! Downloading...") message(STATUS "Clang format not found! Downloading...")
set(CLANG_FORMAT "${PROJECT_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe") set(CLANG_FORMAT "${PROJECT_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe")
file(DOWNLOAD file(DOWNLOAD

View file

@ -1,30 +1,13 @@
# Definitions for all external bundled libraries # Definitions for all external bundled libraries
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/externals/find-modules")
include(DownloadExternals) include(DownloadExternals)
# pkgconfig -- it is used to find shared libraries without cmake modules on linux systems
find_package(PkgConfig)
if (NOT PkgConfig_FOUND)
function(pkg_check_modules)
# STUB
endfunction()
endif()
# Catch # Catch
add_library(catch-single-include INTERFACE) add_library(catch-single-include INTERFACE)
target_include_directories(catch-single-include INTERFACE catch/single_include) target_include_directories(catch-single-include INTERFACE catch/single_include)
# libfmt
pkg_check_modules(FMT IMPORTED_TARGET GLOBAL fmt>=6.2.0)
if (FMT_FOUND)
add_library(fmt::fmt ALIAS PkgConfig::FMT)
else()
message(STATUS "fmt 6.2.0 or newer not found, falling back to externals")
add_subdirectory(fmt)
add_library(fmt::fmt ALIAS fmt)
endif()
# Dynarmic # Dynarmic
if (ARCHITECTURE_x86_64) if (ARCHITECTURE_x86_64)
set(DYNARMIC_TESTS OFF) set(DYNARMIC_TESTS OFF)
@ -43,17 +26,6 @@ add_subdirectory(glad)
# inih # inih
add_subdirectory(inih) add_subdirectory(inih)
# lz4
pkg_check_modules(LIBLZ4 IMPORTED_TARGET GLOBAL liblz4>=1.8.0)
if (LIBLZ4_FOUND)
add_library(lz4_static ALIAS PkgConfig::LIBLZ4)
else()
message(STATUS "liblz4 1.8.0 or newer not found, falling back to externals")
set(LZ4_BUNDLED_MODE ON)
add_subdirectory(lz4/contrib/cmake_unofficial EXCLUDE_FROM_ALL)
target_include_directories(lz4_static INTERFACE ./lz4/lib)
endif()
# mbedtls # mbedtls
add_subdirectory(mbedtls EXCLUDE_FROM_ALL) add_subdirectory(mbedtls EXCLUDE_FROM_ALL)
target_include_directories(mbedtls PUBLIC ./mbedtls/include) target_include_directories(mbedtls PUBLIC ./mbedtls/include)
@ -66,29 +38,9 @@ target_include_directories(microprofile INTERFACE ./microprofile)
add_library(unicorn-headers INTERFACE) add_library(unicorn-headers INTERFACE)
target_include_directories(unicorn-headers INTERFACE ./unicorn/include) target_include_directories(unicorn-headers INTERFACE ./unicorn/include)
# Zstandard
pkg_check_modules(LIBZSTD IMPORTED_TARGET GLOBAL libzstd>=1.3.8)
if (LIBZSTD_FOUND)
add_library(libzstd_static ALIAS PkgConfig::LIBZSTD)
else()
message(STATUS "libzstd 1.3.8 or newer not found, falling back to externals")
add_subdirectory(zstd/build/cmake EXCLUDE_FROM_ALL)
target_include_directories(libzstd_static INTERFACE ./zstd/lib)
endif()
# SoundTouch # SoundTouch
add_subdirectory(soundtouch) add_subdirectory(soundtouch)
# Opus
pkg_check_modules(OPUS IMPORTED_TARGET GLOBAL opus>=1.3.1)
if (OPUS_FOUND)
add_library(opus ALIAS PkgConfig::OPUS)
else()
message(STATUS "opus 1.3.1 or newer not found, falling back to externals")
add_subdirectory(opus)
target_include_directories(opus INTERFACE ./opus/include)
endif()
# Cubeb # Cubeb
if(ENABLE_CUBEB) if(ENABLE_CUBEB)
set(BUILD_TESTS OFF CACHE BOOL "") set(BUILD_TESTS OFF CACHE BOOL "")
@ -106,37 +58,14 @@ if (ENABLE_VULKAN)
add_subdirectory(sirit) add_subdirectory(sirit)
endif() endif()
# zlib
find_package(ZLIB 1.2.11)
if (NOT ZLIB_FOUND)
message(STATUS "zlib 1.2.11 or newer not found, falling back to externals")
add_subdirectory(zlib EXCLUDE_FROM_ALL)
set(ZLIB_LIBRARIES z)
endif()
# libzip # libzip
pkg_check_modules(LIBZIP IMPORTED_TARGET GLOBAL libzip>=1.5.3) find_package(Libzip 1.5)
if (LIBZIP_FOUND) if (NOT LIBZIP_FOUND)
add_library(zip ALIAS PkgConfig::LIBZIP) message(STATUS "libzip 1.5 or newer not found, falling back to externals")
else()
message(STATUS "libzip 1.5.3 or newer not found, falling back to externals")
add_subdirectory(libzip EXCLUDE_FROM_ALL) add_subdirectory(libzip EXCLUDE_FROM_ALL)
endif() endif()
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)
# LibreSSL
find_package(OpenSSL COMPONENTS Crypto SSL)
if (NOT OpenSSL_FOUND)
message(STATUS "OpenSSL not found, falling back to externals")
set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "")
add_subdirectory(libressl EXCLUDE_FROM_ALL)
target_include_directories(ssl INTERFACE ./libressl/include)
target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP)
get_directory_property(OPENSSL_LIBRARIES
DIRECTORY libressl
DEFINITION OPENSSL_LIBS)
endif()
# lurlparser # lurlparser
add_subdirectory(lurlparser EXCLUDE_FROM_ALL) add_subdirectory(lurlparser EXCLUDE_FROM_ALL)
@ -144,9 +73,5 @@ if (ENABLE_WEB_SERVICE)
add_library(httplib INTERFACE) add_library(httplib INTERFACE)
target_include_directories(httplib INTERFACE ./httplib) target_include_directories(httplib INTERFACE ./httplib)
target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT) target_compile_definitions(httplib INTERFACE -DCPPHTTPLIB_OPENSSL_SUPPORT)
target_link_libraries(httplib INTERFACE ${OPENSSL_LIBRARIES}) target_link_libraries(httplib INTERFACE OpenSSL::SSL OpenSSL::Crypto)
# JSON
add_library(json-headers INTERFACE)
target_include_directories(json-headers INTERFACE ./json)
endif() endif()

1
externals/boost vendored

@ -1 +0,0 @@
Subproject commit 5e8300b76a627f3a1ba215304e04ead33b5bc233

1
externals/catch vendored

@ -1 +0,0 @@
Subproject commit 15cf3caaceb21172ea42a24e595a2eb58c3ec960

35
externals/find-modules/FindCatch2.cmake vendored Normal file
View file

@ -0,0 +1,35 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_Catch2 QUIET Catch2)
find_path(Catch2_INCLUDE_DIR
NAMES catch.hpp
PATHS ${PC_Catch2_INCLUDE_DIRS} ${CONAN_CATCH2_ROOT}
PATH_SUFFIXES catch2
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Catch2
FOUND_VAR Catch2_FOUND
REQUIRED_VARS
Catch2_INCLUDE_DIR
VERSION_VAR Catch2_VERSION
)
if(Catch2_FOUND)
set(Catch2_INCLUDE_DIRS ${Catch2_INCLUDE_DIR})
set(Catch2_DEFINITIONS ${PC_Catch2_CFLAGS_OTHER})
endif()
if(Catch2_FOUND AND NOT TARGET Catch2::Catch2)
add_library(Catch2::Catch2 UNKNOWN IMPORTED)
set_target_properties(Catch2::Catch2 PROPERTIES
IMPORTED_LOCATION "${Catch2_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_Catch2_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${Catch2_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
Catch2_INCLUDE_DIR
)

69
externals/find-modules/FindLibzip.cmake vendored Normal file
View file

@ -0,0 +1,69 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_LIBZIP QUIET libzip)
find_path(LIBZIP_INCLUDE_DIR
NAMES zip.h
PATHS ${PC_LIBZIP_INCLUDE_DIRS}
"$ENV{LIB_DIR}/include"
"$ENV{INCLUDE}"
/usr/local/include
/usr/include
)
find_path(LIBZIP_INCLUDE_DIR_ZIPCONF
NAMES zipconf.h
HINTS ${PC_LIBZIP_INCLUDE_DIRS}
"$ENV{LIB_DIR}/include"
"$ENV{LIB_DIR}/lib/libzip/include"
"$ENV{LIB}/lib/libzip/include"
/usr/local/lib/libzip/include
/usr/lib/libzip/include
/usr/local/include
/usr/include
"$ENV{INCLUDE}"
)
find_library(LIBZIP_LIBRARY
NAMES zip
PATHS ${PC_LIBZIP_LIBRARY_DIRS}
"$ENV{LIB_DIR}/lib" "$ENV{LIB}" /usr/local/lib /usr/lib
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libzip
FOUND_VAR LIBZIP_FOUND
REQUIRED_VARS
LIBZIP_LIBRARY
LIBZIP_INCLUDE_DIR
LIBZIP_INCLUDE_DIR_ZIPCONF
)
set(LIBZIP_VERSION 0)
if (LIBZIP_INCLUDE_DIR_ZIPCONF)
FILE(READ "${LIBZIP_INCLUDE_DIR_ZIPCONF}/zipconf.h" _LIBZIP_VERSION_CONTENTS)
if (_LIBZIP_VERSION_CONTENTS)
STRING(REGEX REPLACE ".*#define LIBZIP_VERSION \"([0-9.]+)\".*" "\\1" LIBZIP_VERSION "${_LIBZIP_VERSION_CONTENTS}")
endif()
endif()
set(LIBZIP_VERSION ${LIBZIP_VERSION} CACHE STRING "Version number of libzip")
if(LIBZIP_FOUND)
set(LIBZIP_LIBRARIES ${LIBZIP_LIBRARY})
set(LIBZIP_INCLUDE_DIRS ${LIBZIP_INCLUDE_DIR})
set(LIBZIP_DEFINITIONS ${PC_LIBZIP_CFLAGS_OTHER})
endif()
if(LIBZIP_FOUND AND NOT TARGET libzip::libzip)
add_library(libzip::libzip UNKNOWN IMPORTED)
set_target_properties(libzip::libzip PROPERTIES
IMPORTED_LOCATION "${LIBZIP_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_LIBZIP_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBZIP_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
LIBZIP_INCLUDE_DIR
LIBZIP_LIBRARY
)

43
externals/find-modules/Findfmt.cmake vendored Normal file
View file

@ -0,0 +1,43 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_fmt QUIET fmt)
find_path(fmt_INCLUDE_DIR
NAMES format.h
PATHS ${PC_fmt_INCLUDE_DIRS} ${CONAN_INCLUDE_DIRS_fmt}
PATH_SUFFIXES fmt
)
find_library(fmt_LIBRARY
NAMES fmt
PATHS ${PC_fmt_LIBRARY_DIRS} ${CONAN_LIB_DIRS_fmt}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(fmt
FOUND_VAR fmt_FOUND
REQUIRED_VARS
fmt_LIBRARY
fmt_INCLUDE_DIR
VERSION_VAR fmt_VERSION
)
if(fmt_FOUND)
set(fmt_LIBRARIES ${fmt_LIBRARY})
set(fmt_INCLUDE_DIRS ${fmt_INCLUDE_DIR})
set(fmt_DEFINITIONS ${PC_fmt_CFLAGS_OTHER})
endif()
if(fmt_FOUND AND NOT TARGET fmt::fmt)
add_library(fmt::fmt UNKNOWN IMPORTED)
set_target_properties(fmt::fmt PROPERTIES
IMPORTED_LOCATION "${fmt_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_fmt_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
fmt_INCLUDE_DIR
fmt_LIBRARY
)

54
externals/find-modules/Findlz4.cmake vendored Normal file
View file

@ -0,0 +1,54 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_lz4 QUIET lz4)
find_path(lz4_INCLUDE_DIR
NAMES lz4.h
PATHS ${PC_lz4_INCLUDE_DIRS}
)
find_library(lz4_LIBRARY
NAMES lz4
PATHS ${PC_lz4_LIBRARY_DIRS}
)
if(lz4_INCLUDE_DIR)
file(STRINGS "${lz4_INCLUDE_DIR}/lz4.h" _lz4_version_lines
REGEX "#define[ \t]+LZ4_VERSION_(MAJOR|MINOR|RELEASE)")
string(REGEX REPLACE ".*LZ4_VERSION_MAJOR *\([0-9]*\).*" "\\1" _lz4_version_major "${_lz4_version_lines}")
string(REGEX REPLACE ".*LZ4_VERSION_MINOR *\([0-9]*\).*" "\\1" _lz4_version_minor "${_lz4_version_lines}")
string(REGEX REPLACE ".*LZ4_VERSION_RELEASE *\([0-9]*\).*" "\\1" _lz4_version_release "${_lz4_version_lines}")
set(lz4_VERSION "${_lz4_version_major}.${_lz4_version_minor}.${_lz4_version_release}")
unset(_lz4_version_major)
unset(_lz4_version_minor)
unset(_lz4_version_release)
unset(_lz4_version_lines)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(lz4
FOUND_VAR lz4_FOUND
REQUIRED_VARS
lz4_LIBRARY
lz4_INCLUDE_DIR
VERSION_VAR lz4_VERSION
)
if(lz4_FOUND)
set(lz4_LIBRARIES ${lz4_LIBRARY})
set(lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})
set(lz4_DEFINITIONS ${PC_lz4_CFLAGS_OTHER})
endif()
if(lz4_FOUND AND NOT TARGET lz4::lz4)
add_library(lz4::lz4 UNKNOWN IMPORTED)
set_target_properties(lz4::lz4 PROPERTIES
IMPORTED_LOCATION "${lz4_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_lz4_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${lz4_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
lz4_INCLUDE_DIR
lz4_LIBRARY
)

View file

@ -0,0 +1,35 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_nlohmann_json QUIET nlohmann_json)
find_path(nlohmann_json_INCLUDE_DIR
NAMES json.hpp
PATHS ${PC_nlohmann_json_INCLUDE_DIRS}
PATH_SUFFIXES nlohmann
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(nlohmann_json
FOUND_VAR nlohmann_json_FOUND
REQUIRED_VARS
nlohmann_json_INCLUDE_DIR
VERSION_VAR nlohmann_json_VERSION
)
if(nlohmann_json_FOUND)
set(nlohmann_json_INCLUDE_DIRS ${nlohmann_json_INCLUDE_DIR})
set(nlohmann_json_DEFINITIONS ${PC_nlohmann_json_CFLAGS_OTHER})
endif()
if(nlohmann_json_FOUND AND NOT TARGET nlohmann_json::nlohmann_json)
add_library(nlohmann_json::nlohmann_json UNKNOWN IMPORTED)
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
IMPORTED_LOCATION "${nlohmann_json_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_nlohmann_json_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
nlohmann_json_INCLUDE_DIR
)

42
externals/find-modules/Findopus.cmake vendored Normal file
View file

@ -0,0 +1,42 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_opus QUIET opus)
find_path(opus_INCLUDE_DIR
NAMES opus.h
PATHS ${PC_opus_INCLUDE_DIRS}
PATH_SUFFIXES opus
)
find_library(opus_LIBRARY
NAMES opus
PATHS ${PC_opus_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(opus
FOUND_VAR opus_FOUND
REQUIRED_VARS
opus_LIBRARY
opus_INCLUDE_DIR
VERSION_VAR opus_VERSION
)
if(opus_FOUND)
set(Opus_LIBRARIES ${opus_LIBRARY})
set(Opus_INCLUDE_DIRS ${opus_INCLUDE_DIR})
set(Opus_DEFINITIONS ${PC_opus_CFLAGS_OTHER})
endif()
if(opus_FOUND AND NOT TARGET Opus::Opus)
add_library(Opus::Opus UNKNOWN IMPORTED)
set_target_properties(Opus::Opus PROPERTIES
IMPORTED_LOCATION "${opus_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_opus_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${opus_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
opus_INCLUDE_DIR
opus_LIBRARY
)

41
externals/find-modules/Findzstd.cmake vendored Normal file
View file

@ -0,0 +1,41 @@
find_package(PkgConfig QUIET)
pkg_check_modules(PC_zstd QUIET libzstd)
find_path(zstd_INCLUDE_DIR
NAMES zstd.h
PATHS ${PC_zstd_INCLUDE_DIRS}
)
find_library(zstd_LIBRARY
NAMES zstd
PATHS ${PC_zstd_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(zstd
FOUND_VAR zstd_FOUND
REQUIRED_VARS
zstd_LIBRARY
zstd_INCLUDE_DIR
VERSION_VAR zstd_VERSION
)
if(zstd_FOUND)
set(zstd_LIBRARIES ${zstd_LIBRARY})
set(zstd_INCLUDE_DIRS ${zstd_INCLUDE_DIR})
set(zstd_DEFINITIONS ${PC_zstd_CFLAGS_OTHER})
endif()
if(zstd_FOUND AND NOT TARGET zstd::zstd)
add_library(zstd::zstd UNKNOWN IMPORTED)
set_target_properties(zstd::zstd PROPERTIES
IMPORTED_LOCATION "${zstd_LIBRARY}"
INTERFACE_COMPILE_OPTIONS "${PC_zstd_CFLAGS_OTHER}"
INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
)
endif()
mark_as_advanced(
zstd_INCLUDE_DIR
zstd_LIBRARY
)

1
externals/fmt vendored

@ -1 +0,0 @@
Subproject commit 9bdd1596cef1b57b9556f8bef32dc4a32322ef3e

View file

@ -1,9 +0,0 @@
JSON for Modern C++
===================
v3.1.2
This is a mirror providing the single required header file.
The original repository can be found at:
https://github.com/nlohmann/json/commit/d2dd27dc3b8472dbaa7d66f83619b3ebcd9185fe

17300
externals/json/json.hpp vendored

File diff suppressed because it is too large Load diff

1
externals/libressl vendored

@ -1 +0,0 @@
Subproject commit 7d01cb01cb1a926ecb4c9c98b107ef3c26f59dfb

1
externals/lz4 vendored

@ -1 +0,0 @@
Subproject commit 4db65c1d99280a757823914efaa96d2e87f41844

View file

@ -1,254 +0,0 @@
cmake_minimum_required(VERSION 3.8)
project(opus)
option(OPUS_STACK_PROTECTOR "Use stack protection" OFF)
option(OPUS_USE_ALLOCA "Use alloca for stack arrays (on non-C99 compilers)" OFF)
option(OPUS_CUSTOM_MODES "Enable non-Opus modes, e.g. 44.1 kHz & 2^n frames" OFF)
option(OPUS_FIXED_POINT "Compile as fixed-point (for machines without a fast enough FPU)" OFF)
option(OPUS_ENABLE_FLOAT_API "Compile with the floating point API (for machines with float library" ON)
include(opus/opus_functions.cmake)
if(OPUS_STACK_PROTECTOR)
if(NOT MSVC) # GC on by default on MSVC
check_and_set_flag(STACK_PROTECTION_STRONG -fstack-protector-strong)
endif()
else()
if(MSVC)
check_and_set_flag(BUFFER_SECURITY_CHECK /GS-)
endif()
endif()
add_library(opus STATIC
# CELT sources
opus/celt/bands.c
opus/celt/celt.c
opus/celt/celt_decoder.c
opus/celt/celt_encoder.c
opus/celt/celt_lpc.c
opus/celt/cwrs.c
opus/celt/entcode.c
opus/celt/entdec.c
opus/celt/entenc.c
opus/celt/kiss_fft.c
opus/celt/laplace.c
opus/celt/mathops.c
opus/celt/mdct.c
opus/celt/modes.c
opus/celt/pitch.c
opus/celt/quant_bands.c
opus/celt/rate.c
opus/celt/vq.c
# SILK sources
opus/silk/A2NLSF.c
opus/silk/CNG.c
opus/silk/HP_variable_cutoff.c
opus/silk/LPC_analysis_filter.c
opus/silk/LPC_fit.c
opus/silk/LPC_inv_pred_gain.c
opus/silk/LP_variable_cutoff.c
opus/silk/NLSF2A.c
opus/silk/NLSF_VQ.c
opus/silk/NLSF_VQ_weights_laroia.c
opus/silk/NLSF_decode.c
opus/silk/NLSF_del_dec_quant.c
opus/silk/NLSF_encode.c
opus/silk/NLSF_stabilize.c
opus/silk/NLSF_unpack.c
opus/silk/NSQ.c
opus/silk/NSQ_del_dec.c
opus/silk/PLC.c
opus/silk/VAD.c
opus/silk/VQ_WMat_EC.c
opus/silk/ana_filt_bank_1.c
opus/silk/biquad_alt.c
opus/silk/bwexpander.c
opus/silk/bwexpander_32.c
opus/silk/check_control_input.c
opus/silk/code_signs.c
opus/silk/control_SNR.c
opus/silk/control_audio_bandwidth.c
opus/silk/control_codec.c
opus/silk/dec_API.c
opus/silk/decode_core.c
opus/silk/decode_frame.c
opus/silk/decode_indices.c
opus/silk/decode_parameters.c
opus/silk/decode_pitch.c
opus/silk/decode_pulses.c
opus/silk/decoder_set_fs.c
opus/silk/enc_API.c
opus/silk/encode_indices.c
opus/silk/encode_pulses.c
opus/silk/gain_quant.c
opus/silk/init_decoder.c
opus/silk/init_encoder.c
opus/silk/inner_prod_aligned.c
opus/silk/interpolate.c
opus/silk/lin2log.c
opus/silk/log2lin.c
opus/silk/pitch_est_tables.c
opus/silk/process_NLSFs.c
opus/silk/quant_LTP_gains.c
opus/silk/resampler.c
opus/silk/resampler_down2.c
opus/silk/resampler_down2_3.c
opus/silk/resampler_private_AR2.c
opus/silk/resampler_private_IIR_FIR.c
opus/silk/resampler_private_down_FIR.c
opus/silk/resampler_private_up2_HQ.c
opus/silk/resampler_rom.c
opus/silk/shell_coder.c
opus/silk/sigm_Q15.c
opus/silk/sort.c
opus/silk/stereo_LR_to_MS.c
opus/silk/stereo_MS_to_LR.c
opus/silk/stereo_decode_pred.c
opus/silk/stereo_encode_pred.c
opus/silk/stereo_find_predictor.c
opus/silk/stereo_quant_pred.c
opus/silk/sum_sqr_shift.c
opus/silk/table_LSF_cos.c
opus/silk/tables_LTP.c
opus/silk/tables_NLSF_CB_NB_MB.c
opus/silk/tables_NLSF_CB_WB.c
opus/silk/tables_gain.c
opus/silk/tables_other.c
opus/silk/tables_pitch_lag.c
opus/silk/tables_pulses_per_block.c
# Opus sources
opus/src/analysis.c
opus/src/mapping_matrix.c
opus/src/mlp.c
opus/src/mlp_data.c
opus/src/opus.c
opus/src/opus_decoder.c
opus/src/opus_encoder.c
opus/src/opus_multistream.c
opus/src/opus_multistream_decoder.c
opus/src/opus_multistream_encoder.c
opus/src/opus_projection_decoder.c
opus/src/opus_projection_encoder.c
opus/src/repacketizer.c
)
if (DEBUG)
target_sources(opus PRIVATE opus/silk/debug.c)
endif()
if (OPUS_FIXED_POINT)
target_sources(opus PRIVATE
opus/silk/fixed/LTP_analysis_filter_FIX.c
opus/silk/fixed/LTP_scale_ctrl_FIX.c
opus/silk/fixed/apply_sine_window_FIX.c
opus/silk/fixed/autocorr_FIX.c
opus/silk/fixed/burg_modified_FIX.c
opus/silk/fixed/corrMatrix_FIX.c
opus/silk/fixed/encode_frame_FIX.c
opus/silk/fixed/find_LPC_FIX.c
opus/silk/fixed/find_LTP_FIX.c
opus/silk/fixed/find_pitch_lags_FIX.c
opus/silk/fixed/find_pred_coefs_FIX.c
opus/silk/fixed/k2a_FIX.c
opus/silk/fixed/k2a_Q16_FIX.c
opus/silk/fixed/noise_shape_analysis_FIX.c
opus/silk/fixed/pitch_analysis_core_FIX.c
opus/silk/fixed/prefilter_FIX.c
opus/silk/fixed/process_gains_FIX.c
opus/silk/fixed/regularize_correlations_FIX.c
opus/silk/fixed/residual_energy16_FIX.c
opus/silk/fixed/residual_energy_FIX.c
opus/silk/fixed/schur64_FIX.c
opus/silk/fixed/schur_FIX.c
opus/silk/fixed/solve_LS_FIX.c
opus/silk/fixed/vector_ops_FIX.c
opus/silk/fixed/warped_autocorrelation_FIX.c
)
else()
target_sources(opus PRIVATE
opus/silk/float/LPC_analysis_filter_FLP.c
opus/silk/float/LPC_inv_pred_gain_FLP.c
opus/silk/float/LTP_analysis_filter_FLP.c
opus/silk/float/LTP_scale_ctrl_FLP.c
opus/silk/float/apply_sine_window_FLP.c
opus/silk/float/autocorrelation_FLP.c
opus/silk/float/burg_modified_FLP.c
opus/silk/float/bwexpander_FLP.c
opus/silk/float/corrMatrix_FLP.c
opus/silk/float/encode_frame_FLP.c
opus/silk/float/energy_FLP.c
opus/silk/float/find_LPC_FLP.c
opus/silk/float/find_LTP_FLP.c
opus/silk/float/find_pitch_lags_FLP.c
opus/silk/float/find_pred_coefs_FLP.c
opus/silk/float/inner_product_FLP.c
opus/silk/float/k2a_FLP.c
opus/silk/float/noise_shape_analysis_FLP.c
opus/silk/float/pitch_analysis_core_FLP.c
opus/silk/float/process_gains_FLP.c
opus/silk/float/regularize_correlations_FLP.c
opus/silk/float/residual_energy_FLP.c
opus/silk/float/scale_copy_vector_FLP.c
opus/silk/float/scale_vector_FLP.c
opus/silk/float/schur_FLP.c
opus/silk/float/sort_FLP.c
opus/silk/float/warped_autocorrelation_FLP.c
opus/silk/float/wrappers_FLP.c
)
endif()
target_compile_definitions(opus PRIVATE OPUS_BUILD ENABLE_HARDENING)
if(NOT MSVC)
if(MINGW)
target_compile_definitions(opus PRIVATE _FORTIFY_SOURCE=0)
else()
target_compile_definitions(opus PRIVATE _FORTIFY_SOURCE=2)
endif()
endif()
# It is strongly recommended to uncomment one of these VAR_ARRAYS: Use C99
# variable-length arrays for stack allocation USE_ALLOCA: Use alloca() for stack
# allocation If none is defined, then the fallback is a non-threadsafe global
# array
if(OPUS_USE_ALLOCA OR MSVC)
target_compile_definitions(opus PRIVATE USE_ALLOCA)
else()
target_compile_definitions(opus PRIVATE VAR_ARRAYS)
endif()
if(OPUS_CUSTOM_MODES)
target_compile_definitions(opus PRIVATE CUSTOM_MODES)
endif()
if(NOT OPUS_ENABLE_FLOAT_API)
target_compile_definitions(opus PRIVATE DISABLE_FLOAT_API)
endif()
target_compile_definitions(opus
PUBLIC
-DOPUS_VERSION="\\"1.3.1\\""
PRIVATE
# Use C99 intrinsics to speed up float-to-int conversion
HAVE_LRINTF
)
if (FIXED_POINT)
target_compile_definitions(opus PRIVATE -DFIXED_POINT=1 -DDISABLE_FLOAT_API)
endif()
target_include_directories(opus
PUBLIC
opus/include
PRIVATE
opus/celt
opus/silk
opus/silk/fixed
opus/silk/float
opus/src
)

1
externals/opus/opus vendored

@ -1 +0,0 @@
Subproject commit ad8fe90db79b7d2a135e3dfd2ed6631b0c5662ab

View file

@ -1,81 +0,0 @@
project(zlib C)
include(CheckTypeSize)
include(CheckFunctionExists)
include(CheckIncludeFile)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(stdint.h HAVE_STDINT_H)
check_include_file(stddef.h HAVE_STDDEF_H)
# Check to see if we have large file support
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
# We add these other definitions here because CheckTypeSize.cmake
# in CMake 2.4.x does not automatically do so and we want
# compatibility with CMake 2.4.x.
if(HAVE_SYS_TYPES_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
endif()
if(HAVE_STDINT_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
endif()
if(HAVE_STDDEF_H)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
endif()
check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1)
endif()
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
# Check for fseeko
check_function_exists(fseeko HAVE_FSEEKO)
if(NOT HAVE_FSEEKO)
add_definitions(-DNO_FSEEKO)
endif()
# Check for unistd.h
check_include_file(unistd.h HAVE_UNISTD_H)
if(HAVE_UNISTD_H)
add_definitions(-DHAVE_UNISTD_H)
endif()
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
endif()
add_library(z STATIC
zlib/adler32.c
zlib/compress.c
zlib/crc32.c
zlib/crc32.h
zlib/deflate.c
zlib/deflate.h
zlib/gzclose.c
zlib/gzguts.h
zlib/gzlib.c
zlib/gzread.c
zlib/gzwrite.c
zlib/inffast.h
zlib/inffixed.h
zlib/inflate.c
zlib/inflate.h
zlib/infback.c
zlib/inftrees.c
zlib/inftrees.h
zlib/inffast.c
zlib/trees.c
zlib/trees.h
zlib/uncompr.c
zlib/zconf.h
zlib/zlib.h
zlib/zutil.c
zlib/zutil.h
)
add_library(ZLIB::ZLIB ALIAS z)
target_include_directories(z
PUBLIC
zlib/
)

1
externals/zlib/zlib vendored

@ -1 +0,0 @@
Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f

1
externals/zstd vendored

@ -1 +0,0 @@
Subproject commit 470344d33e1d52a2ada75d278466da8d4ee2faf6

View file

@ -172,5 +172,5 @@ endif()
create_target_directory_groups(common) create_target_directory_groups(common)
target_link_libraries(common PUBLIC Boost::boost fmt microprofile) target_link_libraries(common PUBLIC Boost::boost fmt::fmt microprofile)
target_link_libraries(common PRIVATE lz4_static libzstd_static) target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd)

View file

@ -606,11 +606,11 @@ endif()
create_target_directory_groups(core) create_target_directory_groups(core)
target_link_libraries(core PUBLIC common PRIVATE audio_core video_core) target_link_libraries(core PUBLIC common PRIVATE audio_core video_core)
target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt json-headers mbedtls opus unicorn) target_link_libraries(core PUBLIC Boost::boost PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls Opus::Opus unicorn)
if (YUZU_ENABLE_BOXCAT) if (YUZU_ENABLE_BOXCAT)
target_compile_definitions(core PRIVATE -DYUZU_ENABLE_BOXCAT) target_compile_definitions(core PRIVATE -DYUZU_ENABLE_BOXCAT)
target_link_libraries(core PRIVATE httplib json-headers zip) target_link_libraries(core PRIVATE httplib nlohmann_json::nlohmann_json zip)
endif() endif()
if (ENABLE_WEB_SERVICE) if (ENABLE_WEB_SERVICE)

View file

@ -4,8 +4,8 @@
#include <fmt/ostream.h> #include <fmt/ostream.h>
#include <httplib.h> #include <httplib.h>
#include <json.hpp>
#include <mbedtls/sha256.h> #include <mbedtls/sha256.h>
#include <nlohmann/json.hpp>
#include "common/hex_util.h" #include "common/hex_util.h"
#include "common/logging/backend.h" #include "common/logging/backend.h"
#include "common/logging/log.h" #include "common/logging/log.h"

View file

@ -4,11 +4,12 @@
#include <ctime> #include <ctime>
#include <fstream> #include <fstream>
#include <iomanip>
#include <fmt/chrono.h> #include <fmt/chrono.h>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ostream.h> #include <fmt/ostream.h>
#include <json.hpp> #include <nlohmann/json.hpp>
#include "common/file_util.h" #include "common/file_util.h"
#include "common/hex_util.h" #include "common/hex_util.h"

View file

@ -8,4 +8,4 @@ add_library(web_service STATIC
) )
create_target_directory_groups(web_service) create_target_directory_groups(web_service)
target_link_libraries(web_service PRIVATE common json-headers httplib lurlparser) target_link_libraries(web_service PRIVATE common nlohmann_json::nlohmann_json httplib lurlparser)

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <json.hpp> #include <nlohmann/json.hpp>
#include "common/detached_tasks.h" #include "common/detached_tasks.h"
#include "common/web_result.h" #include "common/web_result.h"
#include "web_service/telemetry_json.h" #include "web_service/telemetry_json.h"

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <json.hpp> #include <nlohmann/json.hpp>
#include "common/web_result.h" #include "common/web_result.h"
#include "web_service/verify_login.h" #include "web_service/verify_login.h"
#include "web_service/web_backend.h" #include "web_service/web_backend.h"