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

View File

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

View File

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