I’m trying to use the OpenSSL library included with the engine.
I am using 4.25
In my searches I see people saying to add OpenSSl as a dependency to my project’s build file.
I have seen couple different lines to add to the build file, every one of them causes errors - usually about the the function not being in the current context.
AddEngineThirdPartyPrivateStaticDependencies(Target, “OpenSSL”);
is one example - I believe I read some where to try
ExtraModuleNames.AddRange( new string[] { “OpenSSL”} ); - but that came back with OpenSSL not being a c++ module. There is another function out there that I forget, but when I tried it, I got the error again about not being in context.
So far only by adding the folder “E:\UE_4.25\Engine\Source\ThirdParty\OpenSSL\1.1.1\Include\Win64\VS2015” to the visual studio c/c++ directory includes list can I just do a regular "#include “openssl/sha.h”. - but when I compiled it, it failed saying that the file didn't exist. Yet I can right click the include in code and view it, as well as intellisense recognizing the classes and functions.
In the solution explorer, I can see the openssl folder under UE4\Source\ThirdParty\openssl - but none of the different openssl version show up and none of the source code files.
In fact, all the ThirdParty libraries just contain one or more build files, or files with a .tps extension.
My ultimate goal is to get access to sha-256 to generate a hash for comparing local custom maps with a server copy - assumption is that if hash is different, server copy is a newer version and is then downloaded.
So my ultimate question is how do I use Unreal's included OpenSSL library.
My problem is that I kept trying to do things in the target file, not the build file - as mentioned in a comment above by Strom.
To enable OpenSSL in an unreal c++ project (I'm using Visual Studio):
Open up your project build file.
Add OpenSSL to the PublicDependencyModuleNames:
using UnrealBuildTool;
public class MyProject : ModuleRules
{
public MyProject(ReadOnlyTargetRules Target) : base(Target)
{
PublicDependencyModuleNames.AddRange(new string[] {
"PhysicsCore",
"OpenSSL"
});
}
}
Close your solution, right click your unreal project .uproject file and choose "Generate Project Files".
Where you want to use openSSL add at the top of your code file in the includes section or in your header file. (in my case I'm using evp as the docs say for sha256).
#define UI UI_ST
THIRD_PARTY_INCLUDES_START
#include "openssl/evp.h"
THIRD_PARTY_INCLUDES_END
#undef UI