mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-14 21:37:47 +00:00
[cmake] refactor: CPM over vcpkg (#250)
Completely replaces vcpkg with CPM for all "system" dependencies. Primarily needed for Android and Windows. Also uses my OpenSSL CI for those two platforms. In theory, improves configure and build time by a LOT and makes things much easier to manage Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/250 Reviewed-by: Lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
c36cc0d3ee
commit
3e55dc6352
67 changed files with 584 additions and 10752 deletions
|
@ -170,8 +170,9 @@ android {
|
|||
"-DENABLE_QT=0", // Don't use QT
|
||||
"-DENABLE_SDL2=0", // Don't use SDL
|
||||
"-DENABLE_WEB_SERVICE=1", // Enable web service
|
||||
"-DENABLE_OPENSSL=ON",
|
||||
"-DANDROID_ARM_NEON=true", // cryptopp requires Neon to work
|
||||
"-DYUZU_USE_BUNDLED_VCPKG=ON",
|
||||
"-DYUZU_USE_CPM=ON",
|
||||
"-DYUZU_USE_BUNDLED_FFMPEG=ON",
|
||||
"-DYUZU_ENABLE_LTO=ON",
|
||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
|
||||
|
|
|
@ -23,4 +23,8 @@ if (ARCHITECTURE_arm64)
|
|||
target_link_libraries(yuzu-android PRIVATE adrenotools)
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} yuzu-android)
|
||||
if (ENABLE_OPENSSL OR ENABLE_WEB_SERVICE)
|
||||
target_link_libraries(yuzu-android PRIVATE OpenSSL::SSL cpp-jwt::cpp-jwt)
|
||||
endif()
|
||||
|
||||
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} yuzu-android)
|
||||
|
|
|
@ -16,3 +16,4 @@ kotlin.code.style=official
|
|||
kotlin.parallel.tasks.in.project=true
|
||||
# Android Gradle plugin 8.0.2
|
||||
android.suppressUnsupportedCompileSdk=34
|
||||
android.native.buildOutput=verbose
|
|
@ -261,9 +261,24 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(common PUBLIC Boost::headers fmt::fmt
|
||||
stb::headers Threads::Threads)
|
||||
target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd LLVM::Demangle)
|
||||
if (BOOST_NO_HEADERS)
|
||||
target_link_libraries(common PUBLIC Boost::algorithm Boost::icl Boost::pool)
|
||||
else()
|
||||
target_link_libraries(common PUBLIC Boost::headers)
|
||||
endif()
|
||||
|
||||
if (lz4_ADDED)
|
||||
target_include_directories(common PRIVATE ${lz4_SOURCE_DIR}/lib)
|
||||
endif()
|
||||
|
||||
target_link_libraries(common PUBLIC fmt::fmt stb::headers Threads::Threads)
|
||||
target_link_libraries(common PRIVATE lz4::lz4 LLVM::Demangle)
|
||||
|
||||
if (TARGET libzstd_static)
|
||||
target_link_libraries(common PRIVATE libzstd_static)
|
||||
else()
|
||||
target_link_libraries(common PRIVATE zstd)
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
# For ASharedMemory_create
|
||||
|
|
|
@ -183,18 +183,18 @@ public:
|
|||
FileType type = FileType::BinaryFile,
|
||||
FileShareFlag flag = FileShareFlag::ShareReadOnly);
|
||||
|
||||
#ifdef _WIN32
|
||||
template <typename Path>
|
||||
void Open(const Path& path, FileAccessMode mode, FileType type = FileType::BinaryFile,
|
||||
FileShareFlag flag = FileShareFlag::ShareReadOnly) {
|
||||
using ValueType = typename Path::value_type;
|
||||
if constexpr (IsChar<ValueType>) {
|
||||
Open(ToU8String(path), mode, type, flag);
|
||||
} else {
|
||||
Open(std::filesystem::path{path}, mode, type, flag);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// #ifdef _WIN32
|
||||
// template <typename Path>
|
||||
// void Open(const Path& path, FileAccessMode mode, FileType type = FileType::BinaryFile,
|
||||
// FileShareFlag flag = FileShareFlag::ShareReadOnly) {
|
||||
// using ValueType = typename Path::value_type;
|
||||
// if constexpr (IsChar<ValueType>) {
|
||||
// Open(ToU8String(path), mode, type, flag);
|
||||
// } else {
|
||||
// Open(std::filesystem::path{path}, mode, type, flag);
|
||||
// }
|
||||
// }
|
||||
// #endif
|
||||
|
||||
/// Closes the file if it is opened.
|
||||
void Close();
|
||||
|
|
|
@ -1186,7 +1186,14 @@ endif()
|
|||
|
||||
target_include_directories(core PRIVATE ${OPUS_INCLUDE_DIRS})
|
||||
target_link_libraries(core PUBLIC common PRIVATE audio_core hid_core network video_core nx_tzdb tz)
|
||||
target_link_libraries(core PUBLIC Boost::headers PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls RenderDoc::API)
|
||||
|
||||
if (BOOST_NO_HEADERS)
|
||||
target_link_libraries(core PUBLIC Boost::container Boost::heap Boost::asio Boost::process Boost::crc)
|
||||
else()
|
||||
target_link_libraries(core PUBLIC Boost::headers)
|
||||
endif()
|
||||
|
||||
target_link_libraries(core PRIVATE fmt::fmt nlohmann_json::nlohmann_json mbedtls RenderDoc::API)
|
||||
if (MINGW)
|
||||
target_link_libraries(core PRIVATE ${MSWSOCK_LIBRARY})
|
||||
endif()
|
||||
|
@ -1239,9 +1246,14 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
|
|||
endif()
|
||||
|
||||
if(ENABLE_OPENSSL)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
target_sources(core PRIVATE
|
||||
hle/service/ssl/ssl_backend_openssl.cpp)
|
||||
target_link_libraries(core PRIVATE OpenSSL::SSL)
|
||||
if (ANDROID OR MSVC)
|
||||
link_openssl(core)
|
||||
else()
|
||||
target_link_libraries(core PRIVATE OpenSSL::SSL)
|
||||
endif()
|
||||
elseif (APPLE)
|
||||
target_sources(core PRIVATE
|
||||
hle/service/ssl/ssl_backend_securetransport.cpp)
|
||||
|
|
|
@ -3,9 +3,15 @@
|
|||
|
||||
#include <mutex>
|
||||
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/version.hpp>
|
||||
#if BOOST_VERSION > 108300 && !defined(_WINDOWS) && !defined(ANDROID)
|
||||
|
||||
#if BOOST_VERSION > 108300 && (!defined(_WINDOWS) || defined(YUZU_BOOST_v1)) && (!defined(ANDROID) || defined(YUZU_BOOST_v1))
|
||||
#define USE_BOOST_v1
|
||||
#endif
|
||||
|
||||
#ifdef USE_BOOST_v1
|
||||
#include <boost/process/v1/async_pipe.hpp>
|
||||
#else
|
||||
#include <boost/process/async_pipe.hpp>
|
||||
|
@ -329,7 +335,7 @@ private:
|
|||
|
||||
struct ConnectionState {
|
||||
boost::asio::ip::tcp::socket client_socket;
|
||||
#if BOOST_VERSION > 108300 && !defined(_WINDOWS) && !defined(ANDROID)
|
||||
#ifdef USE_BOOST_v1
|
||||
boost::process::v1::async_pipe signal_pipe;
|
||||
#else
|
||||
boost::process::async_pipe signal_pipe;
|
||||
|
|
|
@ -147,8 +147,6 @@ if (DYNARMIC_USE_BUNDLED_EXTERNALS)
|
|||
set(CMAKE_DISABLE_FIND_PACKAGE_Zycore ON)
|
||||
endif()
|
||||
|
||||
set(CPM_USE_LOCAL_PACKAGES ON)
|
||||
|
||||
find_package(Boost 1.57 REQUIRED)
|
||||
find_package(fmt 9 CONFIG)
|
||||
|
||||
|
|
7
src/dynarmic/externals/CMakeLists.txt
vendored
7
src/dynarmic/externals/CMakeLists.txt
vendored
|
@ -95,6 +95,7 @@ AddPackage(
|
|||
|
||||
# TODO(crueter): maybe it's just Gentoo but zydis system package really sucks
|
||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||
# TODO(crueter): system zycore doesn't work with zydis
|
||||
AddPackage(
|
||||
NAME Zycore
|
||||
REPO "zyantific/zycore-c"
|
||||
|
@ -102,8 +103,8 @@ if ("x86_64" IN_LIST ARCHITECTURE)
|
|||
HASH 15aa399f39713e042c4345bc3175c82f14dca849fde2a21d4f591f62c43e227b70d868d8bb86beb5f4eb68b1d6bd3792cdd638acf89009e787e3d10ee7401924
|
||||
OPTIONS
|
||||
"CMAKE_DISABLE_FIND_PACKAGE_Doxygen ON"
|
||||
# BUNDLED_PACKAGE ${DYNARMIC_USE_BUNDLED_EXTERNALS}
|
||||
EXCLUDE_FROM_ALL ON
|
||||
SYSTEM_PACKAGE OFF
|
||||
)
|
||||
|
||||
AddPackage(
|
||||
|
@ -112,13 +113,13 @@ if ("x86_64" IN_LIST ARCHITECTURE)
|
|||
REPO "zyantific/zydis"
|
||||
SHA c2d2bab025
|
||||
HASH 7b48f213ff7aab2926f8c9c65195959143bebbfb2b9a25051ffd8b8b0f1baf1670d9739781de674577d955925f91ac89376e16b476a03828c84e2fd765d45020
|
||||
FIND_PACKAGE_ARGUMENTS "CONFIG"
|
||||
OPTIONS
|
||||
"ZYDIS_BUILD_TOOLS OFF"
|
||||
"ZYDIS_BUILD_EXAMPLES OFF"
|
||||
"ZYDIS_BUILD_DOXYGEN OFF"
|
||||
"ZYAN_ZYCORE_PATH ${Zycore_SOURCE_DIR}"
|
||||
"ZYAN_SYSTEM_ZYCORE ON"
|
||||
"CMAKE_DISABLE_FIND_PACKAGE_Doxygen ON"
|
||||
# BUNDLED_PACKAGE ${DYNARMIC_USE_BUNDLED_EXTERNALS}
|
||||
EXCLUDE_FROM_ALL ON
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -411,10 +411,16 @@ endif()
|
|||
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||
target_link_libraries(dynarmic
|
||||
PRIVATE
|
||||
Boost::boost
|
||||
fmt::fmt
|
||||
merry::mcl
|
||||
)
|
||||
|
||||
if (BOOST_NO_HEADERS)
|
||||
target_link_libraries(dynarmic PRIVATE Boost::variant Boost::icl Boost::pool)
|
||||
else()
|
||||
target_link_libraries(dynarmic PRIVATE Boost::headers)
|
||||
endif()
|
||||
|
||||
if (DYNARMIC_USE_LLVM)
|
||||
target_include_directories(dynarmic PRIVATE ${LLVM_INCLUDE_DIRS})
|
||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_USE_LLVM=1 ${LLVM_DEFINITIONS})
|
||||
|
|
|
@ -88,7 +88,7 @@ if (("A32" IN_LIST DYNARMIC_FRONTENDS) AND ("A64" IN_LIST DYNARMIC_FRONTENDS))
|
|||
|
||||
create_target_directory_groups(dynarmic_print_info)
|
||||
|
||||
target_link_libraries(dynarmic_print_info PRIVATE dynarmic Boost::boost fmt::fmt merry::mcl)
|
||||
target_link_libraries(dynarmic_print_info PRIVATE dynarmic Boost::headers fmt::fmt merry::mcl)
|
||||
target_include_directories(dynarmic_print_info PRIVATE . ../src)
|
||||
target_compile_options(dynarmic_print_info PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||
target_compile_definitions(dynarmic_print_info PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
|
||||
|
@ -103,7 +103,7 @@ if (("A32" IN_LIST DYNARMIC_FRONTENDS) AND ("A64" IN_LIST DYNARMIC_FRONTENDS))
|
|||
|
||||
create_target_directory_groups(dynarmic_test_generator)
|
||||
|
||||
target_link_libraries(dynarmic_test_generator PRIVATE dynarmic Boost::boost fmt::fmt merry::mcl)
|
||||
target_link_libraries(dynarmic_test_generator PRIVATE dynarmic Boost::headers fmt::fmt merry::mcl)
|
||||
target_include_directories(dynarmic_test_generator PRIVATE . ../src)
|
||||
target_compile_options(dynarmic_test_generator PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||
target_compile_definitions(dynarmic_test_generator PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
|
||||
|
@ -116,7 +116,7 @@ if (("A32" IN_LIST DYNARMIC_FRONTENDS) AND ("A64" IN_LIST DYNARMIC_FRONTENDS))
|
|||
|
||||
create_target_directory_groups(dynarmic_test_reader)
|
||||
|
||||
target_link_libraries(dynarmic_test_reader PRIVATE dynarmic Boost::boost fmt::fmt merry::mcl)
|
||||
target_link_libraries(dynarmic_test_reader PRIVATE dynarmic Boost::headers fmt::fmt merry::mcl)
|
||||
target_include_directories(dynarmic_test_reader PRIVATE . ../src)
|
||||
target_compile_options(dynarmic_test_reader PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||
target_compile_definitions(dynarmic_test_reader PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
|
||||
|
@ -124,7 +124,7 @@ endif()
|
|||
|
||||
create_target_directory_groups(dynarmic_tests)
|
||||
|
||||
target_link_libraries(dynarmic_tests PRIVATE dynarmic Boost::boost Catch2::Catch2WithMain fmt::fmt merry::mcl)
|
||||
target_link_libraries(dynarmic_tests PRIVATE dynarmic Boost::headers Catch2::Catch2WithMain fmt::fmt merry::mcl)
|
||||
target_include_directories(dynarmic_tests PRIVATE . ../src)
|
||||
target_compile_options(dynarmic_tests PRIVATE ${DYNARMIC_CXX_FLAGS})
|
||||
target_compile_definitions(dynarmic_tests PRIVATE FMT_USE_USER_DEFINED_LITERALS=1)
|
||||
|
|
|
@ -19,7 +19,7 @@ add_library(network STATIC
|
|||
|
||||
create_target_directory_groups(network)
|
||||
|
||||
target_link_libraries(network PRIVATE common enet::enet Boost::headers)
|
||||
target_link_libraries(network PRIVATE common enet Boost::headers)
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
target_compile_definitions(network PRIVATE -DENABLE_WEB_SERVICE)
|
||||
target_link_libraries(network PRIVATE web_service)
|
||||
|
|
|
@ -242,13 +242,7 @@ add_library(shader_recompiler STATIC
|
|||
varying_state.h
|
||||
)
|
||||
|
||||
if (YUZU_USE_EXTERNAL_VULKAN_SPIRV_TOOLS)
|
||||
set(SPIRV_TOOLS_LIBRARY SPIRV-Tools-opt)
|
||||
else()
|
||||
set(SPIRV_TOOLS_LIBRARY SPIRV-Tools-opt SPIRV-Tools SPIRV-Tools-link)
|
||||
endif()
|
||||
|
||||
target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit ${SPIRV_TOOLS_LIBRARY})
|
||||
target_link_libraries(shader_recompiler PUBLIC common fmt::fmt sirit SPIRV-Tools-opt SPIRV-Tools SPIRV-Tools-link)
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(shader_recompiler PRIVATE
|
||||
|
|
|
@ -329,19 +329,7 @@ target_link_options(video_core PRIVATE ${FFmpeg_LDFLAGS})
|
|||
add_dependencies(video_core host_shaders)
|
||||
target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE})
|
||||
|
||||
if (VulkanMemoryAllocator_ADDED)
|
||||
target_include_directories(video_core PUBLIC ${VulkanMemoryAllocator_SOURCE_DIR}/include)
|
||||
endif()
|
||||
|
||||
if (VulkanUtilityLibraries_ADDED)
|
||||
target_include_directories(video_core PUBLIC ${VulkanUtilityLibraries_SOURCE_DIR}/include)
|
||||
endif()
|
||||
|
||||
if (VulkanHeaders_ADDED)
|
||||
target_include_directories(video_core PUBLIC ${VulkanHeaders_SOURCE_DIR}/include)
|
||||
endif()
|
||||
|
||||
target_link_libraries(video_core PRIVATE sirit Vulkan::Headers)
|
||||
target_link_libraries(video_core PRIVATE sirit Vulkan::Headers Vulkan::UtilityHeaders GPUOpen::VulkanMemoryAllocator)
|
||||
|
||||
if (ENABLE_NSIGHT_AFTERMATH)
|
||||
if (NOT DEFINED ENV{NSIGHT_AFTERMATH_SDK})
|
||||
|
|
|
@ -14,9 +14,17 @@ add_library(web_service STATIC
|
|||
web_result.h
|
||||
)
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
create_target_directory_groups(web_service)
|
||||
target_include_directories(web_service PUBLIC ${cpp-jwt_SOURCE_DIR}/include)
|
||||
target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann_json httplib::httplib)
|
||||
target_link_libraries(web_service PRIVATE common network nlohmann_json::nlohmann_json httplib::httplib cpp-jwt::cpp-jwt)
|
||||
|
||||
if (ANDROID OR MSVC)
|
||||
link_openssl(web_service)
|
||||
else()
|
||||
target_link_libraries(web_service PRIVATE OpenSSL::SSL)
|
||||
endif()
|
||||
|
||||
if (YUZU_USE_PRECOMPILED_HEADERS)
|
||||
target_precompile_headers(web_service PRIVATE precompiled_headers.h)
|
||||
|
|
|
@ -397,6 +397,7 @@ elseif(WIN32)
|
|||
endif()
|
||||
|
||||
target_link_libraries(yuzu PRIVATE common core input_common frontend_common network video_core)
|
||||
target_link_libraries(yuzu PRIVATE nlohmann_json::nlohmann_json)
|
||||
target_link_libraries(yuzu PRIVATE Boost::headers glad Qt6::Widgets)
|
||||
target_link_libraries(yuzu PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||
|
||||
|
|
3
src/yuzu/externals/CMakeLists.txt
vendored
3
src/yuzu/externals/CMakeLists.txt
vendored
|
@ -20,5 +20,6 @@ AddPackage(
|
|||
REPO "crueter/quazip-qt6"
|
||||
SHA f838774d63
|
||||
HASH 9f629a438699801244a106c8df6d5f8f8d19e80df54f530a89403a10c8c4e37a6e95606bbdd307f23636961e8ce34eb37a2186d589a1f227ac9c8e2c678e326e
|
||||
SYSTEM_PACKAGE ON
|
||||
OPTIONS
|
||||
"QUAZIP_INSTALL OFF"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue