Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed build issues (Windows and Linux) #21

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
135c881
Added missing include statements to GameLiftClientObject.cpp
chris-gong Sep 6, 2019
cbc8463
Uploaded dependency dll and lib files
chris-gong Sep 10, 2019
91a54e4
updated aws cpp sdk code (aws header files) to match updated dll/lib …
chris-gong Sep 12, 2019
2f88d13
renamed Time.h to AwsTime.h to fix issue and updated dependency dll/l…
chris-gong Sep 12, 2019
c5568cf
added use_import_export public definition to gameliftclientsdk.build.cs
chris-gong Sep 12, 2019
ad17ce6
removed extra spaces and added dependencies lib/dll files to awscore.…
chris-gong Sep 12, 2019
1dea14c
added checks in awscoremodule for dependencies
chris-gong Sep 13, 2019
a424560
fixed typo
chris-gong Sep 13, 2019
ed28c4a
Added dependency dll and lib files to linux folder
chris-gong Sep 13, 2019
16c1e9d
Rebuilt dependency dll/lib files and replaced old one in windows folder
chris-gong Sep 13, 2019
3ee6226
added checks for linux and windows as well as added linux so files to…
chris-gong Sep 15, 2019
3851eb3
replaced playersession and gamesessionplacementstatus variables with …
chris-gong Sep 24, 2019
539574d
replaced enums with aws toString method and added more useful respons…
chris-gong Sep 24, 2019
58331ac
modified creategamesession method
chris-gong Sep 25, 2019
3ff2668
fixed typos
chris-gong Sep 30, 2019
8bbda5d
upgraded aws sdk libraries/source
chris-gong Oct 2, 2019
0f82bdb
updated client sdk to compile and function successfully on windows wi…
chris-gong Oct 23, 2019
8802527
commented out lines of code giving warnings related to publiclibraryp…
chris-gong Jan 11, 2020
4c52c4f
updated dll/lib files and fix compilation errors for windows only
chris-gong Jan 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion GameLiftClientSDK/GameLiftClientSDK.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.7.157",
"VersionName": "1.7.266",
"FriendlyName": "GameLift Client SDK",
"Description": "GameLift plugin for creating Game Sessions, Player Sessions etc.",
"Category": "YetiTech Studios",
Expand Down
236 changes: 198 additions & 38 deletions GameLiftClientSDK/Source/AWSCore/AWSCore.Build.cs
Original file line number Diff line number Diff line change
@@ -1,57 +1,217 @@
using UnrealBuildTool;
using System.IO;
using System.Diagnostics;

