[cmake] fix breakpad fetching
Some checks failed
eden-license / license-header (pull_request) Failing after 22s

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2025-09-07 19:39:35 -04:00 committed by lizzie
parent f3ee95b2e3
commit 8153cbe10d
Signed by: Lizzie
GPG key ID: 00287378CADCAB13
8 changed files with 66 additions and 40 deletions

View file

@ -217,7 +217,7 @@ cmake_dependent_option(YUZU_ROOM_STANDALONE "Enable standalone room executable"
cmake_dependent_option(YUZU_CMD "Compile the eden-cli executable" ON "ENABLE_SDL2;NOT ANDROID" OFF)
cmake_dependent_option(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support" OFF "WIN32 OR LINUX" OFF)
cmake_dependent_option(YUZU_CRASH_DUMPS "Compile crash dump (Minidump) support" OFF "WIN32 OR LINUX OR PLATFORM_SUN" OFF)
option(YUZU_DOWNLOAD_TIME_ZONE_DATA "Always download time zone binaries" ON)
set(YUZU_TZDB_PATH "" CACHE STRING "Path to a pre-downloaded timezone database")
@ -768,17 +768,18 @@ if(ENABLE_QT)
set_target_properties(Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "")
endif()
if (YUZU_CRASH_DUMPS)
set(BREAKPAD_VER "breakpad-c89f9dd")
download_bundled_external("breakpad/" ${BREAKPAD_VER} "breakpad-win" BREAKPAD_PREFIX "c89f9dd")
# TODO: test on windows
# if (YUZU_CRASH_DUMPS)
# set(BREAKPAD_VER "breakpad-c89f9dd")
# download_bundled_external("breakpad/" ${BREAKPAD_VER} "breakpad-win" BREAKPAD_PREFIX "c89f9dd")
set(BREAKPAD_CLIENT_INCLUDE_DIR "${BREAKPAD_PREFIX}/include")
set(BREAKPAD_CLIENT_LIBRARY "${BREAKPAD_PREFIX}/lib/libbreakpad_client.lib")
# set(BREAKPAD_CLIENT_INCLUDE_DIR "${BREAKPAD_PREFIX}/include")
# set(BREAKPAD_CLIENT_LIBRARY "${BREAKPAD_PREFIX}/lib/libbreakpad_client.lib")
add_library(libbreakpad_client INTERFACE IMPORTED)
target_link_libraries(libbreakpad_client INTERFACE "${BREAKPAD_CLIENT_LIBRARY}")
target_include_directories(libbreakpad_client INTERFACE "${BREAKPAD_CLIENT_INCLUDE_DIR}")
endif()
# add_library(libbreakpad_client INTERFACE IMPORTED)
# target_link_libraries(libbreakpad_client INTERFACE "${BREAKPAD_CLIENT_LIBRARY}")
# target_include_directories(libbreakpad_client INTERFACE "${BREAKPAD_CLIENT_INCLUDE_DIR}")
# endif()
# Prefer the -pthread flag on Linux.
set(THREADS_PREFER_PTHREAD_FLAG ON)

View file

@ -148,6 +148,7 @@ function(AddJsonPackage)
get_json_element("${object}" git_host git_host "")
get_json_element("${object}" source_subdir source_subdir "")
get_json_element("${object}" bundled bundled "unset")
get_json_element("${object}" download_only download_only "unset")
get_json_element("${object}" find_args find_args "")
get_json_element("${object}" raw_patches patches "")
@ -201,8 +202,18 @@ function(AddJsonPackage)
# system/bundled
if (bundled STREQUAL "unset" AND DEFINED JSON_BUNDLED_PACKAGE)
set(bundled ${JSON_BUNDLED_PACKAGE})
else()
set(bundled OFF)
endif()
# download only
if (download_only STREQUAL "unset" AND DEFINED JSON_DOWNLOAD_ONLY)
set(download_only ${JSON_DOWNLOAD_ONLY})
else()
set(download_only OFF)
endif()
AddPackage(
NAME "${package}"
VERSION "${version}"
@ -220,6 +231,8 @@ function(AddJsonPackage)
GIT_VERSION ${git_version}
GIT_HOST ${git_host}
DOWNLOAD_ONLY ${download_only}
ARTIFACT ${artifact}
TAG ${tag}
)
@ -275,6 +288,8 @@ function(AddPackage)
URL
GIT_URL
DOWNLOAD_ONLY
KEY
BUNDLED_PACKAGE
FIND_PACKAGE_ARGUMENTS

View file

@ -147,8 +147,6 @@ if (UNIX AND NOT APPLE AND NOT TARGET gamemode::headers)
endif()
# Breakpad
# TODO(crueter): Breakpad needs additional fetches
# https://github.com/google/breakpad/blob/main/DEPS
# https://github.com/microsoft/vcpkg/blob/master/ports/breakpad/CMakeLists.txt
if (YUZU_CRASH_DUMPS AND NOT TARGET libbreakpad_client)
set(BREAKPAD_WIN32_DEFINES
@ -160,14 +158,8 @@ if (YUZU_CRASH_DUMPS AND NOT TARGET libbreakpad_client)
_CRT_NONSTDC_NO_DEPRECATE
)
# TODO
AddPackage(
NAME breakpad
URL "google/breakpad"
SHA f80f288803
HASH 4a87ee88cea99bd633d52a5b00135a649f1475e3b65db325a6df9c804ab82b054ad7e62419b35f6e22cc5dfbbb569214041d7ad5d10fab10106e700bb5050e1d
DOWNLOAD_ONLY YES
)
# TODO(crueter): Can probably put all this cmake crap into the CI repo itself
AddJsonPackage(breakpad)
# libbreakpad
add_library(libbreakpad STATIC)
@ -210,7 +202,10 @@ if (YUZU_CRASH_DUMPS AND NOT TARGET libbreakpad_client)
list(APPEND LIBBREAKPAD_CLIENT_SOURCES ${LIBBREAKPAD_COMMON_SOURCES})
list(FILTER LIBBREAKPAD_CLIENT_SOURCES EXCLUDE REGEX "/sender|/tests|/unittests|/testcases|_unittest|_test")
target_sources(libbreakpad_client PRIVATE ${LIBBREAKPAD_CLIENT_SOURCES})
target_include_directories(libbreakpad_client PRIVATE ${breakpad_SOURCE_DIR}/src)
target_include_directories(libbreakpad_client PUBLIC ${breakpad_SOURCE_DIR}/src)
# thank you Google, very cool
target_include_directories(libbreakpad_client PUBLIC ${breakpad_SOURCE_DIR}/src/src)
if (WIN32)
target_link_libraries(libbreakpad_client PRIVATE wininet.lib)

View file

@ -70,5 +70,14 @@
"sha": "73f3cbb237",
"hash": "c08c03063938339d61392b687562909c1a92615b6ef39ec8df19ea472aa6b6478e70d7d5e33d4a27b5d23f7806daf57fe1bacb8124c8a945c918c7663a9e8532",
"find_args": "CONFIG"
},
"breakpad": {
"repo": "scripts/breakpad",
"git_host": "git.crueter.xyz",
"tag": "f80f288803",
"hash": "227aeb765ea4b1f723305d4465931ce94e1c91448a938fc89f0fb06dd470c28d3b85e4ca47898735ef4a90bbeb53210e3cf39a61d592adbe99b3b9c2dfa0753c",
"artifact": "breakpad.tar.zst",
"bundled": true,
"download_only": true
}
}

