diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b4521cf..2b6b1c96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,13 +33,13 @@ jobs: uses: ./.github/workflows/sdk.yml with: target: Win64-Crashpad - runsOn: windows-latest + runsOn: windows-2019 windows-breakpad-sdk: uses: ./.github/workflows/sdk.yml with: target: Win64-Breakpad - runsOn: windows-latest + runsOn: windows-2019 build: needs: [android-sdk, ios-sdk, macos-sdk, linux-sdk, windows-crashpad-sdk, windows-breakpad-sdk] @@ -190,6 +190,11 @@ jobs: pip3 install -Iv ue4cli==0.0.54 ; ue4 setroot /home/ue4/UnrealEngine ' + - name: Setup C++ runtime + run: docker exec --user root unreal bash -c ' + apt-get update ; + apt-get install -y libc++-dev ' + - name: Download package uses: actions/download-artifact@v3 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index b0957a59..1fbdbc7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Features + +- Switch to using static libs on Windows ([#433](https://github.com/getsentry/sentry-unreal/pull/433)) + ### Dependencies - Bump Java SDK (Android) from v6.32.0 to v6.33.0 ([#432](https://github.com/getsentry/sentry-unreal/pull/432)) diff --git a/README.md b/README.md index 5d52fe41..6a170de9 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The SDK complies with three latest engine versions. - To automatically capture crashes in Windows game builds that were made using engine versions prior to UE 5.2, the [Crash Reporter has to be configured](https://docs.sentry.io/platforms/unreal/setup-crashreport/) first. -- Using UGS binaries requires tagging of files to ensure the crashpad_handler.exe and sentry.dll is present. For inclusion in build graph, you'd want something like this: +- Using UGS binaries requires tagging of files to ensure the crashpad_handler.exe is present. For inclusion in build graph, you'd want something like this: ``` @@ -53,6 +53,8 @@ The SDK complies with three latest engine versions. - Only crash events captured on Android contain the full callstack. Events that were captured manually won't have the native C++ part there. +- On Linux `sudo apt-get install libc++-dev` is required to install the required `Crashpad` dependencies. + ## Development Please see the [contribution guide](./CONTRIBUTING.md). diff --git a/plugin-dev/Source/Sentry/Private/SentryModule.cpp b/plugin-dev/Source/Sentry/Private/SentryModule.cpp index 3e6d5a48..724ad6aa 100644 --- a/plugin-dev/Source/Sentry/Private/SentryModule.cpp +++ b/plugin-dev/Source/Sentry/Private/SentryModule.cpp @@ -29,14 +29,10 @@ void FSentryModule::StartupModule() SentrySettings); } -#if PLATFORM_WINDOWS - const FString SentryLibName = TEXT("sentry.dll"); -#elif PLATFORM_MAC +#if PLATFORM_MAC const FString SentryLibName = TEXT("sentry.dylib"); -#endif + const FString BinariesDirPath = GIsEditor ? FPaths::Combine(GetThirdPartyPath(), TEXT("bin")) : GetBinariesPath(); -#if PLATFORM_WINDOWS || PLATFORM_MAC - const FString BinariesDirPath = GetBinariesPath(); FPlatformProcess::PushDllDirectory(*BinariesDirPath); mDllHandleSentry = FPlatformProcess::GetDllHandle(*FPaths::Combine(BinariesDirPath, SentryLibName)); FPlatformProcess::PopDllDirectory(*BinariesDirPath); @@ -99,6 +95,13 @@ FString FSentryModule::GetBinariesPath() return FPaths::Combine(PluginDir, TEXT("Binaries"), FPlatformProcess::GetBinariesSubdirectory()); } +FString FSentryModule::GetThirdPartyPath() +{ + const FString PluginDir = IPluginManager::Get().FindPlugin(TEXT("Sentry"))->GetBaseDir(); + + return FPaths::Combine(PluginDir, TEXT("Source"), TEXT("ThirdParty"), FPlatformProcess::GetBinariesSubdirectory()); +} + FString FSentryModule::GetPluginVersion() { TSharedPtr plugin = IPluginManager::Get().FindPlugin(TEXT("Sentry")); diff --git a/plugin-dev/Source/Sentry/Public/SentryModule.h b/plugin-dev/Source/Sentry/Public/SentryModule.h index 6a3a0b6a..1449193f 100644 --- a/plugin-dev/Source/Sentry/Public/SentryModule.h +++ b/plugin-dev/Source/Sentry/Public/SentryModule.h @@ -35,9 +35,12 @@ class SENTRY_API FSentryModule : public IModuleInterface /** Gets internal settings object to support runtime configuration changes. */ USentrySettings* GetSettings() const; - /** Gets path to plugin's binaries folder. */ + /** Gets path to plugin's binaries folder for current platform. */ FString GetBinariesPath(); + /** Gets path to plugin's third-party resources folder for current platform. */ + FString GetThirdPartyPath(); + /** Gets plugin's version. */ static FString GetPluginVersion(); diff --git a/plugin-dev/Source/Sentry/Sentry.Build.cs b/plugin-dev/Source/Sentry/Sentry.Build.cs index 4aa9151f..c5084049 100644 --- a/plugin-dev/Source/Sentry/Sentry.Build.cs +++ b/plugin-dev/Source/Sentry/Sentry.Build.cs @@ -98,23 +98,33 @@ public Sentry(ReadOnlyTargetRules Target) : base(Target) PublicIncludePaths.Add(Path.Combine(WindowsThirdPartyPath, "include")); PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private", "Desktop")); - RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "sentry.dll"), Path.Combine(WindowsThirdPartyPath, "bin", "sentry.dll")); - RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "sentry.pdb"), Path.Combine(WindowsThirdPartyPath, "bin", "sentry.pdb")); - - PublicDelayLoadDLLs.Add("sentry.dll"); - PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "sentry.lib")); if (CrashpadExists) { RuntimeDependencies.Add(Path.Combine(PlatformBinariesPath, "crashpad_handler.exe"), Path.Combine(WindowsThirdPartyPath, "bin", "crashpad_handler.exe")); + + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_compat.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_compat.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_snapshot.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_util.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "mini_chromium.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_client.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_zlib.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_getopt.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_tools.lib")); + PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "crashpad_handler_lib.lib")); } else { PublicAdditionalLibraries.Add(Path.Combine(WindowsThirdPartyPath, "lib", "breakpad_client.lib")); } + PublicSystemLibraries.Add("winhttp.lib"); + PublicSystemLibraries.Add("version.lib"); + PublicDefinitions.Add("USE_SENTRY_NATIVE=1"); + PublicDefinitions.Add("SENTRY_BUILD_STATIC=1"); } // Additional routine for Linux diff --git a/scripts/build-win64-breakpad.sh b/scripts/build-win64-breakpad.sh index 88a98da4..71d87eac 100755 --- a/scripts/build-win64-breakpad.sh +++ b/scripts/build-win64-breakpad.sh @@ -6,15 +6,13 @@ export sentryArtifactsDestination=$2 rm -rf "${sentryArtifactsDestination}/"* -cmake -S "${sentryNativeRoot}" -B "${sentryNativeRoot}/build" -D SENTRY_BACKEND=breakpad -D SENTRY_SDK_NAME=sentry.native.unreal +cmake -G "Visual Studio 16 2019" -S "${sentryNativeRoot}" -B "${sentryNativeRoot}/build" -D SENTRY_BACKEND=breakpad -D SENTRY_SDK_NAME=sentry.native.unreal -D SENTRY_BUILD_SHARED_LIBS=OFF cmake --build "${sentryNativeRoot}/build" --target sentry --config RelWithDebInfo --parallel +cmake --install "${sentryNativeRoot}/build" --prefix "${sentryNativeRoot}/install" --config RelWithDebInfo mkdir "${sentryArtifactsDestination}/bin" mkdir "${sentryArtifactsDestination}/include" mkdir "${sentryArtifactsDestination}/lib" -cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.lib ${sentryArtifactsDestination}/lib/sentry.lib -cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.dll ${sentryArtifactsDestination}/bin/sentry.dll -cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.pdb ${sentryArtifactsDestination}/bin/sentry.pdb -cp ${sentryNativeRoot}/build/external/RelWithDebInfo/breakpad_client.lib ${sentryArtifactsDestination}/lib/breakpad_client.lib -cp ${sentryNativeRoot}/include/sentry.h ${sentryArtifactsDestination}/include/sentry.h +cp ${sentryNativeRoot}/install/lib/*.lib ${sentryArtifactsDestination}/lib +cp ${sentryNativeRoot}/install/include/sentry.h ${sentryArtifactsDestination}/include/sentry.h diff --git a/scripts/build-win64-crashpad.sh b/scripts/build-win64-crashpad.sh index 0215d913..0494c688 100755 --- a/scripts/build-win64-crashpad.sh +++ b/scripts/build-win64-crashpad.sh @@ -6,16 +6,15 @@ export sentryArtifactsDestination=$2 rm -rf "${sentryArtifactsDestination}/"* -cmake -S "${sentryNativeRoot}" -B "${sentryNativeRoot}/build" -D SENTRY_BACKEND=crashpad -D SENTRY_SDK_NAME=sentry.native.unreal +cmake -G "Visual Studio 16 2019" -S "${sentryNativeRoot}" -B "${sentryNativeRoot}/build" -D SENTRY_BACKEND=crashpad -D SENTRY_SDK_NAME=sentry.native.unreal -D SENTRY_BUILD_SHARED_LIBS=OFF cmake --build "${sentryNativeRoot}/build" --target sentry --config RelWithDebInfo --parallel -cmake --build "${sentryNativeRoot}/build" --target crashpad_handler --config Release --parallel +cmake --build "${sentryNativeRoot}/build" --target crashpad_handler --config RelWithDebInfo --parallel +cmake --install "${sentryNativeRoot}/build" --prefix "${sentryNativeRoot}/install" --config RelWithDebInfo mkdir "${sentryArtifactsDestination}/bin" mkdir "${sentryArtifactsDestination}/include" mkdir "${sentryArtifactsDestination}/lib" -cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.lib ${sentryArtifactsDestination}/lib/sentry.lib -cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.dll ${sentryArtifactsDestination}/bin/sentry.dll -cp ${sentryNativeRoot}/build/RelWithDebInfo/sentry.pdb ${sentryArtifactsDestination}/bin/sentry.pdb -cp ${sentryNativeRoot}/build/crashpad_build/handler/Release/crashpad_handler.exe ${sentryArtifactsDestination}/bin/crashpad_handler.exe -cp ${sentryNativeRoot}/include/sentry.h ${sentryArtifactsDestination}/include/sentry.h +cp ${sentryNativeRoot}/install/lib/*.lib ${sentryArtifactsDestination}/lib +cp ${sentryNativeRoot}/install/bin/crashpad_handler.exe ${sentryArtifactsDestination}/bin/crashpad_handler.exe +cp ${sentryNativeRoot}/install/include/sentry.h ${sentryArtifactsDestination}/include/sentry.h diff --git a/scripts/packaging/package-github.snapshot b/scripts/packaging/package-github.snapshot index 9b95c510..046b4d2c 100644 --- a/scripts/packaging/package-github.snapshot +++ b/scripts/packaging/package-github.snapshot @@ -331,9 +331,6 @@ Source/ThirdParty/Mac/include/Headers/SentryUser.h Source/ThirdParty/Mac/include/Headers/SentryUserFeedback.h Source/ThirdParty/Win64/ Source/ThirdParty/Win64/Breakpad/ -Source/ThirdParty/Win64/Breakpad/bin/ -Source/ThirdParty/Win64/Breakpad/bin/sentry.dll -Source/ThirdParty/Win64/Breakpad/bin/sentry.pdb Source/ThirdParty/Win64/Breakpad/include/ Source/ThirdParty/Win64/Breakpad/include/sentry.h Source/ThirdParty/Win64/Breakpad/lib/ @@ -342,9 +339,17 @@ Source/ThirdParty/Win64/Breakpad/lib/sentry.lib Source/ThirdParty/Win64/Crashpad/ Source/ThirdParty/Win64/Crashpad/bin/ Source/ThirdParty/Win64/Crashpad/bin/crashpad_handler.exe -Source/ThirdParty/Win64/Crashpad/bin/sentry.dll -Source/ThirdParty/Win64/Crashpad/bin/sentry.pdb Source/ThirdParty/Win64/Crashpad/include/ Source/ThirdParty/Win64/Crashpad/include/sentry.h Source/ThirdParty/Win64/Crashpad/lib/ +Source/ThirdParty/Win64/Crashpad/lib/crashpad_client.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_compat.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_getopt.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_handler_lib.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_minidump.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_snapshot.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_tools.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_util.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_zlib.lib +Source/ThirdParty/Win64/Crashpad/lib/mini_chromium.lib Source/ThirdParty/Win64/Crashpad/lib/sentry.lib diff --git a/scripts/packaging/package-marketplace.snapshot b/scripts/packaging/package-marketplace.snapshot index c1b5ea85..576852e9 100644 --- a/scripts/packaging/package-marketplace.snapshot +++ b/scripts/packaging/package-marketplace.snapshot @@ -328,9 +328,6 @@ Source/ThirdParty/Mac/include/Headers/SentryUser.h Source/ThirdParty/Mac/include/Headers/SentryUserFeedback.h Source/ThirdParty/Win64/ Source/ThirdParty/Win64/Breakpad/ -Source/ThirdParty/Win64/Breakpad/bin/ -Source/ThirdParty/Win64/Breakpad/bin/sentry.dll -Source/ThirdParty/Win64/Breakpad/bin/sentry.pdb Source/ThirdParty/Win64/Breakpad/include/ Source/ThirdParty/Win64/Breakpad/include/sentry.h Source/ThirdParty/Win64/Breakpad/lib/ @@ -338,9 +335,17 @@ Source/ThirdParty/Win64/Breakpad/lib/breakpad_client.lib Source/ThirdParty/Win64/Breakpad/lib/sentry.lib Source/ThirdParty/Win64/Crashpad/ Source/ThirdParty/Win64/Crashpad/bin/ -Source/ThirdParty/Win64/Crashpad/bin/sentry.dll -Source/ThirdParty/Win64/Crashpad/bin/sentry.pdb Source/ThirdParty/Win64/Crashpad/include/ Source/ThirdParty/Win64/Crashpad/include/sentry.h Source/ThirdParty/Win64/Crashpad/lib/ +Source/ThirdParty/Win64/Crashpad/lib/crashpad_client.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_compat.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_getopt.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_handler_lib.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_minidump.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_snapshot.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_tools.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_util.lib +Source/ThirdParty/Win64/Crashpad/lib/crashpad_zlib.lib +Source/ThirdParty/Win64/Crashpad/lib/mini_chromium.lib Source/ThirdParty/Win64/Crashpad/lib/sentry.lib