From 2fd4975adbb124bf2f109c41b66a3d0e95f8a0a3 Mon Sep 17 00:00:00 2001 From: Mateusz Dahlke <39696234+Xavrax@users.noreply.github.com> Date: Thu, 28 Sep 2023 09:20:28 +0200 Subject: [PATCH] unreal integration (#163) Co-authored-by: Mateusz Dahlke Co-authored-by: Mateusz Wiktor <39187473+techwritermat@users.noreply.github.com> --- .pubnub.yml | 21 ++-- CHANGELOG.md | 6 + README.md | 2 + core/pubnub_version_internal.h | 2 +- unreal/PubNubModule/Private/PubNubModule.cpp | 6 + unreal/PubNubModule/PubNubModule.Build.cs | 55 ++++++++++ unreal/PubNubModule/Public/PubNub.h | 3 + unreal/PubNubModule/Public/PubNubModule.h | 6 + unreal/README.md | 109 +++++++++++++++++++ unreal/pubnub_core.hpp | 58 ++++++++++ 10 files changed, 259 insertions(+), 9 deletions(-) create mode 100644 unreal/PubNubModule/Private/PubNubModule.cpp create mode 100644 unreal/PubNubModule/PubNubModule.Build.cs create mode 100644 unreal/PubNubModule/Public/PubNub.h create mode 100644 unreal/PubNubModule/Public/PubNubModule.h create mode 100644 unreal/README.md create mode 100644 unreal/pubnub_core.hpp diff --git a/.pubnub.yml b/.pubnub.yml index c22d1808..8b1cc9a5 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,8 +1,13 @@ name: c-core schema: 1 -version: "4.3.0" +version: "4.4.0" scm: github.com/pubnub/c-core changelog: + - date: 2023-09-28 + version: v4.4.0 + changes: + - type: feature + text: "Provide module files to integrate SDK with Unreal Enigne." - date: 2023-07-24 version: v4.3.0 changes: @@ -727,7 +732,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.3.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.4.0 requires: - name: "miniz" @@ -793,7 +798,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.3.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.4.0 requires: - name: "miniz" @@ -859,7 +864,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.3.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.4.0 requires: - name: "miniz" @@ -921,7 +926,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.3.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.4.0 requires: - name: "miniz" @@ -982,7 +987,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.3.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.4.0 requires: - name: "miniz" @@ -1038,7 +1043,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.3.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.4.0 requires: - name: "miniz" @@ -1091,7 +1096,7 @@ sdks: distribution-type: source code distribution-repository: GitHub release package-name: C-Core - location: https://github.com/pubnub/c-core/releases/tag/v4.3.0 + location: https://github.com/pubnub/c-core/releases/tag/v4.4.0 requires: - name: "miniz" diff --git a/CHANGELOG.md b/CHANGELOG.md index bf02b3d8..95cacecb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v4.4.0 +September 28 2023 + +#### Added +- Provide module files to integrate SDK with Unreal Enigne. + ## v4.3.0 July 24 2023 diff --git a/README.md b/README.md index 84ed6ff0..29e85a97 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ The directories of the library repository are: - `microchip_harmony` : Modules and project for Microchip MPLAB Harmony +- `unreal` : Unreal Engine integration module + ## Files diff --git a/core/pubnub_version_internal.h b/core/pubnub_version_internal.h index 00937355..40f0e183 100644 --- a/core/pubnub_version_internal.h +++ b/core/pubnub_version_internal.h @@ -3,7 +3,7 @@ #define INC_PUBNUB_VERSION_INTERNAL -#define PUBNUB_SDK_VERSION "4.3.0" +#define PUBNUB_SDK_VERSION "4.4.0" #endif /* !defined INC_PUBNUB_VERSION_INTERNAL */ diff --git a/unreal/PubNubModule/Private/PubNubModule.cpp b/unreal/PubNubModule/Private/PubNubModule.cpp new file mode 100644 index 00000000..e7e4698c --- /dev/null +++ b/unreal/PubNubModule/Private/PubNubModule.cpp @@ -0,0 +1,6 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#include "PubNubModule.h" +#include "Modules/ModuleManager.h" + +IMPLEMENT_MODULE(FDefaultModuleImpl, PubNubModule); diff --git a/unreal/PubNubModule/PubNubModule.Build.cs b/unreal/PubNubModule/PubNubModule.Build.cs new file mode 100644 index 00000000..5b3c01ea --- /dev/null +++ b/unreal/PubNubModule/PubNubModule.Build.cs @@ -0,0 +1,55 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +using System.IO; +using UnrealBuildTool; + + + +public class PubNubModule : ModuleRules +{ + // select desired module type + + // `posix`, `openssl`, `windows` + private readonly string Option = "posix"; + + // `posix`, `windows` + private readonly string Architecture = "posix"; + + // `sync`, `callback` + private readonly string Implementation = "sync"; + + public PubNubModule(ReadOnlyTargetRules Target) : base(Target) + { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); + PrivateDependencyModuleNames.AddRange(new string[] { }); + + if (Option == "openssl") { + PublicDependencyModuleNames.AddRange(new string[] { "OpenSSL" }); + } + + var path = Path.Combine(new string[] { ModuleDirectory, "..", ".." }); + var extention = Architecture == "posix" ? "a" : "lib"; + + PublicAdditionalLibraries.Add(Path.Combine(path, Option, $"pubnub_{Implementation}.{extention}")); + PublicIncludePaths.AddRange( + new string[] { + path, + Path.Combine(path, "core"), + Path.Combine(path, "lib"), + Path.Combine(path, Option) + } + ); + + PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public")); + + // Uncomment if you are using Slate UI + // PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); + + // Uncomment if you are using online features + // PrivateDependencyModuleNames.Add("OnlineSubsystem"); + + // To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true + } +} diff --git a/unreal/PubNubModule/Public/PubNub.h b/unreal/PubNubModule/Public/PubNub.h new file mode 100644 index 00000000..17e3b0ac --- /dev/null +++ b/unreal/PubNubModule/Public/PubNub.h @@ -0,0 +1,3 @@ +THIRD_PARTY_INCLUDES_START +#include "../../ThirdParty/c-core/unreal/pubnub_core.hpp" +THIRD_PARTY_INCLUDES_END diff --git a/unreal/PubNubModule/Public/PubNubModule.h b/unreal/PubNubModule/Public/PubNubModule.h new file mode 100644 index 00000000..677c8e25 --- /dev/null +++ b/unreal/PubNubModule/Public/PubNubModule.h @@ -0,0 +1,6 @@ +// Copyright Epic Games, Inc. All Rights Reserved. + +#pragma once + +#include "CoreMinimal.h" + diff --git a/unreal/README.md b/unreal/README.md new file mode 100644 index 00000000..21dc586a --- /dev/null +++ b/unreal/README.md @@ -0,0 +1,109 @@ +# Unreal Engine integration + +Our C-core SDK can be used together with [Unreal Engine](https://www.unrealengine.com/en-US). It's **not** a fully functional plugin yet, but can easily be integrated into your project as a [Unreal Engine Module](https://docs.unrealengine.com/5.3/en-US/unreal-engine-modules/). + +## How to setup PubNub C-Core SDK as a Unreal Engine Module + +1. Clone this repository to the `/Source/` directory. We recommend that you place it inside the `ThirdParty` folder (create it, if necessary). + +2. Compile the [desired option](https://www.pubnub.com/docs/sdks/c-core#hello-world) of the SDK. You can do it in the SDK directory like so: + + - POSIX: + + ```sh + make -C