Browse Source

[cmake] fix breakpad fetching

Signed-off-by: crueter <crueter@eden-emu.dev>
liz-crash-dumps-solaris
crueter 4 months ago
committed by lizzie
parent
commit
782341554e
No known key found for this signature in database GPG Key ID: 287378CADCAB13
  1. 21
      CMakeLists.txt
  2. 15
      CMakeModules/CPMUtil.cmake
  3. 17
      externals/CMakeLists.txt
  4. 9
      externals/cpmfile.json
  5. 1
      src/yuzu/CMakeLists.txt
  6. 14
      src/yuzu/breakpad.cpp
  7. 15
      src/yuzu/breakpad.h
  8. 14
      src/yuzu/main.cpp

21
CMakeLists.txt

@ -253,7 +253,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")
@ -716,17 +716,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)

15
CMakeModules/CPMUtil.cmake

@ -147,6 +147,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 "")
@ -200,8 +201,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
FORCE_BUNDLED_PACKAGE

17
externals/CMakeLists.txt

@ -281,8 +281,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
@ -294,14 +292,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)
@ -344,7 +336,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)

9
externals/cpmfile.json

@ -210,5 +210,14 @@
"key": "steamdeck",
"bundled": true,
"skip_updates": "true"
},
"breakpad": {
"repo": "scripts/breakpad",
"git_host": "git.crueter.xyz",
"tag": "f80f288803",
"hash": "227aeb765ea4b1f723305d4465931ce94e1c91448a938fc89f0fb06dd470c28d3b85e4ca47898735ef4a90bbeb53210e3cf39a61d592adbe99b3b9c2dfa0753c",
"artifact": "breakpad.tar.zst",
"bundled": true,
"download_only": true
}
}

1
src/yuzu/CMakeLists.txt

@ -247,6 +247,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)

14
src/yuzu/breakpad.cpp

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

15
src/yuzu/breakpad.h

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

14
src/yuzu/main.cpp

@ -260,7 +260,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;
@ -4272,18 +4274,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 {

Loading…
Cancel
Save