From 862ca9a8c908bf4bb37f50b05870c0171952fba7 Mon Sep 17 00:00:00 2001 From: Keeyou Date: Thu, 21 Dec 2023 21:03:05 +0800 Subject: [PATCH] crashpad: fix android build --- CMakeLists.txt | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c44bd4096..d59a33ad0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2272,6 +2272,22 @@ if (IOS) set(_CRASHPAD_OS "-ios-simulator") set(_CRASHPAD_ARCH "${CMAKE_SYSTEM_PROCESSOR}") endif() +elseif (ANDROID) + set(_CRASHPAD_OS "-android") + if (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64-v8a") + set(_CRASHPAD_ARCH "arm64") + elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "armeabi-v7a") + set(_CRASHPAD_ARCH "arm") + elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86") + set(_CRASHPAD_ARCH "x86") + elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(_CRASHPAD_ARCH "x64") + elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") + set(_CRASHPAD_ARCH "riscv64") + else() + message(WARNING "crashpad: unsupported android architecture ${CMAKE_SYSTEM_PROCESSOR}") + set(_CRASHPAD_ARCH "${CMAKE_SYSTEM_PROCESSOR}") + endif() elseif (NOT OSX_CROSS_ARCHITECTURES_COUNT) set(_CRASHPAD_ARCH "${CMAKE_SYSTEM_PROCESSOR}") elseif (OSX_CROSS_ARCHITECTURES_COUNT EQUAL 1) @@ -2287,12 +2303,9 @@ elseif (_CRASHPAD_ARCH STREQUAL "i386" OR _CRASHPAD_ARCH STREQUAL "i586" OR _CRA elseif (_CRASHPAD_ARCH STREQUAL "aarch64") set(_CRASHPAD_ARCH "arm64") endif() -if (ANDROID) - set(_CRASHPAD_OS "-android") -endif() set(_CRASHPAD_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/third_party/crashpad/crashpad/out/Default-${_CRASHPAD_ARCH}${_CRASHPAD_OS}") set(_CRASHPAD_BINARY_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/third_party/crashpad/crashpad/out/Binary-${_CRASHPAD_ARCH}${_CRASHPAD_OS}") -if ((${CMAKE_BUILD_TYPE} MATCHES MinSizeRel OR ${CMAKE_BUILD_TYPE} MATCHES Release) AND EXISTS "${_CRASHPAD_PREFIX}/obj/client/libclient.a") +if (UNIX AND (${CMAKE_BUILD_TYPE} MATCHES MinSizeRel OR ${CMAKE_BUILD_TYPE} MATCHES Release) AND EXISTS "${_CRASHPAD_PREFIX}/obj/client/libclient.a") message(STATUS "Compiling with bundled crashpad client library") add_library(crashpad_common STATIC IMPORTED) set_property(TARGET crashpad_common PROPERTY