mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-04 03:01:39 +08:00
breakpad: Enable building the libbreakpad_client library (#4008)
* breakpad: Enable building the libbreakpad_client library That's the library that allows creating and uploading .dmp files when a program crashes. Use the same flags and setup as for libbreakpad, just note that this commit changes the installation folder for headers which was previously incorrect: The libbreakpad headers were installed in include/google_breakpad, but the correct path is include/breakpad/google_breakpad, and client headers go into include/breakpad/client/windows. * [breakpad] Install headers one directory higher * [breakpad] Switch to only build static libraries. Disable libbreakpad_client on non-windows due to additional work required.
This commit is contained in:
parent
cfc7f61b61
commit
961cd9effd
@ -1,6 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(breakpad CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_definitions(
|
||||
-DNOMINMAX
|
||||
-DUNICODE
|
||||
@ -8,21 +11,22 @@ add_definitions(
|
||||
-D_CRT_SECURE_NO_WARNINGS
|
||||
-D_CRT_SECURE_NO_DEPRECATE
|
||||
-D_CRT_NONSTDC_NO_DEPRECATE
|
||||
-D_LIBCPP_VERSION
|
||||
)
|
||||
|
||||
set(CMAKE_DEBUG_POSTFIX d)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "Release" DEFAULT_INSTALL_HEADERS)
|
||||
option(INSTALL_HEADERS "Install header files" ${DEFAULT_INSTALL_HEADERS})
|
||||
|
||||
file(GLOB_RECURSE SOURCES src/processor/*.cc)
|
||||
list(FILTER SOURCES EXCLUDE REGEX
|
||||
# libbreakpad target
|
||||
file(GLOB_RECURSE LIBBREAKPAD_SOURCES src/processor/*.cc)
|
||||
list(FILTER LIBBREAKPAD_SOURCES EXCLUDE REGEX
|
||||
"_unittest|synth_minidump|/tests|/testdata|/linux|/mac|/android|/solaris|microdump_stackwalk|minidump_dump|minidump_stackwalk")
|
||||
|
||||
find_library(LIBDISASM_LIB NAMES libdisasmd libdisasm)
|
||||
|
||||
add_library(libbreakpad ${SOURCES})
|
||||
add_library(libbreakpad ${LIBBREAKPAD_SOURCES})
|
||||
target_link_libraries(libbreakpad PRIVATE ${LIBDISASM_LIB})
|
||||
|
||||
target_include_directories(libbreakpad
|
||||
@ -31,14 +35,58 @@ target_include_directories(libbreakpad
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
install(TARGETS libbreakpad EXPORT unofficial-breakpad-targets
|
||||
set(TARGETS libbreakpad)
|
||||
if(WIN32)
|
||||
# libbreakpad_client target does not currently work on non-windows
|
||||
if(WIN32)
|
||||
file(GLOB_RECURSE LIBBREAKPAD_CLIENT_SOURCES src/client/windows/*.cc src/common/windows/*.cc)
|
||||
include_directories("$ENV{VSINSTALLDIR}/DIA SDK/include")
|
||||
elseif(APPLE)
|
||||
add_definitions(-DHAVE_MACH_O_NLIST_H)
|
||||
file(GLOB_RECURSE LIBBREAKPAD_CLIENT_SOURCES src/client/mac/*.cc src/common/mac/*.cc)
|
||||
else()
|
||||
add_definitions(-DHAVE_A_OUT_H)
|
||||
file(GLOB_RECURSE LIBBREAKPAD_CLIENT_SOURCES src/client/linux/*.cc src/common/linux/*.cc)
|
||||
endif()
|
||||
file(GLOB LIBBREAKPAD_COMMON_SOURCES src/common/*.cc src/common/*.c src/client/*.cc)
|
||||
list(APPEND LIBBREAKPAD_CLIENT_SOURCES ${LIBBREAKPAD_COMMON_SOURCES})
|
||||
list(FILTER LIBBREAKPAD_CLIENT_SOURCES EXCLUDE REGEX "/tests|/unittests|_unittest")
|
||||
if(WIN32)
|
||||
list(FILTER LIBBREAKPAD_CLIENT_SOURCES EXCLUDE REGEX "language.cc|path_helper.cc|stabs_to_module.cc|stabs_reader.cc|minidump_file_writer.cc")
|
||||
endif()
|
||||
|
||||
add_library(libbreakpad_client ${LIBBREAKPAD_CLIENT_SOURCES})
|
||||
target_link_libraries(libbreakpad_client PRIVATE wininet.lib)
|
||||
|
||||
target_include_directories(libbreakpad_client
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
list(APPEND TARGETS libbreakpad_client)
|
||||
endif()
|
||||
|
||||
# installation
|
||||
install(TARGETS ${TARGETS} EXPORT unofficial-breakpad-targets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
if(INSTALL_HEADERS)
|
||||
install(DIRECTORY src/google_breakpad DESTINATION include)
|
||||
if(WIN32)
|
||||
set(HEADER_EXCLUDE_REGEX "/apple|/ios|/linux|/mac|/solaris|/android|/dwarf|/tests|/testdata|/unittests")
|
||||
elseif(APPLE)
|
||||
set(HEADER_EXCLUDE_REGEX "/apple|/ios|/linux|/windows|/solaris|/android|/dwarf|/tests|/testdata|/unittests")
|
||||
else()
|
||||
set(HEADER_EXCLUDE_REGEX "/apple|/ios|/client/linux/data|/client/linux/sender|/windows|/mac|/solaris|/android|/dwarf|/tests|/testdata|/unittests")
|
||||
endif()
|
||||
install(
|
||||
DIRECTORY src/client src/common src/google_breakpad
|
||||
DESTINATION include/
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
REGEX "${HEADER_EXCLUDE_REGEX}" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
|
||||
install(
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: breakpad
|
||||
Version: 2018-07-30
|
||||
Version: 2018-07-30-2
|
||||
Build-Depends: libdisasm
|
||||
Description: a set of client and server components which implement a crash-reporting system.
|
||||
|
@ -1,9 +1,11 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO google/breakpad
|
||||
REF 9fecc95c72549452959431ddc0e4ec4e0cda8689
|
||||
REF 9fecc95c72549452959431ddc0e4ec4e0cda8689
|
||||
SHA512 b579c4f7058cfd86df343e41496c0d4fc0fb1160bf239fab9cfecfd3d60108367f43f1788d744a9d813d585e8a05e06adf90b01d619448a262522a969d8d5054
|
||||
HEAD_REF master
|
||||
)
|
||||
|
@ -34,14 +34,14 @@ function(vcpkg_check_linkage)
|
||||
|
||||
if(_csc_ONLY_STATIC_LIBRARY AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
message(STATUS "Note: ${PORT} only supports static library linkage. Building static library.")
|
||||
set(VCPKG_LIBRARY_LINKAGE static)
|
||||
set(VCPKG_LIBRARY_LINKAGE static PARENT_SCOPE)
|
||||
endif()
|
||||
if(_csc_ONLY_DYNAMIC_LIBRARY AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
message(STATUS "Note: ${PORT} only supports dynamic library linkage. Building dynamic library.")
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL "static")
|
||||
message(FATAL_ERROR "Refusing to build unexpected dynamic library against the static CRT. If this is desired, please configure your triplet to directly request this configuration.")
|
||||
endif()
|
||||
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
||||
set(VCPKG_LIBRARY_LINKAGE dynamic PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
if(_csc_ONLY_DYNAMIC_CRT AND VCPKG_CRT_LINKAGE STREQUAL "static")
|
||||
|
Loading…
Reference in New Issue
Block a user