public class AWSCore : ModuleRules
{
public AWSCore(ReadOnlyTargetRules Target ): base(Target)
{
PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private"));
PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public"));
PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public"));

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

// This is required to fix a warning for Unreal Engine 4.21 and later
PrivatePCHHeaderFile = "Private/AWSCorePrivatePCH.h";
// This is required to fix a warning for Unreal Engine 4.21 and later
PrivatePCHHeaderFile = "Private/AWSCorePrivatePCH.h";

string BaseDirectory = System.IO.Path.GetFullPath(System.IO.Path.Combine(ModuleDirectory, "..", ".."));
string ThirdPartyPath = System.IO.Path.Combine(BaseDirectory, "ThirdParty", "GameLiftClientSDK", Target.Platform.ToString());
string BinariesDirectory = System.IO.Path.Combine(BaseDirectory, "Binaries", Target.Platform.ToString());
bool bIsThirdPartyPathValid = System.IO.Directory.Exists(ThirdPartyPath);

if (bIsThirdPartyPathValid)
{
PublicLibraryPaths.Add(ThirdPartyPath);
string AWSCoreLibFile = System.IO.Path.Combine(ThirdPartyPath, "aws-cpp-sdk-core.lib");
if (File.Exists(AWSCoreLibFile))
{
PublicAdditionalLibraries.Add(AWSCoreLibFile);
}
else
{
throw new BuildException("aws-cpp-sdk-core.lib not found. Expected in this location: " + AWSCoreLibFile);
}

string AWSCoreDLLFile = System.IO.Path.Combine(ThirdPartyPath, "aws-cpp-sdk-core.dll");
if (File.Exists(AWSCoreDLLFile))
{
PublicDelayLoadDLLs.Add("aws-cpp-sdk-core.dll");
RuntimeDependencies.Add(AWSCoreDLLFile);
}
else
{
throw new BuildException("aws-cpp-sdk-core.dll not found. Expected in this location: " + AWSCoreDLLFile);
}

string BinariesDirectory = System.IO.Path.Combine(BaseDirectory, "Binaries", Target.Platform.ToString());
if (!Directory.Exists(BinariesDirectory))
{
Directory.CreateDirectory(BinariesDirectory);
}

if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "aws-cpp-sdk-core.dll")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "aws-cpp-sdk-core.dll"), System.IO.Path.Combine(BinariesDirectory, "aws-cpp-sdk-core.dll"));
}
}
}
if (Target.Type == TargetRules.TargetType.Client)
{
if (!Directory.Exists(BinariesDirectory))
{
Directory.CreateDirectory(BinariesDirectory);
}

PublicDefinitions.Add("WITH_AWSCORE=1");
//PublicLibraryPaths.Add(ThirdPartyPath);
if (Target.Platform == UnrealTargetPlatform.Linux)
{
// dependencies
string CommonSoFile = System.IO.Path.Combine(ThirdPartyPath, "libaws-c-common.so");
if (File.Exists(CommonSoFile))
{
PublicAdditionalLibraries.Add(CommonSoFile);
RuntimeDependencies.Add(CommonSoFile);
}
else
{
throw new BuildException("libaws-c-common.so not found. Expected in this location: " + CommonSoFile);
}

string EventStreamSoFile = System.IO.Path.Combine(ThirdPartyPath, "libaws-c-event-stream.so");
if (File.Exists(EventStreamSoFile))
{
PublicAdditionalLibraries.Add(EventStreamSoFile);
RuntimeDependencies.Add(EventStreamSoFile);
}
else
{
throw new BuildException("libaws-c-event-stream.so not found. Expected in this location: " + EventStreamSoFile);
}

string ChecksumsSoFile = System.IO.Path.Combine(ThirdPartyPath, "libaws-checksums.so");
if (File.Exists(ChecksumsSoFile))
{
PublicAdditionalLibraries.Add(ChecksumsSoFile);
RuntimeDependencies.Add(ChecksumsSoFile);
}
else
{
throw new BuildException("libaws-checksums.so not found. Expected in this location: " + ChecksumsSoFile);
}

// aws core
string AWSCoreSoFile = System.IO.Path.Combine(ThirdPartyPath, "libaws-cpp-sdk-core.so");
if (File.Exists(AWSCoreSoFile))
{
PublicAdditionalLibraries.Add(AWSCoreSoFile);
RuntimeDependencies.Add(AWSCoreSoFile);
}
else
{
throw new BuildException("libaws-cpp-sdk-core.so not found. Expected in this location: " + AWSCoreSoFile);
}

// binaries
if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "libaws-c-common.so")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "libaws-c-common.so"), System.IO.Path.Combine(BinariesDirectory, "libaws-c-common.so"));
}
if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "libaws-c-event-stream.so")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "libaws-c-event-stream.so"), System.IO.Path.Combine(BinariesDirectory, "libaws-c-event-stream.so"));
}
if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "libaws-checksums.so")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "libaws-checksums.so"), System.IO.Path.Combine(BinariesDirectory, "libaws-checksums.so"));
}
if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "libaws-cpp-sdk-core.so")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "libaws-cpp-sdk-core.so"), System.IO.Path.Combine(BinariesDirectory, "libaws-cpp-sdk-core.so"));
}
}
else if (Target.Platform == UnrealTargetPlatform.Win64)
{
// dependencies
string CommonLibFile = System.IO.Path.Combine(ThirdPartyPath, "aws-c-common.lib");
if (File.Exists(CommonLibFile))
{
PublicAdditionalLibraries.Add(CommonLibFile);
}
else
{
throw new BuildException("aws-c-common.lib not found. Expected in this location: " + CommonLibFile);
}

string CommonDLLFile = System.IO.Path.Combine(ThirdPartyPath, "aws-c-common.dll");
if (File.Exists(CommonDLLFile))
{
PublicDelayLoadDLLs.Add("aws-c-common.dll");
RuntimeDependencies.Add(CommonDLLFile);
}
else
{
throw new BuildException("aws-c-common.dll not found. Expected in this location: " + CommonDLLFile);
}

string EventStreamLibFile = System.IO.Path.Combine(ThirdPartyPath, "aws-c-event-stream.lib");
if (File.Exists(EventStreamLibFile))
{
PublicAdditionalLibraries.Add(EventStreamLibFile);
}
else
{
throw new BuildException("aws-c-event-stream.lib not found. Expected in this location: " + EventStreamLibFile);
}

string EventStreamDLLFile = System.IO.Path.Combine(ThirdPartyPath, "aws-c-event-stream.dll");
if (File.Exists(EventStreamDLLFile))
{
PublicDelayLoadDLLs.Add("aws-c-event-stream.dll");
RuntimeDependencies.Add(EventStreamDLLFile);
}
else
{
throw new BuildException("aws-c-event-stream.dll not found. Expected in this location: " + EventStreamDLLFile);
}

string ChecksumsLibFile = System.IO.Path.Combine(ThirdPartyPath, "aws-checksums.lib");
if (File.Exists(ChecksumsLibFile))
{
PublicAdditionalLibraries.Add(ChecksumsLibFile);
}
else
{
throw new BuildException("aws-checksums.lib not found. Expected in this location: " + ChecksumsLibFile);
}

string ChecksumsDLLFile = System.IO.Path.Combine(ThirdPartyPath, "aws-checksums.dll");
if (File.Exists(ChecksumsDLLFile))
{
PublicDelayLoadDLLs.Add("aws-checksums.dll");
RuntimeDependencies.Add(ChecksumsDLLFile);
}
else
{
throw new BuildException("aws-checksums.dll not found. Expected in this location: " + ChecksumsDLLFile);
}

// aws core
string AWSCoreLibFile = System.IO.Path.Combine(ThirdPartyPath, "aws-cpp-sdk-core.lib");
if (File.Exists(AWSCoreLibFile))
{
PublicAdditionalLibraries.Add(AWSCoreLibFile);
}
else
{
throw new BuildException("aws-cpp-sdk-core.lib not found. Expected in this location: " + AWSCoreLibFile);
}

string AWSCoreDLLFile = System.IO.Path.Combine(ThirdPartyPath, "aws-cpp-sdk-core.dll");
if (File.Exists(AWSCoreDLLFile))
{
PublicDelayLoadDLLs.Add("aws-cpp-sdk-core.dll");
RuntimeDependencies.Add(AWSCoreDLLFile);
}
else
{
throw new BuildException("aws-cpp-sdk-core.dll not found. Expected in this location: " + AWSCoreDLLFile);
}

// binaries
if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "aws-c-common.dll")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "aws-c-common.dll"), System.IO.Path.Combine(BinariesDirectory, "aws-c-common.dll"));
}
if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "aws-c-event-stream.dll")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "aws-c-event-stream.dll"), System.IO.Path.Combine(BinariesDirectory, "aws-c-event-stream.dll"));
}
if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "aws-checksums.dll")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "aws-checksums.dll"), System.IO.Path.Combine(BinariesDirectory, "aws-checksums.dll"));
}
if (File.Exists(System.IO.Path.Combine(BinariesDirectory, "aws-cpp-sdk-core.dll")) == false)
{
File.Copy(System.IO.Path.Combine(ThirdPartyPath, "aws-cpp-sdk-core.dll"), System.IO.Path.Combine(BinariesDirectory, "aws-cpp-sdk-core.dll"));
}
}
}
else
{
PublicDefinitions.Add("WITH_AWSCORE=0");
}
}
else
{
PublicDefinitions.Add("WITH_AWSCORE=0");
}
}
}
53 changes: 50 additions & 3 deletions GameLiftClientSDK/Source/AWSCore/Private/AWSCoreModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
#define LOCTEXT_NAMESPACE "FAWSCoreModule"

