diff --git a/ports/breakpad/CMakeLists.txt b/ports/breakpad/CMakeLists.txt index f4c19cb8cc..01c949251e 100644 --- a/ports/breakpad/CMakeLists.txt +++ b/ports/breakpad/CMakeLists.txt @@ -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(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 + $ + $ + ) + 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( diff --git a/ports/breakpad/CONTROL b/ports/breakpad/CONTROL index 40569eeebc..190d488751 100644 --- a/ports/breakpad/CONTROL +++ b/ports/breakpad/CONTROL @@ -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. diff --git a/ports/breakpad/portfile.cmake b/ports/breakpad/portfile.cmake index de3a148f94..b5f2959fea 100644 --- a/ports/breakpad/portfile.cmake +++ b/ports/breakpad/portfile.cmake @@ -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 ) diff --git a/scripts/cmake/vcpkg_check_linkage.cmake b/scripts/cmake/vcpkg_check_linkage.cmake index 022e2b8602..101adc4fd5 100644 --- a/scripts/cmake/vcpkg_check_linkage.cmake +++ b/scripts/cmake/vcpkg_check_linkage.cmake @@ -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")