mirror of https://github.com/microsoft/vcpkg.git
[crashpad,vcpkg-ci-crashpad] Fixes, Android, test port (#40519)
This commit is contained in:
parent
93e2867805
commit
54e701bb6a
|
|
@ -6,26 +6,42 @@ if(_IMPORT_PREFIX STREQUAL "/")
|
|||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
add_library(crashpad INTERFACE)
|
||||
add_library(crashpad::crashpad ALIAS crashpad)
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(ZLIB)
|
||||
|
||||
set(CRASHPAD_LIBRARIES common client util base)
|
||||
if(NOT TARGET crashpad::crashpad)
|
||||
add_library(crashpad::crashpad INTERFACE IMPORTED)
|
||||
target_include_directories(crashpad::crashpad INTERFACE "${_IMPORT_PREFIX}/include/crashpad")
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(crashpad INTERFACE NOMINMAX)
|
||||
elseif(APPLE)
|
||||
list(APPEND CRASHPAD_LIBRARIES ApplicationServices
|
||||
CoreFoundation Foundation IOKit Security bsm mig_output)
|
||||
set(_libs client common util base)
|
||||
if(APPLE)
|
||||
list(APPEND _libs mig_output)
|
||||
endif()
|
||||
include(SelectLibraryConfigurations)
|
||||
foreach(_lib IN LISTS _libs)
|
||||
find_library(CRASHPAD_${_lib}_LIBRARY_RELEASE NAMES ${_lib} PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
|
||||
find_library(CRASHPAD_${_lib}_LIBRARY_DEBUG NAMES ${_lib} PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
|
||||
select_library_configurations(CRASHPAD_${_lib})
|
||||
target_link_libraries(crashpad::crashpad INTERFACE ${CRASHPAD_${_lib}_LIBRARIES})
|
||||
endforeach()
|
||||
|
||||
if(WIN32)
|
||||
target_compile_definitions(crashpad::crashpad INTERFACE NOMINMAX)
|
||||
elseif(APPLE)
|
||||
foreach(_lib IN ITEMS ApplicationServices CoreFoundation Foundation IOKit Security bsm)
|
||||
find_library(CRASHPAD_${_lib}_LIBRARY NAMES ${_lib})
|
||||
target_link_libraries(crashpad::crashpad INTERFACE ${CRASHPAD_${_lib}_LIBRARY})
|
||||
endforeach()
|
||||
elseif(ANDROID)
|
||||
target_link_libraries(crashpad::crashpad INTERFACE log)
|
||||
endif()
|
||||
|
||||
target_link_libraries(crashpad::crashpad INTERFACE ZLIB::ZLIB)
|
||||
|
||||
if(NOT TARGET crashpad)
|
||||
add_library(crashpad ALIAS crashpad::crashpad)
|
||||
endif()
|
||||
|
||||
unset(_lib)
|
||||
unset(_libs)
|
||||
endif()
|
||||
|
||||
foreach(LIB_NAME ${CRASHPAD_LIBRARIES})
|
||||
find_library(_LIB ${LIB_NAME})
|
||||
target_link_libraries(crashpad INTERFACE ${_LIB})
|
||||
unset(_LIB CACHE)
|
||||
endforeach()
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
target_link_libraries(crashpad INTERFACE ZLIB::ZLIB)
|
||||
|
||||
target_include_directories(crashpad
|
||||
INTERFACE ${_IMPORT_PREFIX}/include/crashpad)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn
|
||||
index 0802be8..dd77285 100644
|
||||
--- a/build/config/BUILD.gn
|
||||
+++ b/build/config/BUILD.gn
|
||||
@@ -425,7 +425,7 @@ toolchain("gcc_like_toolchain") {
|
||||
])
|
||||
|
||||
if (target_cpu == "arm") {
|
||||
- tool_prefix = "arm-linux-androideabi"
|
||||
+ # unused
|
||||
} else if (target_cpu == "arm64") {
|
||||
tool_prefix = "aarch64-linux-android"
|
||||
} else if (target_cpu == "x86") {
|
||||
@@ -446,7 +446,7 @@ toolchain("gcc_like_toolchain") {
|
||||
cxx = ndk_bin_dir + clang_prefix + "-clang++"
|
||||
asm = cxx
|
||||
ld = cxx
|
||||
- ar = ndk_bin_dir + tool_prefix + "-ar"
|
||||
+ ar = ndk_bin_dir + "llvm-ar"
|
||||
} else {
|
||||
cc = "clang"
|
||||
cxx = "clang++"
|
||||
|
|
@ -11,39 +11,26 @@ vcpkg_from_git(
|
|||
vcpkg_find_acquire_program(PYTHON3)
|
||||
vcpkg_replace_string("${SOURCE_PATH}/.gn" "script_executable = \"python3\"" "script_executable = \"${PYTHON3}\"")
|
||||
|
||||
function(checkout_in_path PATH URL REF)
|
||||
if(EXISTS "${PATH}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
vcpkg_from_git(
|
||||
OUT_SOURCE_PATH DEP_SOURCE_PATH
|
||||
URL "${URL}"
|
||||
REF "${REF}"
|
||||
)
|
||||
file(RENAME "${DEP_SOURCE_PATH}" "${PATH}")
|
||||
file(REMOVE_RECURSE "${DEP_SOURCE_PATH}")
|
||||
endfunction()
|
||||
|
||||
# mini_chromium contains the toolchains and build configuration
|
||||
checkout_in_path(
|
||||
"${SOURCE_PATH}/third_party/mini_chromium/mini_chromium"
|
||||
"https://chromium.googlesource.com/chromium/mini_chromium"
|
||||
"dce72d97d1c2e9beb5e206c6a05a702269794ca3"
|
||||
)
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH "${SOURCE_PATH}/third_party/mini_chromium/mini_chromium"
|
||||
PATCHES
|
||||
"fix-std-20.patch"
|
||||
)
|
||||
|
||||
if(VCPKG_TARGET_IS_LINUX)
|
||||
# fetch lss
|
||||
checkout_in_path(
|
||||
"${SOURCE_PATH}/third_party/lss/lss"
|
||||
https://chromium.googlesource.com/linux-syscall-support
|
||||
9719c1e1e676814c456b55f5f070eabad6709d31
|
||||
if(NOT EXISTS "${SOURCE_PATH}/third_party/mini_chromium/mini_chromium/BUILD.gn")
|
||||
vcpkg_from_git(OUT_SOURCE_PATH mini_chromium
|
||||
URL "https://chromium.googlesource.com/chromium/mini_chromium"
|
||||
REF dce72d97d1c2e9beb5e206c6a05a702269794ca3
|
||||
PATCHES
|
||||
fix-std-20.patch
|
||||
ndk-toolchain.diff
|
||||
)
|
||||
file(REMOVE_RECURSE "${SOURCE_PATH}/third_party/mini_chromium/mini_chromium")
|
||||
file(RENAME "${mini_chromium}" "${SOURCE_PATH}/third_party/mini_chromium/mini_chromium")
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${SOURCE_PATH}/third_party/lss/lss/BUILD.gn" AND (VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_LINUX))
|
||||
vcpkg_from_git(OUT_SOURCE_PATH lss
|
||||
URL https://chromium.googlesource.com/linux-syscall-support
|
||||
REF 9719c1e1e676814c456b55f5f070eabad6709d31
|
||||
)
|
||||
file(REMOVE_RECURSE "${SOURCE_PATH}/third_party/lss/lss")
|
||||
file(RENAME "${lss}" "${SOURCE_PATH}/third_party/lss/lss")
|
||||
endif()
|
||||
|
||||
function(replace_gn_dependency INPUT_FILE OUTPUT_FILE LIBRARY_NAMES)
|
||||
|
|
@ -77,10 +64,24 @@ replace_gn_dependency(
|
|||
"z;zlib;zlibd"
|
||||
)
|
||||
|
||||
set(OPTIONS "target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\"")
|
||||
set(OPTIONS_DBG "is_debug=true")
|
||||
set(OPTIONS_REL "")
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
if(VCPKG_TARGET_IS_ANDROID)
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
string(APPEND OPTIONS " target_os=\"android\" android_ndk_root=\"${VCPKG_DETECTED_CMAKE_ANDROID_NDK}\"")
|
||||
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
string(APPEND OPTIONS " target_os=\"linux\"")
|
||||
|
||||
elseif(VCPKG_TARGET_IS_OSX)
|
||||
string(APPEND OPTIONS " target_os=\"mac\"")
|
||||
|
||||
elseif(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
string(APPEND OPTIONS " target_os=\"win\"")
|
||||
|
||||
# Load toolchains
|
||||
vcpkg_cmake_get_vars(cmake_vars_file)
|
||||
include("${cmake_vars_file}")
|
||||
|
|
@ -108,7 +109,7 @@ endif()
|
|||
|
||||
vcpkg_gn_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS " target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\" "
|
||||
OPTIONS "${OPTIONS}"
|
||||
OPTIONS_DEBUG "${OPTIONS_DBG}"
|
||||
OPTIONS_RELEASE "${OPTIONS_REL}"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
{
|
||||
"name": "crashpad",
|
||||
"version-date": "2024-04-11",
|
||||
"port-version": 1,
|
||||
"port-version": 2,
|
||||
"description": [
|
||||
"Crashpad is a crash-reporting system.",
|
||||
"Crashpad is a library for capturing, storing and transmitting postmortem crash reports from a client to an upstream collection server. Crashpad aims to make it possible for clients to capture process state at the time of crash with the best possible fidelity and coverage, with the minimum of fuss."
|
||||
],
|
||||
"homepage": "https://chromium.googlesource.com/crashpad/crashpad/+/master/README.md",
|
||||
"license": "Apache-2.0",
|
||||
"supports": "linux | osx | (windows & !uwp)",
|
||||
"supports": "android | linux | osx | (windows & !uwp)",
|
||||
"dependencies": [
|
||||
"curl",
|
||||
{
|
||||
"name": "curl",
|
||||
"default-features": false,
|
||||
"platform": "linux"
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-get-vars",
|
||||
"host": true
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project")
|
||||
vcpkg_cmake_build()
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
cmake_minimum_required(VERSION 3.29)
|
||||
project(crashpad-test CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
add_executable(main main.cpp)
|
||||
|
||||
find_package(crashpad CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE crashpad::crashpad)
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#include "client/crashpad_client.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
auto *client = new crashpad::CrashpadClient();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "vcpkg-ci-crashpad",
|
||||
"version-string": "ci",
|
||||
"description": "Validates crashpad",
|
||||
"dependencies": [
|
||||
"crashpad",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -2014,7 +2014,7 @@
|
|||
},
|
||||
"crashpad": {
|
||||
"baseline": "2024-04-11",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"crashrpt": {
|
||||
"baseline": "1.4.3",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "a8c3dac7327cb12c8f1885797a7d63ed99b6963c",
|
||||
"version-date": "2024-04-11",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "43c2573b9400b543b26e7c9fbb091bdfefa51b79",
|
||||
"version-date": "2024-04-11",
|
||||
|
|
|
|||
Loading…
Reference in New Issue