You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Separates CMake generator from makefile one and adds qmake generator. - Contributed by salamanderrake (PR #560). #codereview Josh.Adams, Robert.Manuszewski [CL 2347904 by Dmitry Rekman in Main branch]
134 lines
5.0 KiB
C#
134 lines
5.0 KiB
C#
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.IO;
|
|
|
|
namespace UnrealBuildTool
|
|
{
|
|
/// <summary>
|
|
/// Represents a folder within the master project (e.g. Visual Studio solution)
|
|
/// </summary>
|
|
public class MakefileFolder : MasterProjectFolder
|
|
{
|
|
/// <summary>
|
|
/// Constructor
|
|
/// </summary>
|
|
public MakefileFolder( ProjectFileGenerator InitOwnerProjectFileGenerator, string InitFolderName )
|
|
: base(InitOwnerProjectFileGenerator, InitFolderName)
|
|
{
|
|
}
|
|
}
|
|
|
|
public class MakefileProjectFile : ProjectFile
|
|
{
|
|
public MakefileProjectFile( string InitFilePath )
|
|
: base(InitFilePath)
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Makefile project file generator implementation
|
|
/// </summary>
|
|
public class MakefileGenerator : ProjectFileGenerator
|
|
{
|
|
/// File extension for project files we'll be generating (e.g. ".vcxproj")
|
|
override public string ProjectFileExtension
|
|
{
|
|
get
|
|
{
|
|
return ".mk";
|
|
}
|
|
}
|
|
|
|
protected override bool WriteMasterProjectFile( ProjectFile UBTProject )
|
|
{
|
|
bool bSuccess = true;
|
|
return bSuccess;
|
|
}
|
|
|
|
private bool WriteMakefile()
|
|
{
|
|
var FileName = "Makefile"; // MasterProjectName + ".mk";
|
|
var MakefileContent = new StringBuilder();
|
|
MakefileContent.Append(
|
|
"# Makefile generated by MakefileGenerator.cs\n" +
|
|
"# *DO NOT EDIT*\n\n" +
|
|
"TARGETS ="
|
|
);
|
|
foreach (string Target in DiscoverTargets())
|
|
{
|
|
var Basename = Path.GetFileNameWithoutExtension(Target);
|
|
Basename = Path.GetFileNameWithoutExtension(Basename);
|
|
foreach (UnrealTargetConfiguration CurConfiguration in Enum.GetValues(typeof(UnrealTargetConfiguration)))
|
|
{
|
|
if (CurConfiguration != UnrealTargetConfiguration.Unknown && CurConfiguration != UnrealTargetConfiguration.Development)
|
|
{
|
|
if (UnrealBuildTool.IsValidConfiguration(CurConfiguration))
|
|
{
|
|
var Confname = Enum.GetName(typeof(UnrealTargetConfiguration), CurConfiguration);
|
|
MakefileContent.Append(String.Format(" \\\n {0}-Linux-{1}", Basename, Confname));
|
|
}
|
|
}
|
|
}
|
|
MakefileContent.Append(" \\\n " + Basename);
|
|
}
|
|
MakefileContent.Append("\n\nBUILD = Engine/Build/BatchFiles/Linux/Build.sh\n\n" +
|
|
"all: $(TARGETS)\n"
|
|
);
|
|
foreach (string Target in DiscoverTargets())
|
|
{
|
|
var Basename = Path.GetFileNameWithoutExtension(Target);
|
|
Basename = Path.GetFileNameWithoutExtension(Basename);
|
|
foreach (UnrealTargetConfiguration CurConfiguration in Enum.GetValues(typeof(UnrealTargetConfiguration)))
|
|
{
|
|
if (CurConfiguration != UnrealTargetConfiguration.Unknown && CurConfiguration != UnrealTargetConfiguration.Development)
|
|
{
|
|
if (UnrealBuildTool.IsValidConfiguration(CurConfiguration))
|
|
{
|
|
var Confname = Enum.GetName(typeof(UnrealTargetConfiguration), CurConfiguration);
|
|
MakefileContent.Append(String.Format("\n{0}-Linux-{1}:\n\t$(BUILD) {0} Linux {1} $(ARGS)\n", Basename, Confname));
|
|
}
|
|
}
|
|
}
|
|
|
|
MakefileContent.Append(String.Format("\n{0}:\n\t$(BUILD) {0} Linux Development $(ARGS)\n", Basename));
|
|
}
|
|
MakefileContent.Append("\n.PHONY: $(TARGETS)\n");
|
|
var FullFileName = Path.Combine(MasterProjectRelativePath, FileName);
|
|
return WriteFileIfChanged(FullFileName, MakefileContent.ToString());
|
|
}
|
|
|
|
/// ProjectFileGenerator interface
|
|
//protected override bool WriteMasterProjectFile( ProjectFile UBTProject )
|
|
protected override bool WriteProjectFiles ()
|
|
{
|
|
return WriteMakefile();
|
|
}
|
|
|
|
/// ProjectFileGenerator interface
|
|
public override MasterProjectFolder AllocateMasterProjectFolder( ProjectFileGenerator InitOwnerProjectFileGenerator, string InitFolderName )
|
|
{
|
|
return new MakefileFolder( InitOwnerProjectFileGenerator, InitFolderName );
|
|
}
|
|
|
|
/// ProjectFileGenerator interface
|
|
/// <summary>
|
|
/// Allocates a generator-specific project file object
|
|
/// </summary>
|
|
/// <param name="InitFilePath">Path to the project file</param>
|
|
/// <returns>The newly allocated project file object</returns>
|
|
protected override ProjectFile AllocateProjectFile( string InitFilePath )
|
|
{
|
|
return new MakefileProjectFile( InitFilePath );
|
|
}
|
|
|
|
/// ProjectFileGenerator interface
|
|
public override void CleanProjectFiles(string InMasterProjectRelativePath, string InMasterProjectName, string InIntermediateProjectFilesPath)
|
|
{
|
|
}
|
|
}
|
|
}
|