2016-01-07 08:17:16 -05:00
|
|
|
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "MacTargetPlatformPrivatePCH.h"
|
2014-10-27 07:53:18 -04:00
|
|
|
#include "ModuleManager.h"
|
|
|
|
|
#include "ISettingsModule.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "FMacTargetPlatformModule"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Holds the target platform singleton.
|
|
|
|
|
*/
|
|
|
|
|
static ITargetPlatform* Singleton = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Module for Mac as a target platform
|
|
|
|
|
*/
|
|
|
|
|
class FMacTargetPlatformModule
|
|
|
|
|
: public ITargetPlatformModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Destructor.
|
|
|
|
|
*/
|
|
|
|
|
~FMacTargetPlatformModule()
|
|
|
|
|
{
|
|
|
|
|
Singleton = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// Begin ITargetPlatformModule interface
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual ITargetPlatform* GetTargetPlatform() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
if (Singleton == NULL)
|
|
|
|
|
{
|
2014-04-30 16:19:30 -04:00
|
|
|
Singleton = new TGenericMacTargetPlatform<true, false, false>();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Singleton;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// End ITargetPlatformModule interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// Begin IModuleInterface interface
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void StartupModule() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2015-02-11 06:04:24 -05:00
|
|
|
TargetSettings = NewObject<UMacTargetSettings>(GetTransientPackage(), "MacTargetSettings", RF_Standalone);
|
2015-09-18 12:45:20 -04:00
|
|
|
|
|
|
|
|
// We need to manually load the config properties here, as this module is loaded before the UObject system is setup to do this
|
|
|
|
|
GConfig->GetArray(TEXT("/Script/MacTargetPlatform.MacTargetSettings"), TEXT("TargetedRHIs"), TargetSettings->TargetedRHIs, GEngineIni);
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
TargetSettings->AddToRoot();
|
|
|
|
|
|
2014-10-27 07:53:18 -04:00
|
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (SettingsModule != nullptr)
|
|
|
|
|
{
|
|
|
|
|
SettingsModule->RegisterSettings("Project", "Platforms", "Mac",
|
|
|
|
|
LOCTEXT("TargetSettingsName", "Mac"),
|
2014-10-30 12:36:31 -04:00
|
|
|
LOCTEXT("TargetSettingsDescription", "Settings and resources for Mac platform"),
|
2014-03-14 14:13:41 -04:00
|
|
|
TargetSettings
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void ShutdownModule() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-10-27 07:53:18 -04:00
|
|
|
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
if (SettingsModule != nullptr)
|
|
|
|
|
{
|
|
|
|
|
SettingsModule->UnregisterSettings("Project", "Platforms", "Mac");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!GExitPurge)
|
|
|
|
|
{
|
|
|
|
|
// If we're in exit purge, this object has already been destroyed
|
|
|
|
|
TargetSettings->RemoveFromRoot();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TargetSettings = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// End IModuleInterface interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// Holds the target settings.
|
|
|
|
|
UMacTargetSettings* TargetSettings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE( FMacTargetPlatformModule, MacTargetPlatform);
|