From 7311ddd52d5ee7a3d1ca0c8ce35c0f4cb308e459 Mon Sep 17 00:00:00 2001 From: Mateusz Dahlke <39696234+Xavrax@users.noreply.github.com> Date: Tue, 30 Jan 2024 14:18:42 +0100 Subject: [PATCH] fix building process for Unreal Enigne (#176) --- README.md | 10 +++++++++- unreal/PubNubModule/PubNubModule.Build.cs | 11 ++++++++--- unreal/README.md | 3 ++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b2b9f208..f631d39e 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,18 @@ Our repository can be build via two different approaches: You can build repository using CMake using our [CMakeLists.txt file](CMakeLists.txt). +- Unix: ```sh mkdir build && cd build cmake .. -[n]make +make +``` + +- Windows (MSVS tools required): +```sh +mkdir build && cd build +cmake .. -G "NMake Makefiles" +nmake ``` There are several options to be selected via switches (using GUI) or by using command line. diff --git a/unreal/PubNubModule/PubNubModule.Build.cs b/unreal/PubNubModule/PubNubModule.Build.cs index 8001b9ce..3399de48 100644 --- a/unreal/PubNubModule/PubNubModule.Build.cs +++ b/unreal/PubNubModule/PubNubModule.Build.cs @@ -7,6 +7,7 @@ public class PubNubModule : ModuleRules { private bool OpenSsl = false; private bool StaticLink = false; + private string BuildLocation = ""; public PubNubModule(ReadOnlyTargetRules Target) : base(Target) { @@ -31,11 +32,15 @@ public PubNubModule(ReadOnlyTargetRules Target) : base(Target) PublicDependencyModuleNames.AddRange(new string[] { "OpenSSL" }); } - - PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, $"libpubnub.{extention}")); + var path = Path.Combine(new string[] { ModuleDirectory, "..", ".." }); +#if PLATFORM_WINDOWS + var binary = pubnub.{extention}; +#else + var binary = libpubnub.{extention}; +#endif + PublicAdditionalLibraries.Add(Path.Combine(path, BuildLocation, binary)); PublicIncludePaths.AddRange( new string[] { - path, Path.Combine(path, "core"), Path.Combine(path, "lib"), Path.Combine(path, includeLib) diff --git a/unreal/README.md b/unreal/README.md index 9169f0cf..8819ca40 100644 --- a/unreal/README.md +++ b/unreal/README.md @@ -18,13 +18,14 @@ C-core offers some customization flags (e.g. shared library or using openssl). Y cmake . -DSHARED=ON -DOPENSSL=ON -DOPENSSL_ROOT_DIR={unreal engine location}/Engine/Source/ThirdParty/openssl/1.1.1/ ``` -3. Adjust `PubNubModule/PubNubModule.Build.cs` with selected options by changing `OpenSsl`, `StaticLink` and `LibPath` with the same values you used for compilation. +3. Adjust `PubNubModule/PubNubModule.Build.cs` with selected options by changing `OpenSsl`, `StaticLink` and `BuildLocation` with the same values you used for compilation. For example: ```csharp private bool OpenSsl = true; private bool StaticLink = false; + private string BuildLocation = "build/"; ``` 4. Finally, import the module into your project as follows: