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 "UnrealHeaderTool.h"
|
|
|
|
|
|
|
|
|
|
#include "RequiredProgramMainCPPInclude.h"
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_APPLICATION(UnrealHeaderTool, "UnrealHeaderTool");
|
|
|
|
|
|
|
|
|
|
DEFINE_LOG_CATEGORY(LogCompile);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Application entry point
|
|
|
|
|
*
|
|
|
|
|
* @param ArgC Command-line argument count
|
|
|
|
|
* @param ArgV Argument strings
|
|
|
|
|
*/
|
2014-04-23 20:10:59 -04:00
|
|
|
INT32_MAIN_INT32_ARGC_TCHAR_ARGV()
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
FString CmdLine;
|
|
|
|
|
|
|
|
|
|
for (int32 Arg = 0; Arg < ArgC; Arg++)
|
|
|
|
|
{
|
|
|
|
|
FString LocalArg = ArgV[Arg];
|
|
|
|
|
if (LocalArg.Contains(TEXT(" ")))
|
|
|
|
|
{
|
|
|
|
|
CmdLine += TEXT("\"");
|
|
|
|
|
CmdLine += LocalArg;
|
|
|
|
|
CmdLine += TEXT("\"");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CmdLine += LocalArg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Arg + 1 < ArgC)
|
|
|
|
|
{
|
|
|
|
|
CmdLine += TEXT(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString ShortCmdLine = FCommandLine::RemoveExeName(*CmdLine);
|
|
|
|
|
ShortCmdLine = ShortCmdLine.Trim();
|
|
|
|
|
|
|
|
|
|
// Get game name from the commandline. It will later be used to load the correct ini files.
|
|
|
|
|
FString ModuleInfoFilename;
|
|
|
|
|
if (ShortCmdLine.Len() && **ShortCmdLine != TEXT('-'))
|
|
|
|
|
{
|
|
|
|
|
const TCHAR* CmdLinePtr = *ShortCmdLine;
|
|
|
|
|
|
|
|
|
|
// Parse the game name. UHT doesn't care about this directly, but the engine init code will be
|
|
|
|
|
// expecting it when it parses the command-line itself.
|
|
|
|
|
FString GameName = FParse::Token(CmdLinePtr, false);
|
|
|
|
|
|
|
|
|
|
// This parameter is the absolute path to the file which contains information about the modules
|
|
|
|
|
// that UHT needs to generate code for.
|
|
|
|
|
ModuleInfoFilename = FParse::Token(CmdLinePtr, false );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GIsUCCMakeStandaloneHeaderGenerator = true;
|
|
|
|
|
GEngineLoop.PreInit(*ShortCmdLine);
|
|
|
|
|
|
2014-06-06 04:32:21 -04:00
|
|
|
// Log full command line for UHT as UBT overrides LogInit verbosity settings
|
|
|
|
|
UE_LOG(LogCompile, Log, TEXT("UHT Command Line: %s"), *CmdLine);
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
if (ModuleInfoFilename.IsEmpty())
|
|
|
|
|
{
|
|
|
|
|
if (!FPlatformMisc::IsDebuggerPresent())
|
|
|
|
|
{
|
|
|
|
|
UE_LOG(LogCompile, Error, TEXT( "Missing module info filename on command line" ));
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we have a debugger, let's use a pre-existing manifest file to streamline debugging
|
|
|
|
|
// without the user having to faff around trying to get a UBT-generated manifest
|
|
|
|
|
ModuleInfoFilename = FPaths::ConvertRelativePathToFull(FPlatformProcess::BaseDir(), TEXT("../../Source/Programs/UnrealHeaderTool/Resources/UHTDebugging.manifest"));
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-23 18:36:17 -04:00
|
|
|
extern ECompilationResult::Type UnrealHeaderTool_Main(const FString& ModuleInfoFilename);
|
|
|
|
|
ECompilationResult::Type Result = UnrealHeaderTool_Main(ModuleInfoFilename);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
FEngineLoop::AppPreExit();
|
|
|
|
|
FEngineLoop::AppExit();
|
|
|
|
|
|
2014-04-23 18:36:17 -04:00
|
|
|
return Result;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|