void* FAWSCoreModule::AWSCoreLibraryHandle = nullptr;
void* FAWSCoreModule::AWSCommonLibraryHandle = nullptr;
void* FAWSCoreModule::AWSEventStreamLibraryHandle = nullptr;
void* FAWSCoreModule::AWSChecksumsLibraryHandle = nullptr;

void FAWSCoreModule::StartupModule()
{
#if PLATFORM_WINDOWS && PLATFORM_64BITS
#if PLATFORM_WINDOWS && PLATFORM_64BITS && WITH_AWSCORE
LOG_NORMAL("Starting AWSCore Module...");

const FString BaseDir = IPluginManager::Get().FindPlugin("GameLiftClientSDK")->GetBaseDir();
Expand All @@ -18,9 +21,48 @@ void FAWSCoreModule::StartupModule()
const FString ThirdPartyDir = FPaths::Combine(*BaseDir, TEXT("ThirdParty"), TEXT("GameLiftClientSDK"), TEXT("Win64"));
LOG_NORMAL(FString::Printf(TEXT("ThirdParty directory is %s"), *ThirdPartyDir));

// dependencies
static const FString CommonDLLName = "aws-c-common";
const bool bCommonDependencyLoaded = LoadDependency(ThirdPartyDir, CommonDLLName, AWSCommonLibraryHandle);

if (bCommonDependencyLoaded == false)
{
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("Name"), FText::FromString(CommonDLLName));
FMessageDialog::Open(EAppMsgType::Ok, FText::Format(LOCTEXT("LoadDependencyError", "Failed to load {Name}. Plugin will not be functional"), Arguments));
FreeDependency(AWSCommonLibraryHandle);
return;
}

