Update windows CMake breakpad code. (#2421)

This commit is contained in:
karliss 2020-09-05 11:25:34 +03:00 committed by GitHub
parent 1adc30794b
commit 1966c76ba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 27 deletions

View File

@ -107,9 +107,11 @@ jobs:
if: contains(matrix.os, 'windows-latest')
shell: cmd
run: |
set ARCH=x64
set CUTTER_DEPS=%CD%\cutter-deps
set PATH=%CD%\cutter-deps\qt\bin;%PATH%
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
call scripts\prepare_breakpad.bat
cd
mkdir build
cd build
@ -121,6 +123,7 @@ jobs:
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON ^
-DCUTTER_PACKAGE_DEPENDENCIES=ON ^
-DCUTTER_ENABLE_DEPENDENCY_DOWNLOADS=ON ^
-DCUTTER_ENABLE_CRASH_REPORTS=ON ^
-DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^
-DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% ^
-G Ninja ^

View File

@ -208,8 +208,7 @@ if(CUTTER_ENABLE_CRASH_REPORTS)
target_link_libraries(Cutter PRIVATE "-framework Breakpad")
else()
find_package(Breakpad REQUIRED)
include_directories(${BREAKPAD_INCLUDE_DIRS})
target_link_libraries(Cutter PRIVATE ${BREAKPAD_LINK_LIBRARIES})
target_link_libraries(Cutter PRIVATE Breakpad::client)
endif()
endif()

View File

@ -1,46 +1,60 @@
# - Find Breakpad
#
# BREAKPAD_FOUND - True if Breakpad has been found.
# BREAKPAD_INCLUDE_DIRS - Breakpad include directory
# BREAKPAD_LIBRARIES - List of libraries when using Breakpad.
# BREAKPAD_LIBRARY_DIRS - Breakpad library directories
# Breakpad_FOUND - True if Breakpad has been found.
# Breakpad_INCLUDE_DIRS - Breakpad include directory
# Breakpad_LIBRARIES - List of libraries when using Breakpad.
set(Breakpad_LIBRARIES_VARS "")
if(WIN32)
find_path(BREAKPAD_INCLUDE_DIRS
find_path(Breakpad_INCLUDE_DIRS
client/windows/handler/exception_handler.h
HINTS
"${CMAKE_CURRENT_SOURCE_DIR}/breakpad/prefix/include/breakpad")
"${CMAKE_CURRENT_SOURCE_DIR}/Breakpad/src/src")
set(BREAKPAD_LIBRARY_NAMES
BREAKPAD_CLIENT
BREAKPAD)
set(Breakpad_LIBRARY_NAMES
exception_handler
crash_generation_client
common
)
set(BREAKPAD_LIBRARIES "")
set(BREAKPAD_LIBRARIES_VARS "")
foreach(libname ${BREAKPAD_LIBRARY_NAMES})
find_library(BREAKPAD_LIBRARY_${libname}
set(Breakpad_LIBRARIES "")
foreach(libname ${Breakpad_LIBRARY_NAMES})
find_library(Breakpad_LIBRARY_${libname}
${libname}
HINTS
"${CMAKE_CURRENT_SOURCE_DIR}/breakpad/prefix/lib")
"${CMAKE_CURRENT_SOURCE_DIR}/Breakpad/src/src/client/windows/Release/lib"
REQUIRED)
list(APPEND BREAKPAD_LIBRARIES ${BREAKPAD_LIBRARY_${libname}})
list(APPEND BREAKPAD_LIBRARIES_VARS "BREAKPAD_LIBRARY_${libname}")
list(APPEND Breakpad_LIBRARIES ${Breakpad_LIBRARY_${libname}})
list(APPEND Breakpad_LIBRARIES_VARS "Breakpad_LIBRARY_${libname}")
endforeach()
set (Breakpad_LINK_LIBRARIES ${Breakpad_LIBRARIES})
set(BREAKPAD_LIBRARY_DIRS "")
set(Breakpad_LIBRARY_DIRS "")
else()
set(BREAKPAD_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH})
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/breakpad/prefix")
set(Breakpad_CMAKE_PREFIX_PATH_TEMP ${CMAKE_PREFIX_PATH})
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Breakpad/prefix")
find_package(PkgConfig REQUIRED)
pkg_search_module(BREAKPAD REQUIRED breakpad-client)
pkg_search_module(Breakpad REQUIRED breakpad-client)
# reset CMAKE_PREFIX_PATH
set(CMAKE_PREFIX_PATH ${BREAKPAD_CMAKE_PREFIX_PATH_TEMP})
mark_as_advanced(BREAKPAD_CMAKE_PREFIX_PATH_TEMP)
set(CMAKE_PREFIX_PATH ${Breakpad_CMAKE_PREFIX_PATH_TEMP})
mark_as_advanced(Breakpad_CMAKE_PREFIX_PATH_TEMP)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(BREAKPAD REQUIRED_VARS BREAKPAD_LIBRARIES BREAKPAD_INCLUDE_DIRS)
# could be simplified in > cmake 3.11 using pkg_search_module IMPORTED_TARGET [GLOBAL] but this would still be required for windows
add_library(Breakpad::client INTERFACE IMPORTED)
set_target_properties(Breakpad::client PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${Breakpad_INCLUDE_DIRS}")
set_target_properties(Breakpad::client PROPERTIES
INTERFACE_LINK_LIBRARIES "${Breakpad_LINK_LIBRARIES}")
mark_as_advanced(BREAKPAD_LIBRARIES_VARS)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Breakpad REQUIRED_VARS Breakpad_LIBRARIES Breakpad_INCLUDE_DIRS ${Breakpad_LIBRARIES_VARS})
mark_as_advanced(Breakpad_LIBRARIES_VARS)