Skip to content

Commit

Permalink
Add Android support as target platform.
Browse files Browse the repository at this point in the history
  • Loading branch information
KGronek-Pubnub committed Oct 29, 2024
1 parent 9dae7eb commit 8c9c879
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
8 changes: 5 additions & 3 deletions PubnubLibrary.uplugin
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@
"Installed": false,
"SupportedTargetPlatforms": [
"Win64",
"Mac"
"Mac",
"Android"
],
"Modules": [
{
"Name": "PubnubLibrary",
"Type": "Runtime",
"LoadingPhase": "PostEngineInit",
"LoadingPhase": "PreDefault",
"PlatformAllowList": [
"Win64",
"Mac"
"Mac",
"Android"
]
}
]
Expand Down
2 changes: 2 additions & 0 deletions Source/PubnubLibrary/Private/Threads/PubnubFunctionThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "Windows/WindowsPlatformProcess.h"
#elif PLATFORM_MAC
#include "Mac/MacPlatformProcess.h"
#elif PLATFORM_ANDROID
#include "Android/AndroidPlatformProcess.h"
#else
#error "Platform not supported"
#endif
Expand Down
2 changes: 2 additions & 0 deletions Source/PubnubLibrary/Private/Threads/PubnubLoopingThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "Windows/WindowsPlatformProcess.h"
#elif PLATFORM_MAC
#include "Mac/MacPlatformProcess.h"
#elif PLATFORM_ANDROID
#include "Android/AndroidPlatformProcess.h"
#else
#error "Platform not supported"
#endif
Expand Down
2 changes: 1 addition & 1 deletion Source/PubnubLibrary/PubnubLibrary.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public PubnubLibrary(ReadOnlyTargetRules Target) : base(Target)
{
"Core",
"PubNubModule",
"Projects"
"Projects"
}
);

Expand Down
14 changes: 9 additions & 5 deletions Source/ThirdParty/sdk/PubNubModule/PubNubModule.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,38 @@ public PubNubModule(ReadOnlyTargetRules Target) : base(Target)
string PlatformLib = null;
string binary = null;
string BuildLocation = null;

if(Target.Platform == UnrealTargetPlatform.Win64)
{
extention = StaticLink ? "lib" : "dll";
PlatformLib = OpenSsl ? "openssl" : "windows";
binary = $"pubnub.{extention}";
BuildLocation = "Lib/win64";
BuildLocation = "lib/win64";
}
else if(Target.Platform == UnrealTargetPlatform.Mac)
{
extention = StaticLink ? "a" : "dylib";
PlatformLib = OpenSsl ? "openssl" : "posix";
binary = $"libpubnub.{extention}";
BuildLocation = "Lib/MacOS";
BuildLocation = "lib/MacOS";
}
else
else if(Target.Platform == UnrealTargetPlatform.Android)
{
extention = StaticLink ? "a" : "so";
PlatformLib = OpenSsl ? "openssl" : "posix";
binary = $"libpubnub.{extention}";
BuildLocation = "lib/arm64";
}
else
{
System.Console.WriteLine("Error - this target platform is not supported");
}

if (OpenSsl) {
PublicDependencyModuleNames.AddRange(new string[] { "OpenSSL" });
}

var SDKPath = Path.Combine(new string[] { ModuleDirectory, ".." });



PublicAdditionalLibraries.Add(Path.Combine(SDKPath, BuildLocation, binary));
PublicIncludePaths.AddRange(
Expand Down
Binary file added Source/ThirdParty/sdk/lib/arm64/libpubnub.a
Binary file not shown.

0 comments on commit 8c9c879

Please sign in to comment.