static const FString EventStreamDLLName = "aws-c-event-stream";
const bool bEventStreamDependencyLoaded = LoadDependency(ThirdPartyDir, EventStreamDLLName, AWSEventStreamLibraryHandle);

if (bEventStreamDependencyLoaded == false)
{
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("Name"), FText::FromString(EventStreamDLLName));
FMessageDialog::Open(EAppMsgType::Ok, FText::Format(LOCTEXT("LoadDependencyError", "Failed to load {Name}. Plugin will not be functional"), Arguments));
FreeDependency(AWSEventStreamLibraryHandle);
return;
}

static const FString ChecksumsDLLName = "aws-checksums";
const bool bChecksumsDependencyLoaded = LoadDependency(ThirdPartyDir, ChecksumsDLLName, AWSChecksumsLibraryHandle);

if (bChecksumsDependencyLoaded == false)
{
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("Name"), FText::FromString(ChecksumsDLLName));
FMessageDialog::Open(EAppMsgType::Ok, FText::Format(LOCTEXT("LoadDependencyError", "Failed to load {Name}. Plugin will not be functional"), Arguments));
FreeDependency(AWSChecksumsLibraryHandle);
return;
}

// aws core
static const FString CoreDLLName = "aws-cpp-sdk-core";
const bool bDependencyLoaded = LoadDependency(ThirdPartyDir, CoreDLLName, AWSCoreLibraryHandle);
if (bDependencyLoaded == false)
const bool bCoreDependencyLoaded = LoadDependency(ThirdPartyDir, CoreDLLName, AWSCoreLibraryHandle);

if (bCoreDependencyLoaded == false)
{
FFormatNamedArguments Arguments;
Arguments.Add(TEXT("Name"), FText::FromString(CoreDLLName));
Expand All @@ -36,10 +78,15 @@ void FAWSCoreModule::StartupModule()

void FAWSCoreModule::ShutdownModule()
{
#if WITH_AWSCORE
Aws::ShutdownAPI(options);
LOG_NORMAL("Aws::ShutdownAPI called.");
FreeDependency(AWSCoreLibraryHandle);
FreeDependency(AWSCommonLibraryHandle);
FreeDependency(AWSEventStreamLibraryHandle);
FreeDependency(AWSChecksumsLibraryHandle);
LOG_NORMAL("Shutting down AWSCore Module...");
#endif
}

bool FAWSCoreModule::LoadDependency(const FString& Dir, const FString& Name, void*& Handle)
Expand Down
3 changes: 3 additions & 0 deletions GameLiftClientSDK/Source/AWSCore/Public/AWSCoreModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ class FAWSCoreModule : public IModuleInterface
private:
Aws::SDKOptions options;
static void* AWSCoreLibraryHandle;
static void* AWSCommonLibraryHandle;
static void* AWSEventStreamLibraryHandle;
static void* AWSChecksumsLibraryHandle;
static bool LoadDependency(const FString& Dir, const FString& Name, void*& Handle);
static void FreeDependency(void*& Handle);
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@

namespace Aws
{
static const char* JSON_CONTENT_TYPE = "application/json";
static const char* AMZN_JSON_CONTENT_TYPE_1_0 = "application/x-amz-json-1.0";
static const char* AMZN_JSON_CONTENT_TYPE_1_1 = "application/x-amz-json-1.1";
static const char* FORM_CONTENT_TYPE = "application/x-www-form-urlencoded";
static const char* AMZN_XML_CONTENT_TYPE = "application/xml";
static const char JSON_CONTENT_TYPE[] = "application/json";
static const char AMZN_JSON_CONTENT_TYPE_1_0[] = "application/x-amz-json-1.0";
static const char AMZN_JSON_CONTENT_TYPE_1_1[] = "application/x-amz-json-1.1";
static const char FORM_CONTENT_TYPE[] = "application/x-www-form-urlencoded";
static const char AMZN_XML_CONTENT_TYPE[] = "application/xml";
static const char AMZN_EVENTSTREAM_CONTENT_TYPE[] = "application/vnd.amazon.eventstream";

/**
* High-level abstraction over AWS requests. GetBody() calls SerializePayload() and uses a stringbuf under the hood.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ namespace Aws
return headers;
}

/**
* AmazonStreamingWebServiceRequest always returns true.
*/
bool IsStreaming() const override { return true; }

/**
* Get the user set contentType. Defaults to binary/octet-stream
*/
Expand Down
Loading