Skip to content

Commit

Permalink
compile system
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavrax committed Sep 22, 2023
1 parent 4777a9e commit 4350369
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 13 deletions.
35 changes: 28 additions & 7 deletions unreal/PubNubModule/PubNubModule.Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,43 @@
using System.IO;
using UnrealBuildTool;

// select desired module type

// `posix`, `openssl`, `windows`
static string Option = "posix";

// `posix`, `windows`
static string Architecture = "posix";

// `sync`, `callback`
static string Implementation = "sync";


public class PubNubModule : ModuleRules
{
public PubNubModule(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
PublicDependencyModuleNames.AddRange(new string[] { "OpenSSL" });

PrivateDependencyModuleNames.AddRange(new string[] { });

PublicAdditionalLibraries.Add(Path.Combine(new string[] { ModuleDirectory, "..", "..", "posix", "pubnub_sync.a" }));
PrivateIncludePaths.Add(Path.Combine(new string[] { ModuleDirectory, "..", ".." }));
PrivateIncludePaths.Add(Path.Combine(new string[] { ModuleDirectory, "..", "..", "core" }));
PrivateIncludePaths.Add(Path.Combine(new string[] { ModuleDirectory, "..", "..", "lib" }));
PrivateIncludePaths.Add(Path.Combine(new string[] { ModuleDirectory, "..", "..", "posix" }));
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}"));
PrivateIncludePaths.AddRange(
new string[] {
path,
Path.Combine(path, "core"),
Path.Combine(path, "lib"),
Path.Combine(path, Option)
}
);

// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
Expand Down
13 changes: 7 additions & 6 deletions unreal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ It is **not** fully functional plugin but can be easly integrated into your proj
First of all you have to clone this repository inside the `<UnrealProject>/Source/` directory.
We recommend to place it inside the `ThirdParty` one (create it if no present).

After that you have to compile desired option of the SDK. You can simple do it as follow:
After that you have to compile [desired option](https://www.pubnub.com/docs/sdks/c-core#hello-world) of the SDK.
You can simple do it as follow:
```sh
make -C <option> -f <architecture>.mk pubnub_<implementation>.a
```

for example:
For example:

```sh
make -C posix -f posix.mk pubnub_sync.a
make -C openssl -f posix.mk pubnub_sync.a
```

After that you have to adjust `PubNubModule/PubNubModule.Build.cs` with selected options.
Expand All @@ -28,9 +29,9 @@ Just change `option`, `architecture` and `implementation` with the same values y
for example:
```cs
static string option = "posix";
static string architecture = "posix";
static string option = "sync";
static string Option = "posix";
static string Architecture = "posix";
static string Implementation = "sync";
```

In the end you have to import module into your project as follow:
Expand Down

0 comments on commit 4350369

Please sign in to comment.