View file

@ -244,6 +244,7 @@ if (YUZU_CRASH_DUMPS)
breakpad.h
)
target_link_libraries(yuzu PRIVATE libbreakpad_client)
target_compile_definitions(yuzu PRIVATE YUZU_CRASH_DUMPS)
endif()
if (CXX_CLANG)

View file

@ -5,19 +5,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
#include <ranges>
#if defined(_WIN32)
#include <client/windows/handler/exception_handler.h>
#elif defined(__linux__)
#include <client/linux/handler/exception_handler.h>
#elif defined(__sun__)
#include <client/solaris/handler/exception_handler.h>
#else
#error Minidump creation not supported on this platform
#endif
#include "common/fs/fs_paths.h"
#include "common/fs/path_util.h"
#include "yuzu/breakpad.h"
@ -54,7 +42,7 @@ static void PruneDumpDirectory(const std::filesystem::path& dump_path) {
}
}
#ifdef __linux__
#if defined(__linux__) || defined(__sun__)
[[noreturn]] bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context,
bool succeeded) {
// Prevent time- and space-consuming core dumps from being generated, as we have

View file

@ -3,8 +3,23 @@
#pragma once
#if defined(_WIN32)
#include <client/windows/handler/exception_handler.h>
#elif defined(__linux__)
#include <client/linux/handler/exception_handler.h>
#elif defined(__sun__)
#include <client/solaris/handler/exception_handler.h>
#else
#error Minidump creation not supported on this platform
#endif
namespace Breakpad {
void InstallCrashHandler();
#if defined(__linux__) || defined(__sun__)
[[noreturn]] bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
void* context,
bool succeeded);
#endif
}

View file

@ -256,7 +256,9 @@ static void RemoveTitlebarFilter() {
#endif
#ifdef YUZU_CRASH_DUMPS
#include "yuzu/breakpad.h"
# define __STDC_FORMAT_MACROS
# include "inttypes.h"
# include "yuzu/breakpad.h"
#endif
using namespace Common::Literals;
@ -4230,18 +4232,18 @@ void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_vie
std::string GMainWindow::CreateTASFramesString(
std::array<size_t, InputCommon::TasInput::PLAYER_NUMBER> frames) const {
std::string string = "";
std::string frame_string = "";
size_t maxPlayerIndex = 0;
for (size_t i = 0; i < frames.size(); i++) {
if (frames[i] != 0) {
if (maxPlayerIndex != 0)
string += ", ";
frame_string += ", ";
while (maxPlayerIndex++ != i)
string += "0, ";
string += std::to_string(frames[i]);
frame_string += "0, ";
frame_string += std::to_string(frames[i]);
}
}
return string;
return frame_string;
}
QString GMainWindow::GetTasStateDescription() const {