From eb0758f63a6c16b8460f480912853ef3571dc00e Mon Sep 17 00:00:00 2001 From: junbo Date: Mon, 19 Apr 2021 22:38:33 -0700 Subject: [PATCH] [SPEC-6071][Crashpad] Make Crashpad available through 3rdParty system for Windows --- Code/CryEngine/CrySystem/CMakeLists.txt | 1 + Code/Sandbox/Editor/CMakeLists.txt | 1 + Code/Tools/AssetProcessor/CMakeLists.txt | 1 + Code/Tools/CMakeLists.txt | 2 +- Code/Tools/CrashHandler/CMakeLists.txt | 8 ++--- .../Tools/CrashHandler/Support/CMakeLists.txt | 2 +- Code/Tools/CrashHandler/Tools/CMakeLists.txt | 10 ++---- .../Uploader/src/CrashUploader.cpp | 6 ++-- Code/Tools/Standalone/CMakeLists.txt | 1 + Gems/CrashReporting/Code/CMakeLists.txt | 7 ---- cmake/3rdParty/FindCrashpad.cmake | 30 ---------------- .../Windows/BuiltInPackages_windows.cmake | 1 + .../Platform/Windows/Crashpad_windows.cmake | 36 ------------------- .../Windows/cmake_windows_files.cmake | 1 - 14 files changed, 16 insertions(+), 91 deletions(-) delete mode 100644 cmake/3rdParty/FindCrashpad.cmake delete mode 100644 cmake/3rdParty/Platform/Windows/Crashpad_windows.cmake diff --git a/Code/CryEngine/CrySystem/CMakeLists.txt b/Code/CryEngine/CrySystem/CMakeLists.txt index 32ddc4a3a5..d6ea64d129 100644 --- a/Code/CryEngine/CrySystem/CMakeLists.txt +++ b/Code/CryEngine/CrySystem/CMakeLists.txt @@ -60,6 +60,7 @@ ly_add_target( Legacy::CrySystem.XMLBinary Legacy::RemoteConsoleCore AZ::AzFramework + AZ::CrashHandler RUNTIME_DEPENDENCIES Legacy::Cry3DEngine ) diff --git a/Code/Sandbox/Editor/CMakeLists.txt b/Code/Sandbox/Editor/CMakeLists.txt index 726f7ac2c7..4c3ca70128 100644 --- a/Code/Sandbox/Editor/CMakeLists.txt +++ b/Code/Sandbox/Editor/CMakeLists.txt @@ -125,6 +125,7 @@ ly_add_target( Gem::Atom_RPI.Public Gem::Atom_Feature_Common.Static Gem::AtomToolsFramework.Static + AZ::ToolsCrashHandler ${additional_dependencies} PUBLIC 3rdParty::AWSNativeSDK::Core diff --git a/Code/Tools/AssetProcessor/CMakeLists.txt b/Code/Tools/AssetProcessor/CMakeLists.txt index 9eea81b415..4bef5c79d4 100644 --- a/Code/Tools/AssetProcessor/CMakeLists.txt +++ b/Code/Tools/AssetProcessor/CMakeLists.txt @@ -45,6 +45,7 @@ ly_add_target( AZ::AzQtComponents AZ::AzToolsFramework AZ::AssetBuilderSDK + AZ::ToolsCrashHandler ${additional_dependencies} RUNTIME_DEPENDENCIES AZ::AssetBuilder diff --git a/Code/Tools/CMakeLists.txt b/Code/Tools/CMakeLists.txt index 8fa7d3868a..f106034c3c 100644 --- a/Code/Tools/CMakeLists.txt +++ b/Code/Tools/CMakeLists.txt @@ -13,6 +13,7 @@ add_subdirectory(SceneAPI) # Needs to go before AssetProcessor since it provides add_subdirectory(AssetProcessor) add_subdirectory(AWSNativeSDKInit) add_subdirectory(AzTestRunner) +add_subdirectory(CrashHandler) add_subdirectory(CryCommonTools) add_subdirectory(CryXML) add_subdirectory(HLSLCrossCompiler) @@ -21,7 +22,6 @@ add_subdirectory(News) add_subdirectory(PythonBindingsExample) add_subdirectory(RC) add_subdirectory(RemoteConsole) -add_subdirectory(CrashHandler) add_subdirectory(ShaderCacheGen) add_subdirectory(DeltaCataloger) add_subdirectory(SerializeContextTools) diff --git a/Code/Tools/CrashHandler/CMakeLists.txt b/Code/Tools/CrashHandler/CMakeLists.txt index 7c8229b8a4..ec41ef7c9e 100644 --- a/Code/Tools/CrashHandler/CMakeLists.txt +++ b/Code/Tools/CrashHandler/CMakeLists.txt @@ -32,11 +32,11 @@ ly_add_target( PRIVATE ${pal_dir} BUILD_DEPENDENCIES + PUBLIC + AZ::CrashSupport PRIVATE 3rdParty::Crashpad - AZ::AzCore AZ::AzFramework - AZ::CrashSupport ) string(REPLACE "." ";" version_list "${LY_VERSION_STRING}") @@ -67,11 +67,9 @@ ly_add_target( PRIVATE Uploader/include/Uploader BUILD_DEPENDENCIES - PRIVATE - AZ::AzCore - AZ::CrashSupport PUBLIC 3rdParty::Crashpad::Handler + AZ::CrashSupport ) add_subdirectory(Tools) diff --git a/Code/Tools/CrashHandler/Support/CMakeLists.txt b/Code/Tools/CrashHandler/Support/CMakeLists.txt index 2445b50db5..c67be28949 100644 --- a/Code/Tools/CrashHandler/Support/CMakeLists.txt +++ b/Code/Tools/CrashHandler/Support/CMakeLists.txt @@ -19,6 +19,6 @@ ly_add_target( PUBLIC include BUILD_DEPENDENCIES - PRIVATE + PUBLIC AZ::AzCore ) diff --git a/Code/Tools/CrashHandler/Tools/CMakeLists.txt b/Code/Tools/CrashHandler/Tools/CMakeLists.txt index 390ff7b07d..d8e29ccbed 100644 --- a/Code/Tools/CrashHandler/Tools/CMakeLists.txt +++ b/Code/Tools/CrashHandler/Tools/CMakeLists.txt @@ -21,13 +21,13 @@ ly_add_target( tools_crash_handler_files.cmake Platform/${PAL_PLATFORM_NAME}/tools_crash_handler_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake INCLUDE_DIRECTORIES - PRIVATE + PUBLIC . BUILD_DEPENDENCIES + PUBLIC + AZ::CrashHandler PRIVATE 3rdParty::Qt::Core - AZ::CrashHandler - AZ::CrashSupport AZ::AzToolsFramework ) @@ -41,18 +41,14 @@ ly_add_target( Platform/${PAL_PLATFORM_NAME}/tools_crash_uploader_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake INCLUDE_DIRECTORIES PRIVATE - . Uploader BUILD_DEPENDENCIES PRIVATE 3rdParty::Qt::Core 3rdParty::Qt::Gui 3rdParty::Qt::Widgets - 3rdParty::Crashpad - 3rdParty::Crashpad::Handler AZ::CrashUploaderSupport AZ::AzQtComponents - AZ::CrashSupport TARGET_PROPERTIES Qt5_NO_LINK_QTMAIN TRUE ) diff --git a/Code/Tools/CrashHandler/Uploader/src/CrashUploader.cpp b/Code/Tools/CrashHandler/Uploader/src/CrashUploader.cpp index 77c49ad910..57cbfa3369 100644 --- a/Code/Tools/CrashHandler/Uploader/src/CrashUploader.cpp +++ b/Code/Tools/CrashHandler/Uploader/src/CrashUploader.cpp @@ -138,7 +138,7 @@ namespace O3de if (!logFileReader->Open(thisFile)) { #if defined(AZ_PLATFORM_WINDOWS) - LOG(ERROR) << "Failed to open " << base::UTF16ToUTF8(thisFile.BaseName().value()); + LOG(ERROR) << "Failed to open " << base::WideToUTF8(thisFile.BaseName().value()); #else LOG(ERROR) << "Failed to open " << thisFile.BaseName().value(); #endif @@ -149,7 +149,7 @@ namespace O3de if (start_offset < 0) { #if defined(AZ_PLATFORM_WINDOWS) - LOG(ERROR) << "Failed to get offset for " << base::UTF16ToUTF8(thisFile.BaseName().value()); + LOG(ERROR) << "Failed to get offset for " << base::WideToUTF8(thisFile.BaseName().value()); #else LOG(ERROR) << "Failed to get offset for " << thisFile.BaseName().value(); #endif @@ -162,7 +162,7 @@ namespace O3de std::string fileNameKey{ "attachment_" }; #if defined(AZ_PLATFORM_WINDOWS) - fileNameKey += base::UTF16ToUTF8(thisFile.BaseName().value()); + fileNameKey += base::WideToUTF8(thisFile.BaseName().value()); #else fileNameKey += thisFile.BaseName().value(); #endif diff --git a/Code/Tools/Standalone/CMakeLists.txt b/Code/Tools/Standalone/CMakeLists.txt index 6ed97fcac8..9eedd8849b 100644 --- a/Code/Tools/Standalone/CMakeLists.txt +++ b/Code/Tools/Standalone/CMakeLists.txt @@ -36,6 +36,7 @@ ly_add_target( AZ::AzToolsFramework AZ::GridMate AZ::AzQtComponents + AZ::ToolsCrashHandler ${additional_dependencies} COMPILE_DEFINITIONS PRIVATE diff --git a/Gems/CrashReporting/Code/CMakeLists.txt b/Gems/CrashReporting/Code/CMakeLists.txt index dbb78849fb..d52600ea9b 100644 --- a/Gems/CrashReporting/Code/CMakeLists.txt +++ b/Gems/CrashReporting/Code/CMakeLists.txt @@ -30,9 +30,7 @@ ly_add_target( Include BUILD_DEPENDENCIES PRIVATE - AZ::AzCore AZ::CrashHandler - AZ::CrashSupport ) ly_add_target( @@ -46,10 +44,5 @@ ly_add_target( Include BUILD_DEPENDENCIES PRIVATE - #3rdParty::Crashpad - #3rdParty::Crashpad::Handler - AZ::AzCore AZ::CrashUploaderSupport - #AZ::CrashHandler - AZ::CrashSupport ) diff --git a/cmake/3rdParty/FindCrashpad.cmake b/cmake/3rdParty/FindCrashpad.cmake deleted file mode 100644 index 95922cdca9..0000000000 --- a/cmake/3rdParty/FindCrashpad.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -ly_add_external_target( - NAME Crashpad - VERSION "" - 3RDPARTY_ROOT_DIRECTORY ${LY_ROOT_FOLDER}/Tools/Crashpad - INCLUDE_DIRECTORIES - include - include/third_party/mini_chromium/mini_chromium/ -) - -ly_add_external_target( - NAME Handler - PACKAGE Crashpad - VERSION "" - 3RDPARTY_ROOT_DIRECTORY ${LY_ROOT_FOLDER}/Tools/Crashpad - INCLUDE_DIRECTORIES - include - include/third_party/mini_chromium/mini_chromium - include/third_party/getopt -) diff --git a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake index 249cc7f2c2..0b345a7a60 100644 --- a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake +++ b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake @@ -56,3 +56,4 @@ ly_associate_package(PACKAGE_NAME libsamplerate-0.2.1-rev2-windows TARGETS lib ly_associate_package(PACKAGE_NAME OpenMesh-8.1-rev1-windows TARGETS OpenMesh PACKAGE_HASH 1c1df639358526c368e790dfce40c45cbdfcfb1c9a041b9d7054a8949d88ee77) ly_associate_package(PACKAGE_NAME civetweb-1.8-rev1-windows TARGETS civetweb PACKAGE_HASH 36d0e58a59bcdb4dd70493fb1b177aa0354c945b06c30416348fd326cf323dd4) ly_associate_package(PACKAGE_NAME OpenSSL-1.1.1b-rev2-windows TARGETS OpenSSL PACKAGE_HASH 9af1c50343f89146b4053101a7aeb20513319a3fe2f007e356d7ce25f9241040) +ly_associate_package(PACKAGE_NAME Crashpad-0.8.0-windows TARGETS Crashpad PACKAGE_HASH 6a6ae2d1c5bbc2083823c2a8a0a7c01b88ee47261c64e529e14c1f83f3436de2) diff --git a/cmake/3rdParty/Platform/Windows/Crashpad_windows.cmake b/cmake/3rdParty/Platform/Windows/Crashpad_windows.cmake deleted file mode 100644 index ec1ce8db02..0000000000 --- a/cmake/3rdParty/Platform/Windows/Crashpad_windows.cmake +++ /dev/null @@ -1,36 +0,0 @@ -# -# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or -# its licensors. -# -# For complete copyright and license terms please see the LICENSE at the root of this -# distribution (the "License"). All use of this software is governed by the License, -# or, if provided, by the license below or the license accompanying this file. Do not -# remove or modify any license notices. This file is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# - -set(libpath ${BASE_PATH}/bin/windows/vs2019/$,Debug,Release>_x64) - -set(CRASHPAD_LIBS - ${libpath}/base.lib - ${libpath}/crashpad_client.lib - ${libpath}/crashpad_context.lib - ${libpath}/crashpad_util.lib - winhttp - version - powrprof -) - -set(CRASHPAD_INCLUDE_DIRECTORIES - include/compat/win -) - -set(CRASHPAD_HANDLER_LIBS - ${libpath}/crashpad_tool_support.lib - ${libpath}/crashpad_compat.lib - ${libpath}/third_party/getopt.lib - ${libpath}/crashpad_minidump.lib - ${libpath}/crashpad_snapshot.lib - ${libpath}/crashpad_handler.lib - ${libpath}/third_party/zlib.lib -) diff --git a/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake b/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake index 9ae74b7e6a..546cd9811f 100644 --- a/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake +++ b/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake @@ -11,7 +11,6 @@ set(FILES BuiltInPackages_windows.cmake - Crashpad_windows.cmake dyad_windows.cmake FbxSdk_windows.cmake libav_windows.cmake