2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
#include "LinuxTargetPlatformPrivatePCH.h"
|
2014-10-27 07:53:18 -04:00
|
|
|
#include "ISettingsModule.h"
|
|
|
|
|
#include "ModuleInterface.h"
|
|
|
|
|
#include "ModuleManager.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#define LOCTEXT_NAMESPACE "FLinuxTargetPlatformModule"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Holds the target platform singleton.
|
|
|
|
|
*/
|
2014-04-02 18:09:23 -04:00
|
|
|
static ITargetPlatform* Singleton = NULL;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Module for the Android target platform.
|
|
|
|
|
*/
|
|
|
|
|
class FLinuxTargetPlatformModule
|
|
|
|
|
: public ITargetPlatformModule
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
2014-10-27 07:53:18 -04:00
|
|
|
/** Destructor. */
|
2014-03-14 14:13:41 -04:00
|
|
|
~FLinuxTargetPlatformModule( )
|
|
|
|
|
{
|
2014-04-02 18:09:23 -04:00
|
|
|
Singleton = NULL;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2014-10-27 07:53:18 -04:00
|
|
|
// ITargetPlatformModule interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual ITargetPlatform* GetTargetPlatform( ) override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-04-02 18:09:23 -04:00
|
|
|
if (Singleton == NULL)
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-05-08 13:01:46 -04:00
|
|
|
Singleton = new TLinuxTargetPlatform<true, false, false>();
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-04-02 18:09:23 -04:00
|
|
|
return Singleton;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2014-10-27 07:53:18 -04:00
|
|
|
// IModuleInterface interface
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-13 06:14:46 -04:00
|
|
|
virtual void StartupModule() override
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
TargetSettings = ConstructObject<ULinuxTargetSettings>(ULinuxTargetSettings::StaticClass(), GetTransientPackage(), "LinuxTargetSettings", RF_Standalone);
|
2014-08-04 18:19:51 -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/LinuxTargetPlatform.LinuxTargetSettings"), 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", "Linux",
|
|
|
|
|
LOCTEXT("TargetSettingsName", "Linux"),
|
2014-08-04 18:19:51 -04:00
|
|
|
LOCTEXT("TargetSettingsDescription", "Settings for Linux target 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
|
|
|
|
2014-08-04 18:19:51 -04:00
|
|
|
if (SettingsModule != nullptr)
|
|
|
|
|
{
|
|
|
|
|
SettingsModule->UnregisterSettings("Project", "Platforms", "Linux");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!GExitPurge)
|
|
|
|
|
{
|
|
|
|
|
// If we're in exit purge, this object has already been destroyed
|
|
|
|
|
TargetSettings->RemoveFromRoot();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TargetSettings = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
2014-10-27 07:53:18 -04:00
|
|
|
/** Holds the target settings. */
|
2014-03-14 14:13:41 -04:00
|
|
|
ULinuxTargetSettings* TargetSettings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef LOCTEXT_NAMESPACE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_MODULE( FLinuxTargetPlatformModule, LinuxTargetPlatform);
|