2019-12-26 15:32:37 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2015-09-03 18:09:31 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2016-11-23 15:48:37 -05:00
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "UObject/Object.h"
|
2017-08-11 12:43:42 -04:00
|
|
|
#include "UObject/SoftObjectPtr.h"
|
2016-11-23 15:48:37 -05:00
|
|
|
#include "Modules/ModuleInterface.h"
|
|
|
|
|
#include "Modules/ModuleManager.h"
|
2016-12-18 15:34:36 -05:00
|
|
|
#include "Engine/Blueprint.h"
|
2015-11-25 18:47:20 -05:00
|
|
|
|
2016-01-25 13:25:51 -05:00
|
|
|
class UBlueprint;
|
2016-11-23 15:48:37 -05:00
|
|
|
enum class ESavePackageResult;
|
2017-03-14 15:48:33 -04:00
|
|
|
class ITargetPlatform;
|
2016-01-25 13:25:51 -05:00
|
|
|
|
2016-12-14 22:10:20 -05:00
|
|
|
struct FPlatformNativizationDetails
|
|
|
|
|
{
|
2017-04-04 20:49:52 -04:00
|
|
|
FName PlatformName;
|
2016-12-14 22:10:20 -05:00
|
|
|
FCompilerNativizationOptions CompilerNativizationOptions;
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-16 17:17:43 -05:00
|
|
|
struct FNativeCodeGenInitData
|
2015-11-25 18:47:20 -05:00
|
|
|
{
|
2016-12-14 22:10:20 -05:00
|
|
|
// This is an array platforms. These are determined by the cooker:
|
|
|
|
|
TArray< FPlatformNativizationDetails > CodegenTargets;
|
2015-11-25 18:47:20 -05:00
|
|
|
|
2015-12-16 17:17:43 -05:00
|
|
|
// Optional Manifest ManifestIdentifier, used for child cook processes that need a unique manifest name.
|
|
|
|
|
// The identifier is used to make a unique name for each platform that is converted.
|
|
|
|
|
int32 ManifestIdentifier;
|
2015-11-25 18:47:20 -05:00
|
|
|
};
|
|
|
|
|
|
2015-09-03 18:09:31 -04:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
2015-11-25 18:47:20 -05:00
|
|
|
class IBlueprintNativeCodeGenModule : public IModuleInterface
|
2015-09-03 18:09:31 -04:00
|
|
|
{
|
2015-11-25 18:47:20 -05:00
|
|
|
public:
|
2015-12-16 17:17:43 -05:00
|
|
|
FORCEINLINE static void InitializeModule(const FNativeCodeGenInitData& InitData);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Utility function to reconvert all assets listed in a manifest, used to make fixes to
|
|
|
|
|
* the code generator itself and quickly test them with an already converted project.
|
|
|
|
|
*
|
|
|
|
|
* Not for use with any kind of incremental cooking.
|
|
|
|
|
*/
|
2016-12-14 22:10:20 -05:00
|
|
|
FORCEINLINE static void InitializeModuleForRerunDebugOnly(const TArray<FPlatformNativizationDetails>& CodegenTargets);
|
2015-12-16 17:17:43 -05:00
|
|
|
|
2015-11-25 18:47:20 -05:00
|
|
|
/**
|
|
|
|
|
* Wrapper function that retrieves the interface to this module from the
|
|
|
|
|
* module-manager (so we can keep dependent code free of hardcoded strings,
|
|
|
|
|
* used to lookup this module by name).
|
|
|
|
|
*
|
|
|
|
|
* @return A reference to this module interface (a singleton).
|
|
|
|
|
*/
|
|
|
|
|
static IBlueprintNativeCodeGenModule& Get()
|
|
|
|
|
{
|
|
|
|
|
return FModuleManager::LoadModuleChecked<IBlueprintNativeCodeGenModule>(GetModuleName());
|
|
|
|
|
}
|
2015-12-16 17:17:43 -05:00
|
|
|
|
|
|
|
|
static bool IsNativeCodeGenModuleLoaded()
|
|
|
|
|
{
|
|
|
|
|
return FModuleManager::Get().IsModuleLoaded(GetModuleName());
|
|
|
|
|
}
|
2015-11-25 18:47:20 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a centralized point where the name of this module is supplied
|
|
|
|
|
* from (so we can avoid littering code with hardcoded strings that
|
|
|
|
|
* all reference this module - in case we want to rename it).
|
|
|
|
|
*
|
|
|
|
|
* @return The name of the module that this file is part of.
|
|
|
|
|
*/
|
|
|
|
|
static FName GetModuleName()
|
|
|
|
|
{
|
|
|
|
|
return TEXT("BlueprintNativeCodeGen");
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-04 20:49:52 -04:00
|
|
|
virtual void Convert(UPackage* Package, ESavePackageResult ReplacementType, const FName PlatformName) = 0;
|
|
|
|
|
virtual void SaveManifest() = 0;
|
2015-12-16 17:17:43 -05:00
|
|
|
virtual void MergeManifest(int32 ManifestIdentifier) = 0;
|
2015-11-25 18:47:20 -05:00
|
|
|
virtual void FinalizeManifest() = 0;
|
2016-01-25 13:25:51 -05:00
|
|
|
virtual void GenerateStubs() = 0;
|
|
|
|
|
virtual void GenerateFullyConvertedClasses() = 0;
|
2017-08-11 12:43:42 -04:00
|
|
|
virtual void MarkUnconvertedBlueprintAsNecessary(TSoftObjectPtr<UBlueprint> BPPtr, const FCompilerNativizationOptions& NativizationOptions) = 0;
|
|
|
|
|
virtual const TMultiMap<FName, TSoftClassPtr<UObject>>& GetFunctionsBoundToADelegate() = 0;
|
2017-03-14 15:48:33 -04:00
|
|
|
|
|
|
|
|
virtual void FillPlatformNativizationDetails(const ITargetPlatform* Platform, FPlatformNativizationDetails& OutDetails) = 0;
|
2015-12-16 17:17:43 -05:00
|
|
|
protected:
|
|
|
|
|
virtual void Initialize(const FNativeCodeGenInitData& InitData) = 0;
|
2016-12-14 22:10:20 -05:00
|
|
|
virtual void InitializeForRerunDebugOnly(const TArray<FPlatformNativizationDetails>& CodegenTargets) = 0;
|
2015-09-03 18:09:31 -04:00
|
|
|
};
|
2015-12-16 17:17:43 -05:00
|
|
|
|
|
|
|
|
void IBlueprintNativeCodeGenModule::InitializeModule(const FNativeCodeGenInitData& InitData)
|
|
|
|
|
{
|
|
|
|
|
IBlueprintNativeCodeGenModule& Module = FModuleManager::LoadModuleChecked<IBlueprintNativeCodeGenModule>(GetModuleName());
|
|
|
|
|
Module.Initialize(InitData);
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 22:10:20 -05:00
|
|
|
void IBlueprintNativeCodeGenModule::InitializeModuleForRerunDebugOnly(const TArray<FPlatformNativizationDetails>& CodegenTargets)
|
2015-12-16 17:17:43 -05:00
|
|
|
{
|
|
|
|
|
IBlueprintNativeCodeGenModule& Module = FModuleManager::LoadModuleChecked<IBlueprintNativeCodeGenModule>(GetModuleName());
|
|
|
|
|
Module.InitializeForRerunDebugOnly(CodegenTargets);
|
|
|
|
|
}
|
|
|
|
|
|