add breakpad package to cmakelists

This commit is contained in:
qimiko 2024-02-02 02:40:07 -07:00
parent 7891ac605e
commit 91b4ec4469
No known key found for this signature in database
GPG key ID: D2D404DD810FE0E3
2 changed files with 63 additions and 0 deletions

View file

@ -10,6 +10,8 @@ if (GEODE_BUILDING_DOCS)
set(GEODE_DONT_BUILD_TEST_MODS On) set(GEODE_DONT_BUILD_TEST_MODS On)
endif() endif()
option(GEODE_ANDROID_USE_BREAKPAD "Enables the use of the Breakpad library for crash dumps." ON)
# Read version # Read version
file(READ VERSION GEODE_VERSION) file(READ VERSION GEODE_VERSION)
string(STRIP "${GEODE_VERSION}" GEODE_VERSION) string(STRIP "${GEODE_VERSION}" GEODE_VERSION)

View file

@ -125,6 +125,61 @@ if (WIN32)
set(SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/info.rc) set(SOURCES ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/info.rc)
endif() endif()
if (ANDROID AND GEODE_ANDROID_USE_BREAKPAD)
CPMAddPackage(
NAME "Breakpad"
VERSION "2023.06.01"
GIT_REPOSITORY "https://chromium.googlesource.com/breakpad/breakpad.git"
)
if (Breakpad_ADDED)
include(FetchContent)
FetchContent_Declare(lss
GIT_REPOSITORY https://chromium.googlesource.com/linux-syscall-support.git
GIT_TAG v2022.10.12
SOURCE_DIR ${Breakpad_BINARY_DIR}/src/third_party/lss
)
FetchContent_MakeAvailable(lss)
add_library(Breakpad STATIC
${Breakpad_SOURCE_DIR}/src/client/linux/crash_generation/crash_generation_client.cc
${Breakpad_SOURCE_DIR}/src/client/linux/dump_writer_common/thread_info.cc
${Breakpad_SOURCE_DIR}/src/client/linux/dump_writer_common/ucontext_reader.cc
${Breakpad_SOURCE_DIR}/src/client/linux/handler/exception_handler.cc
${Breakpad_SOURCE_DIR}/src/client/linux/handler/minidump_descriptor.cc
${Breakpad_SOURCE_DIR}/src/client/linux/log/log.cc
${Breakpad_SOURCE_DIR}/src/client/linux/microdump_writer/microdump_writer.cc
${Breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/linux_dumper.cc
${Breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/linux_ptrace_dumper.cc
${Breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/minidump_writer.cc
${Breakpad_SOURCE_DIR}/src/client/linux/minidump_writer/pe_file.cc
${Breakpad_SOURCE_DIR}/src/client/minidump_file_writer.cc
${Breakpad_SOURCE_DIR}/src/common/convert_UTF.cc
${Breakpad_SOURCE_DIR}/src/common/md5.cc
${Breakpad_SOURCE_DIR}/src/common/string_conversion.cc
${Breakpad_SOURCE_DIR}/src/common/linux/breakpad_getcontext.S
${Breakpad_SOURCE_DIR}/src/common/linux/elfutils.cc
${Breakpad_SOURCE_DIR}/src/common/linux/file_id.cc
${Breakpad_SOURCE_DIR}/src/common/linux/guid_creator.cc
${Breakpad_SOURCE_DIR}/src/common/linux/linux_libc_support.cc
${Breakpad_SOURCE_DIR}/src/common/linux/memory_mapped_file.cc
${Breakpad_SOURCE_DIR}/src/common/linux/safe_readlink.cc
)
target_include_directories(Breakpad PUBLIC
${Breakpad_SOURCE_DIR}/src/common/android/include/
${Breakpad_SOURCE_DIR}/src/
${Breakpad_SOURCE_DIR}/src/common/android/include/
# add lss headers
${Breakpad_BINARY_DIR}/src/
)
endif()
endif()
add_library(${PROJECT_NAME} SHARED ${SOURCES}) add_library(${PROJECT_NAME} SHARED ${SOURCES})
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
@ -170,6 +225,12 @@ endif()
if (ANDROID) if (ANDROID)
# needed to define some opengl functions # needed to define some opengl functions
target_link_libraries(${PROJECT_NAME} EGL) target_link_libraries(${PROJECT_NAME} EGL)
if (GEODE_ANDROID_USE_BREAKPAD)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DGEODE_USE_BREAKPAD)
enable_language(ASM)
target_link_libraries(${PROJECT_NAME} Breakpad)
endif()
endif() endif()
target_include_directories(${PROJECT_NAME} PRIVATE target_include_directories(${PROJECT_NAME} PRIVATE