示例#1
0
        // NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
        //       program executable, so we want the application name to be the game name.  In the case of a modular
        //       binary, we use 'UnrealEngine' for our application name
        public UEBuildClient(
			string InGameName, 
			UnrealTargetPlatform InPlatform, 
			UnrealTargetConfiguration InConfiguration,
			TargetRules InRulesObject,
			List<string> InAdditionalDefinitions, 
			string InRemoteRoot, 
			List<OnlyModule> InOnlyModules)
            : base(InAppName: UEBuildTarget.GetBinaryBaseName(InGameName, InRulesObject, InPlatform, InConfiguration, "Client"),
                InGameName: InGameName,
                InPlatform: InPlatform,
                InConfiguration: InConfiguration,
                InRulesObject: InRulesObject,
                InAdditionalDefinitions: InAdditionalDefinitions,
                InRemoteRoot: InRemoteRoot,
                InOnlyModules: InOnlyModules)
        {
            if (ShouldCompileMonolithic())
            {
                if ((UnrealBuildTool.IsDesktopPlatform(Platform) == false) ||
                    (Platform == UnrealTargetPlatform.WinRT) ||
                    (Platform == UnrealTargetPlatform.WinRT_ARM))
                {
                    // We are compiling for a console...
                    // We want the output to go into the <GAME>\Binaries folder
                    if (InRulesObject.bOutputToEngineBinaries == false)
                    {
                        OutputPath = OutputPath.Replace("Engine\\Binaries", InGameName + "\\Binaries");
                    }
                }
            }
        }
	static APEXLibraryMode GetAPEXLibraryMode(UnrealTargetConfiguration Config)
	{
		switch (Config)
		{
			case UnrealTargetConfiguration.Debug:
                if (BuildConfiguration.bDebugBuildsActuallyUseDebugCRT)
                {
                    return APEXLibraryMode.Debug;
                }
                else
                {
                    return APEXLibraryMode.Checked;
                }
			case UnrealTargetConfiguration.Shipping:
			case UnrealTargetConfiguration.Test:
				return APEXLibraryMode.Shipping;
			case UnrealTargetConfiguration.Development:
			case UnrealTargetConfiguration.DebugGame:
			case UnrealTargetConfiguration.Unknown:
			default:
                if(BuildConfiguration.bUseShippingPhysXLibraries)
                {
                    return APEXLibraryMode.Shipping;
                }
                else if (BuildConfiguration.bUseCheckedPhysXLibraries)
                {
                    return APEXLibraryMode.Checked;
                }
                else
                {
                    return APEXLibraryMode.Profile;
                }
		}
	}
        // NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
        //       program executable, so we want the application name to be the game name.  In the case of a modular
        //       binary, we use 'UnrealEngine' for our application name
        public UEBuildEditor(
			string InGameName, 
			UnrealTargetPlatform InPlatform, 
			UnrealTargetConfiguration InConfiguration,
			TargetRules InRulesObject,
			List<string> InAdditionalDefinitions, 
			string InRemoteRoot, 
			List<OnlyModule> InOnlyModules,
			bool bInEditorRecompile)
            : base(InAppName:UEBuildTarget.GetBinaryBaseName(
					InGameName, 
					InRulesObject, 
					InPlatform, 
					InConfiguration, 
					(InRulesObject.Type == TargetRules.TargetType.Editor) ? "Editor" : ""
					),
				InGameName:InGameName, 
				InPlatform:InPlatform, 
				InConfiguration:InConfiguration,
				InRulesObject: InRulesObject, 
				InAdditionalDefinitions:InAdditionalDefinitions, 
				InRemoteRoot:InRemoteRoot, 
				InOnlyModules:InOnlyModules,
				bInEditorRecompile: bInEditorRecompile)
        {
        }
    static void AddPluginToAgenda(UE4Build.BuildAgenda Agenda, string PluginFileName, PluginDescriptor Plugin, string TargetName, TargetRules.TargetType TargetType, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, List<string> ReceiptFileNames, string InAdditionalArgs)
    {
        // Find a list of modules that need to be built for this plugin
        List<string> ModuleNames = new List<string>();
        foreach(ModuleDescriptor Module in Plugin.Modules)
        {
            bool bBuildDeveloperTools = (TargetType == TargetRules.TargetType.Editor || TargetType == TargetRules.TargetType.Program);
            bool bBuildEditor = (TargetType == TargetRules.TargetType.Editor);
            if(Module.IsCompiledInConfiguration(Platform, TargetType, bBuildDeveloperTools, bBuildEditor))
            {
                ModuleNames.Add(Module.Name);
            }
        }

        // Add these modules to the build agenda
        if(ModuleNames.Count > 0)
        {
            string Arguments = String.Format("-plugin {0}", CommandUtils.MakePathSafeToUseWithCommandLine(PluginFileName));
            foreach(string ModuleName in ModuleNames)
            {
                Arguments += String.Format(" -module {0}", ModuleName);
            }

            string ReceiptFileName = BuildReceipt.GetDefaultPath(Path.GetDirectoryName(PluginFileName), TargetName, Platform, Configuration, "");
            Arguments += String.Format(" -receipt {0}", CommandUtils.MakePathSafeToUseWithCommandLine(ReceiptFileName));
            ReceiptFileNames.Add(ReceiptFileName);

            if(!String.IsNullOrEmpty(InAdditionalArgs))
            {
                Arguments += InAdditionalArgs;
            }

            Agenda.AddTarget(TargetName, Platform, Configuration, InAddArgs: Arguments);
        }
    }
示例#5
0
		public UEBuildServer(
			string InGameName, 
			UnrealTargetPlatform InPlatform, 
			UnrealTargetConfiguration InConfiguration,
			TargetRules InRulesObject,
			List<string> InAdditionalDefinitions, 
			string InRemoteRoot, 
			List<OnlyModule> InOnlyModules,
			bool bInEditorRecompile)
			// NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
			//       program executable, so we want the application name to be the game name.  In the case of a modular
			//       binary, we use 'UnrealEngine' for our application name
			: base(
				InAppName:UEBuildTarget.GetBinaryBaseName(InGameName, InRulesObject, InPlatform, InConfiguration, "Server"),
				InGameName:InGameName,
				InPlatform:InPlatform,
				InConfiguration:InConfiguration,
				InRulesObject: InRulesObject, 
				InAdditionalDefinitions:InAdditionalDefinitions,
				InRemoteRoot:InRemoteRoot,
				InOnlyModules:InOnlyModules,
				bInEditorRecompile: bInEditorRecompile
			)
		{
		}
 /// <summary>
 /// Allow various platform project generators to generate any special project properties if required
 /// </summary>
 /// <param name="InPlatform"></param>
 /// <returns></returns>
 public static bool GenerateGamePlatformSpecificProperties(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration Configuration, TargetRules.TargetType TargetType, StringBuilder VCProjectFileContent, string RootDirectory, string TargetFilePath)
 {
     if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true)
     {
         ProjectGeneratorDictionary[InPlatform].GenerateGameProperties(Configuration, VCProjectFileContent, TargetType, RootDirectory, TargetFilePath); ;
     }
     return true;
 }
		/**
		 *	Return the VisualStudio platform name for this build platform
		 *	
		 *	@param	InPlatform			The UnrealTargetPlatform being built
		 *	@param	InConfiguration		The UnrealTargetConfiguration being built
		 *	
		 *	@return	string				The name of the platform that VisualStudio recognizes
		 */
		public override string GetVisualStudioPlatformName(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
		{
			if (InPlatform == UnrealTargetPlatform.WinRT)
			{
				return "WinRT";
			}
			return InPlatform.ToString();
		}
	public override bool ShouldCompileMonolithic(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
	{
		if (UnrealBuildTool.UnrealBuildTool.CommandLineContains("-monolithic") == true)
		{
			return true;
		}
		return false;
	}
示例#9
0
		/// <summary>
		/// Constructs a TargetInfo
		/// </summary>
		/// <param name="InitPlatform">Target platform</param>
		/// <param name="InitConfiguration">Target build configuration</param>
		public TargetInfo( UnrealTargetPlatform InitPlatform, UnrealTargetConfiguration InitConfiguration )
		{
			Platform = InitPlatform;
			Configuration = InitConfiguration;

			// get the platform's architecture
			var BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform);
			Architecture = BuildPlatform.GetActiveArchitecture();
		}
	public override bool ShouldCompileMonolithic(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
	{
		if (UnrealBuildTool.UnrealBuildTool.CommandLineContains("-monolithic") == true)
		{
			return true;
		}
		// Don't build monolithic because we want plugin support
		return false;
	}
示例#11
0
		/// <summary>
		/// Gets the standard path for an manifest
		/// </summary>
		/// <param name="DirectoryName">The directory containing this manifest</param>
		/// <param name="AppName">The modular app name being built</param>
		/// <param name="Configuration">The target configuration</param>
		/// <param name="Platform">The target platform</param>
		/// <param name="BuildArchitecture">The architecture of the target platform</param>
		/// <returns>Filename for the app receipt</returns>
		public static string GetStandardFileName(string AppName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string BuildArchitecture, bool bIsGameDirectory)
		{
			string BaseName = AppName;
			if(Configuration != UnrealTargetConfiguration.Development && !(Configuration == UnrealTargetConfiguration.DebugGame && !bIsGameDirectory))
			{
				BaseName += String.Format("-{0}-{1}", Platform.ToString(), Configuration.ToString());
			}
			return String.Format("{0}{1}.modules", BaseName, BuildArchitecture);
		}
示例#12
0
		/// <summary>
		/// Constructs a TargetInfo
		/// </summary>
		/// <param name="InitPlatform">Target platform</param>
		/// <param name="InitConfiguration">Target build configuration</param>
		public TargetInfo( UnrealTargetPlatform InitPlatform, UnrealTargetConfiguration InitConfiguration, TargetRules.TargetType? InitType = null )
		{
			Platform = InitPlatform;
			Configuration = InitConfiguration;
			Type = InitType;

			// get the platform's architecture
			var BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform);
			Architecture = BuildPlatform.GetActiveArchitecture();
		}
			public InstalledPlatformConfiguration(UnrealTargetConfiguration InConfiguration, UnrealTargetPlatform InPlatform, TargetRules.TargetType InPlatformType, string InArchitecture, string InRequiredFile, EProjectType InProjectType, bool bInCanBeDisplayed)
			{
				Configuration = InConfiguration;
				Platform = InPlatform;
				PlatformType = InPlatformType;
				Architecture = InArchitecture;
				RequiredFile = InRequiredFile;
				ProjectType = InProjectType;
				bCanBeDisplayed = bInCanBeDisplayed;
			}
        /**
         * Return any custom paths for VisualStudio this platform requires
         * This include ReferencePath, LibraryPath, LibraryWPath, IncludePath and ExecutablePath.
         *
         *	@param	InPlatform			The UnrealTargetPlatform being built
         *	@param	TargetType			The type of target (game or program)
         *
         *	@return	string				The custom path lines for the project file; Empty string if it doesn't require one
         */
        public override string GetVisualStudioPathsEntries(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, TargetRules.TargetType TargetType, string TargetRulesPath, string ProjectFilePath, string NMakeOutputPath)
        {
            if (!IsNsightInstalled())
            {
                return base.GetVisualStudioPathsEntries(InPlatform, InConfiguration, TargetType, TargetRulesPath, ProjectFilePath, NMakeOutputPath);
            }

            // NOTE: We are intentionally overriding defaults for these paths with empty strings.  We never want Visual Studio's
            //       defaults for these fields to be propagated, since they are version-sensitive paths that may not reflect
            //       the environment that UBT is building in.  We'll set these environment variables ourselves!
            // NOTE: We don't touch 'ExecutablePath' because that would result in Visual Studio clobbering the system "Path"
            //       environment variable

            //@todo android: clean up debug path generation
            string GameName = Path.GetFileNameWithoutExtension(TargetRulesPath);
            GameName = Path.GetFileNameWithoutExtension(GameName);

            // intermediate path for Engine or Game's intermediate
            string IntermediateDirectoryPath;
            IntermediateDirectoryPath = Path.GetDirectoryName(NMakeOutputPath) + "/../../Intermediate/Android/APK";

            // string for <OverrideAPKPath>
            string APKPath = Path.Combine(
                Path.GetDirectoryName(NMakeOutputPath),
                Path.GetFileNameWithoutExtension(NMakeOutputPath) + "-armv7-es2.apk");

            // string for <BuildXmlPath> and <AndroidManifestPath>
            string BuildXmlPath = IntermediateDirectoryPath;
            string AndroidManifestPath = Path.Combine(IntermediateDirectoryPath, "AndroidManifest.xml");

            // string for <AdditionalLibraryDirectories>
            string AdditionalLibDirs = "";
            AdditionalLibDirs += IntermediateDirectoryPath + @"\obj\local\armeabi-v7a";
            AdditionalLibDirs += ";" + IntermediateDirectoryPath + @"\obj\local\x86";
            AdditionalLibDirs += @";$(AdditionalLibraryDirectories)";

            string PathsLines =
                "		<IncludePath />" + ProjectFileGenerator.NewLine +
                "		<ReferencePath />" + ProjectFileGenerator.NewLine +
                "		<LibraryPath />" + ProjectFileGenerator.NewLine +
                "		<LibraryWPath />" + ProjectFileGenerator.NewLine +
                "		<SourcePath />" + ProjectFileGenerator.NewLine +
                "		<ExcludePath />" + ProjectFileGenerator.NewLine +
                "		<AndroidAttach>False</AndroidAttach>" + ProjectFileGenerator.NewLine +
                "		<DebuggerFlavor>AndroidDebugger</DebuggerFlavor>" + ProjectFileGenerator.NewLine +
                "		<OverrideAPKPath>" + APKPath + "</OverrideAPKPath>" + ProjectFileGenerator.NewLine +
                "		<AdditionalLibraryDirectories>" + AdditionalLibDirs + "</AdditionalLibraryDirectories>" + ProjectFileGenerator.NewLine +
                "		<BuildXmlPath>" + BuildXmlPath + "</BuildXmlPath>" + ProjectFileGenerator.NewLine +
                "		<AndroidManifestPath>" + AndroidManifestPath + "</AndroidManifestPath>" + ProjectFileGenerator.NewLine;

            return PathsLines;
        }
		public TargetInfo(SerializationInfo Info, StreamingContext Context)
		{
			Platform = (UnrealTargetPlatform)Info.GetInt32("pl");
			Architecture = Info.GetString("ar");
			Configuration = (UnrealTargetConfiguration)Info.GetInt32("co");
			if (Info.GetBoolean("t?"))
			{
				Type = (TargetRules.TargetType)Info.GetInt32("tt");
			}
			if (Info.GetBoolean("m?"))
			{
				bIsMonolithic = Info.GetBoolean("mo");
			}
		}
示例#16
0
	static PhysXLibraryMode GetPhysXLibraryMode(UnrealTargetConfiguration Config)
	{
		switch (Config)
		{
			case UnrealTargetConfiguration.Debug:
				return PhysXLibraryMode.Debug;
			case UnrealTargetConfiguration.Shipping:
			case UnrealTargetConfiguration.Test:
				return PhysXLibraryMode.Shipping;
			case UnrealTargetConfiguration.Development:
			case UnrealTargetConfiguration.DebugGame:
			case UnrealTargetConfiguration.Unknown:
			default:
				return PhysXLibraryMode.Profile;
		}
	}
示例#17
0
        // NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
        //       program executable, so we want the application name to be the game name.  In the case of a modular
        //       binary, we use 'UnrealEngine' for our application name
        public UEBuildServer(
			string InGameName, 
			UnrealTargetPlatform InPlatform, 
			UnrealTargetConfiguration InConfiguration,
			TargetRules InRulesObject,
			List<string> InAdditionalDefinitions, 
			string InRemoteRoot, 
			List<OnlyModule> InOnlyModules)
            : base(InAppName:UEBuildTarget.GetBinaryBaseName(InGameName, InRulesObject, InPlatform, InConfiguration, "Server"),
				InGameName:InGameName,
				InPlatform:InPlatform,
				InConfiguration:InConfiguration,
				InRulesObject: InRulesObject, 
				InAdditionalDefinitions:InAdditionalDefinitions,
				InRemoteRoot:InRemoteRoot,
				InOnlyModules:InOnlyModules)
        {
        }
示例#18
0
		public UEBuildGame(
			string InGameName, 
			UnrealTargetPlatform InPlatform, 
			UnrealTargetConfiguration InConfiguration,
			TargetRules InRulesObject,
			List<string> InAdditionalDefinitions, 
			string InRemoteRoot, 
			List<OnlyModule> InOnlyModules,
			bool bInEditorRecompile)
			// NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
			//       program executable, so we want the application name to be the game name.  In the case of a modular
			//       binary, we use 'UnrealEngine' for our application name
			: base(
				InAppName: UEBuildTarget.GetBinaryBaseName(InGameName, InRulesObject, InPlatform, InConfiguration, ""),
				InGameName:InGameName,
				InPlatform:InPlatform,
				InConfiguration:InConfiguration,
				InRulesObject: InRulesObject, 
				InAdditionalDefinitions:InAdditionalDefinitions,
				InRemoteRoot:InRemoteRoot,
				InOnlyModules:InOnlyModules,
				bInEditorRecompile: bInEditorRecompile
			)
		{
			if (ShouldCompileMonolithic())
			{
				if ((UnrealBuildTool.IsDesktopPlatform(Platform) == false) ||
					(Platform == UnrealTargetPlatform.WinRT) ||
					(Platform == UnrealTargetPlatform.WinRT_ARM))
				{
					// We are compiling for a console...
					// We want the output to go into the <GAME>\Binaries folder
					if (InRulesObject.bOutputToEngineBinaries == false)
					{
						for (int Index = 0; Index < OutputPaths.Length; Index++)
						{
							OutputPaths[Index] = OutputPaths[Index].Replace("Engine\\Binaries", InGameName + "\\Binaries");
						}
					}
				}
			}
		}
 /// <summary>
 /// Return any custom paths for VisualStudio this platform requires
 /// This include ReferencePath, LibraryPath, LibraryWPath, IncludePath and ExecutablePath.
 /// </summary>
 /// <param name="InPlatform">The UnrealTargetPlatform being built</param>
 /// <param name="InConfiguration">The configuration being built</param>
 /// <param name="TargetType">The type of target (game or program)</param>
 /// <param name="TargetRulesPath">Path to the .target.cs file</param>
 /// <param name="ProjectFilePath"></param>
 /// <param name="NMakeOutputPath"></param>
 /// <param name="InProjectFileFormat">The visual studio project file format being generated</param>
 /// <param name="ProjectFileBuilder">String builder for the project file</param>
 /// <returns>The custom path lines for the project file; Empty string if it doesn't require one</returns>
 public virtual void GetVisualStudioPathsEntries(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, TargetType TargetType, FileReference TargetRulesPath, FileReference ProjectFilePath, FileReference NMakeOutputPath, VCProjectFileFormat InProjectFileFormat, StringBuilder ProjectFileBuilder)
 {
     // NOTE: We are intentionally overriding defaults for these paths with empty strings.  We never want Visual Studio's
     //       defaults for these fields to be propagated, since they are version-sensitive paths that may not reflect
     //       the environment that UBT is building in.  We'll set these environment variables ourselves!
     // NOTE: We don't touch 'ExecutablePath' because that would result in Visual Studio clobbering the system "Path"
     //       environment variable
     ProjectFileBuilder.AppendLine("    <IncludePath />");
     ProjectFileBuilder.AppendLine("    <ReferencePath />");
     ProjectFileBuilder.AppendLine("    <LibraryPath />");
     ProjectFileBuilder.AppendLine("    <LibraryWPath />");
     ProjectFileBuilder.AppendLine("    <SourcePath />");
     ProjectFileBuilder.AppendLine("    <ExcludePath />");
 }
示例#20
0
 public override void ResetBuildConfiguration(UnrealTargetConfiguration Configuration)
 {
     UEBuildConfiguration.bCompileICU = true;
 }
        /// <summary>
        /// Gets the standard path for an manifest
        /// </summary>
        /// <param name="DirectoryName">The directory containing this manifest</param>
        /// <param name="AppName">The modular app name being built</param>
        /// <param name="Configuration">The target configuration</param>
        /// <param name="Platform">The target platform</param>
        /// <param name="BuildArchitecture">The architecture of the target platform</param>
        /// <returns>Filename for the app receipt</returns>
        public static string GetStandardFileName(string AppName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string BuildArchitecture, bool bIsGameDirectory)
        {
            string BaseName = AppName;

            if (Configuration != UnrealTargetConfiguration.Development && !(Configuration == UnrealTargetConfiguration.DebugGame && !bIsGameDirectory))
            {
                BaseName += String.Format("-{0}-{1}", Platform.ToString(), Configuration.ToString());
            }
            return(String.Format("{0}{1}.modules", BaseName, BuildArchitecture));
        }
示例#22
0
 /// <summary>
 /// Whether this build platform has native support for VisualStudio
 /// </summary>
 /// <param name="InPlatform">  The UnrealTargetPlatform being built</param>
 /// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
 /// <param name="ProjectFileFormat"> Which version of VS</param>
 /// <returns>bool    true if native VisualStudio support (or custom VSI) is available</returns>
 public override bool HasVisualStudioSupport(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, VCProjectFileFormat ProjectFileFormat)
 {
     // TODO: Returning true from here is resulting in VS erroring out when trying to build a game project for Lumin.
     return(false);            //IsVSLuminSupportInstalled(ProjectFileFormat);
 }
        /// <summary>
        /// Creates a cache hierarchy for a particular target
        /// </summary>
        /// <param name="ProjectFile">Project file for the target being built</param>
        /// <param name="TargetName">Name of the target</param>
        /// <param name="Platform">Platform being built</param>
        /// <param name="Configuration">Configuration being built</param>
        /// <param name="TargetType">The target type</param>
        /// <returns>Dependency cache hierarchy for the given project</returns>
        public static CppDependencyCache CreateHierarchy(FileReference ProjectFile, string TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, TargetType TargetType)
        {
            CppDependencyCache Cache = null;

            if (ProjectFile == null || !UnrealBuildTool.IsEngineInstalled())
            {
                string AppName;
                if (TargetType == TargetType.Program)
                {
                    AppName = TargetName;
                }
                else
                {
                    AppName = UEBuildTarget.GetAppNameForTargetType(TargetType);
                }

                FileReference EngineCacheLocation = FileReference.Combine(UnrealBuildTool.EngineDirectory, "Intermediate", "Build", Platform.ToString(), AppName, Configuration.ToString(), "DependencyCache.bin");
                Cache = FindOrAddCache(EngineCacheLocation, UnrealBuildTool.EngineDirectory, Cache);
            }

            if (ProjectFile != null)
            {
                FileReference ProjectCacheLocation = FileReference.Combine(ProjectFile.Directory, "Intermediate", "Build", Platform.ToString(), TargetName, Configuration.ToString(), "DependencyCache.bin");
                Cache = FindOrAddCache(ProjectCacheLocation, ProjectFile.Directory, Cache);
            }

            return(Cache);
        }
示例#24
0
 public override void GenerateGameProperties(UnrealTargetConfiguration Configuration, StringBuilder VCProjectFileContent, TargetRules.TargetType TargetType, string RootDirectory, string TargetFilePath)
 {
     // @todo UWP: This used to be "WINUAP=1".  Need to verify that 'UWP' is the correct define that we want here.
     VCProjectFileContent.Append("		<NMakePreprocessorDefinitions>$(NMakePreprocessorDefinitions);PLATFORM_UWP=1;UWP=1;</NMakePreprocessorDefinitions>"+ ProjectFileGenerator.NewLine);
 }
示例#25
0
        /// <summary>
        /// Constructor taking optional params
        /// </summary>
        /// <param name="InType"></param>
        /// <param name="InPlatform"></param>
        /// <param name="InConfiguration"></param>
        /// <param name="InCommandLine"></param>
        /// <param name="InOptions"></param>
        public UnrealSessionRole(UnrealTargetRole InType, UnrealTargetPlatform?InPlatform, UnrealTargetConfiguration InConfiguration, string InCommandLine = null, IConfigOption <UnrealAppConfig> InOptions = null)
        {
            RoleType = InType;

            Platform      = InPlatform;
            Configuration = InConfiguration;
            MapOverride   = string.Empty;

            if (string.IsNullOrEmpty(InCommandLine))
            {
                CommandLine = string.Empty;
            }
            else
            {
                CommandLine = InCommandLine;
            }

            RequiredBuildFlags = BuildFlags.None;

            if (Globals.Params.ParseParam("dev") && !RoleType.UsesEditor())
            {
                RequiredBuildFlags |= BuildFlags.CanReplaceExecutable;
            }

            //@todo: for bulk/packaged builds, we should mark the platform as capable of these as we're catching global and not test specific flags
            // where we may be running parallel tests on multiple platforms
            if (InPlatform == UnrealTargetPlatform.Android || InPlatform == UnrealTargetPlatform.IOS)
            {
                if (Globals.Params.ParseParam("bulk"))
                {
                    RequiredBuildFlags |= BuildFlags.Bulk;
                }
                else
                {
                    RequiredBuildFlags |= BuildFlags.NotBulk;
                }
            }

            if (Globals.Params.ParseParam("packaged") && (InPlatform == UnrealTargetPlatform.Switch || InPlatform == UnrealTargetPlatform.XboxOne || InPlatform == UnrealTargetPlatform.PS4))
            {
                RequiredBuildFlags |= BuildFlags.Packaged;
            }


            Options      = InOptions;
            FilesToCopy  = new List <UnrealFileToCopy>();
            RoleModifier = ERoleModifier.None;
        }
示例#26
0
    void CompilePluginWithUBT(FileReference HostProjectFile, FileReference HostProjectPluginFile, PluginDescriptor Plugin, string TargetName, TargetType TargetType, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, List <FileReference> ReceiptFileNames, string InAdditionalArgs)
    {
        // Find a list of modules that need to be built for this plugin
        bool bCompilePlatform = false;

        if (Plugin.Modules != null)
        {
            foreach (ModuleDescriptor Module in Plugin.Modules)
            {
                bool bBuildDeveloperTools     = (TargetType == TargetType.Editor || TargetType == TargetType.Program);
                bool bBuildEditor             = (TargetType == TargetType.Editor);
                bool bBuildRequiresCookedData = (TargetType != TargetType.Editor && TargetType != TargetType.Program);
                if (Module.IsCompiledInConfiguration(Platform, Configuration, TargetType, bBuildDeveloperTools, bBuildEditor, bBuildRequiresCookedData))
                {
                    bCompilePlatform = true;
                }
            }
        }

        // Add these modules to the build agenda
        if (bCompilePlatform)
        {
            string Architecture = PlatformExports.GetDefaultArchitecture(Platform, HostProjectFile);

            FileReference ReceiptFileName = TargetReceipt.GetDefaultPath(HostProjectPluginFile.Directory, TargetName, Platform, Configuration, Architecture);
            ReceiptFileNames.Add(ReceiptFileName);

            string Arguments = String.Format("-plugin={0} -iwyu -precompile -nosharedpch -noubtmakefiles -receipt={1}", CommandUtils.MakePathSafeToUseWithCommandLine(HostProjectPluginFile.FullName), CommandUtils.MakePathSafeToUseWithCommandLine(ReceiptFileName.FullName));
            if (!String.IsNullOrEmpty(InAdditionalArgs))
            {
                Arguments += InAdditionalArgs;
            }

            CommandUtils.RunUBT(CmdEnv, UE4Build.GetUBTExecutable(), String.Format("{0} {1} {2} {3}", TargetName, Platform, Configuration, Arguments));
        }
    }
示例#27
0
 /// <summary>
 /// Constructor taking limited params
 /// </summary>
 /// <param name="InType"></param>
 /// <param name="InPlatform"></param>
 /// <param name="InConfiguration"></param>
 /// <param name="InOptions"></param>
 public UnrealSessionRole(UnrealTargetRole InType, UnrealTargetPlatform?InPlatform, UnrealTargetConfiguration InConfiguration, IConfigOption <UnrealAppConfig> InOptions)
     : this(InType, InPlatform, InConfiguration, null, InOptions)
 {
 }
示例#28
0
 public override bool ShouldCompileMonolithic(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
 {
     return(true);
 }
示例#29
0
 ///
 ///	VisualStudio project generation functions
 ///
 /// <summary>
 /// Whether this build platform has native support for VisualStudio
 /// </summary>
 /// <param name="InPlatform">  The UnrealTargetPlatform being built</param>
 /// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
 /// <param name="ProjectFileFormat"></param>
 /// <returns>bool    true if native VisualStudio support (or custom VSI) is available</returns>
 public override bool HasVisualStudioSupport(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, VCProjectFileFormat ProjectFileFormat)
 {
     return(false);
 }
示例#30
0
    public static void Build(BuildCommand Command, ProjectParams Params, int WorkingCL = -1, ProjectBuildTargets TargetMask = ProjectBuildTargets.All)
    {
        Params.ValidateAndLog();

        if (!Params.Build)
        {
            return;
        }

        Log("********** BUILD COMMAND STARTED **********");

        var UE4Build             = new UE4Build(Command);
        var Agenda               = new UE4Build.BuildAgenda();
        var CrashReportPlatforms = new HashSet <UnrealTargetPlatform>();

        // Setup editor targets
        if (Params.HasEditorTargets && !Params.Rocket && (TargetMask & ProjectBuildTargets.Editor) == ProjectBuildTargets.Editor)
        {
            // @todo Mac: proper platform detection
            UnrealTargetPlatform            EditorPlatform      = HostPlatform.Current.HostEditorPlatform;
            const UnrealTargetConfiguration EditorConfiguration = UnrealTargetConfiguration.Development;

            CrashReportPlatforms.Add(EditorPlatform);
            Agenda.AddTargets(Params.EditorTargets.ToArray(), EditorPlatform, EditorConfiguration, Params.CodeBasedUprojectPath);
            if (Params.EditorTargets.Contains("UnrealHeaderTool") == false)
            {
                Agenda.AddTargets(new string[] { "UnrealHeaderTool" }, EditorPlatform, EditorConfiguration);
            }
            if (Params.EditorTargets.Contains("ShaderCompileWorker") == false)
            {
                Agenda.AddTargets(new string[] { "ShaderCompileWorker" }, EditorPlatform, EditorConfiguration);
            }
            if (Params.Pak && Params.EditorTargets.Contains("UnrealPak") == false)
            {
                Agenda.AddTargets(new string[] { "UnrealPak" }, EditorPlatform, EditorConfiguration);
            }
            if (Params.FileServer && Params.EditorTargets.Contains("UnrealFileServer") == false)
            {
                Agenda.AddTargets(new string[] { "UnrealFileServer" }, EditorPlatform, EditorConfiguration);
            }
        }

        string ScriptPluginArgs = "";

        // if we're utilizing an auto-generated code plugin/module (a product of
        // the cook process), make sure to compile it along with the targets here
        if (Params.UseNativizedScriptPlugin())
        {
            ScriptPluginArgs = "-PLUGIN \"" + Params.NativizedScriptPlugin + "\"";
        }

        // Setup cooked targets
        if (Params.HasClientCookedTargets && (TargetMask & ProjectBuildTargets.ClientCooked) == ProjectBuildTargets.ClientCooked)
        {
            foreach (var BuildConfig in Params.ClientConfigsToBuild)
            {
                foreach (var ClientPlatform in Params.ClientTargetPlatforms)
                {
                    CrashReportPlatforms.Add(ClientPlatform);
                    Agenda.AddTargets(Params.ClientCookedTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: ScriptPluginArgs + " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\"");
                }
            }
        }
        if (Params.HasServerCookedTargets && (TargetMask & ProjectBuildTargets.ServerCooked) == ProjectBuildTargets.ServerCooked)
        {
            foreach (var BuildConfig in Params.ServerConfigsToBuild)
            {
                foreach (var ServerPlatform in Params.ServerTargetPlatforms)
                {
                    CrashReportPlatforms.Add(ServerPlatform);
                    Agenda.AddTargets(Params.ServerCookedTargets.ToArray(), ServerPlatform, BuildConfig, Params.CodeBasedUprojectPath, InAddArgs: ScriptPluginArgs + " -remoteini=\"" + Params.RawProjectPath.Directory.FullName + "\"");
                }
            }
        }
        if (!Params.NoBootstrapExe && !Params.Rocket && (TargetMask & ProjectBuildTargets.Bootstrap) == ProjectBuildTargets.Bootstrap)
        {
            UnrealBuildTool.UnrealTargetPlatform[] BootstrapPackagedGamePlatforms = { UnrealBuildTool.UnrealTargetPlatform.Win32, UnrealBuildTool.UnrealTargetPlatform.Win64 };
            foreach (UnrealBuildTool.UnrealTargetPlatform BootstrapPackagedGamePlatform in BootstrapPackagedGamePlatforms)
            {
                if (Params.ClientTargetPlatforms.Contains(BootstrapPackagedGamePlatform))
                {
                    Agenda.AddTarget("BootstrapPackagedGame", BootstrapPackagedGamePlatform, UnrealBuildTool.UnrealTargetConfiguration.Shipping);
                }
            }
        }
        if (Params.CrashReporter && !Params.Rocket && (TargetMask & ProjectBuildTargets.CrashReporter) == ProjectBuildTargets.CrashReporter)
        {
            foreach (var CrashReportPlatform in CrashReportPlatforms)
            {
                if (UnrealBuildTool.UnrealBuildTool.PlatformSupportsCrashReporter(CrashReportPlatform))
                {
                    Agenda.AddTarget("CrashReportClient", CrashReportPlatform, UnrealTargetConfiguration.Shipping);
                }
            }
        }
        if (Params.HasProgramTargets && !Params.Rocket && (TargetMask & ProjectBuildTargets.Programs) == ProjectBuildTargets.Programs)
        {
            foreach (var BuildConfig in Params.ClientConfigsToBuild)
            {
                foreach (var ClientPlatform in Params.ClientTargetPlatforms)
                {
                    Agenda.AddTargets(Params.ProgramTargets.ToArray(), ClientPlatform, BuildConfig, Params.CodeBasedUprojectPath);
                }
            }
        }
        UE4Build.Build(Agenda, InDeleteBuildProducts: Params.Clean, InUpdateVersionFiles: WorkingCL > 0);

        if (WorkingCL > 0)         // only move UAT files if we intend to check in some build products
        {
            UE4Build.AddUATFilesToBuildProducts();
        }
        UE4Build.CheckBuildProducts(UE4Build.BuildProductFiles);

        if (WorkingCL > 0)
        {
            // Sign everything we built
            CodeSign.SignMultipleIfEXEOrDLL(Command, UE4Build.BuildProductFiles);

            // Open files for add or edit
            UE4Build.AddBuildProductsToChangelist(WorkingCL, UE4Build.BuildProductFiles);
        }

        Log("********** BUILD COMMAND COMPLETED **********");
    }
 /// <summary>
 /// Return any custom layout directory sections
 /// </summary>
 /// <param name="InPlatform">The UnrealTargetPlatform being built</param>
 /// <param name="InConfiguration">The configuration being built</param>
 /// <param name="InConditionString"></param>
 /// <param name="TargetType">The type of target (game or program)</param>
 /// <param name="InProjectFileFormat">The visual studio project file format being generated</param>
 /// <param name="NMakeOutputPath"></param>
 /// <param name="ProjectFilePath"></param>
 /// <param name="TargetRulesPath"></param>
 /// <returns>string    The custom property import lines for the project file; Empty string if it doesn't require one</returns>
 public virtual string GetVisualStudioLayoutDirSection(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, string InConditionString, TargetType TargetType, FileReference TargetRulesPath, FileReference ProjectFilePath, FileReference NMakeOutputPath, VCProjectFileFormat InProjectFileFormat)
 {
     return("");
 }
示例#32
0
 public override void ResetBuildConfiguration(UnrealTargetConfiguration InConfiguration)
 {
     base.ResetBuildConfiguration(InConfiguration);
     // @todo tvos: change what is compiled here
 }
示例#33
0
        ///
        ///	VisualStudio project generation functions
        ///

        /**
         *	Whether this build platform has native support for VisualStudio
         *
         *	@param	InPlatform			The UnrealTargetPlatform being built
         *	@param	InConfiguration		The UnrealTargetConfiguration being built
         *
         *	@return	bool				true if native VisualStudio support (or custom VSI) is available
         */
        public override bool HasVisualStudioSupport(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
        {
            return(false);
        }
示例#34
0
 /// <summary>
 /// Return the platform toolset string to write into the project configuration
 /// </summary>
 /// <param name="InPlatform">  The UnrealTargetPlatform being built</param>
 /// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
 /// <param name="InProjectFileFormat"> The verison of VS</param>
 /// <param name="ProjectFileBuilder">String builder for the project file</param>
 /// <returns>string    The custom configuration section for the project file; Empty string if it doesn't require one</returns>
 public override void GetVisualStudioPlatformToolsetString(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, VCProjectFileFormat InProjectFileFormat, StringBuilder ProjectFileBuilder)
 {
     VCProjectFileGenerator.AppendPlatformToolsetProperty(ProjectFileBuilder, InProjectFileFormat);
 }
		/// <summary>
		/// Return the VisualStudio platform name for this build platform
		/// </summary>
		/// <param name="InPlatform">  The UnrealTargetPlatform being built</param>
		/// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
		/// <returns>string    The name of the platform that VisualStudio recognizes</returns>
		public virtual string GetVisualStudioPlatformName(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
		{
			// By default, return the platform string
			return InPlatform.ToString();
		}
示例#36
0
        /// <summary>
        /// Return any custom paths for VisualStudio this platform requires
        /// This include ReferencePath, LibraryPath, LibraryWPath, IncludePath and ExecutablePath.
        /// </summary>
        /// <param name="InPlatform">The UnrealTargetPlatform being built</param>
        /// <param name="InConfiguration">The configuration being built</param>
        /// <param name="TargetType">The type of target (game or program)</param>
        /// <param name="TargetRulesPath">Path to the target.cs file</param>
        /// <param name="ProjectFilePath">Path to the project file</param>
        /// <param name="NMakeOutputPath"></param>
        /// <param name="InProjectFileFormat">Format for the generated project files</param>
        /// <param name="ProjectFileBuilder">The project file content</param>
        /// <returns>The custom path lines for the project file; Empty string if it doesn't require one</returns>
        public override void GetVisualStudioPathsEntries(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, TargetType TargetType, FileReference TargetRulesPath, FileReference ProjectFilePath, FileReference NMakeOutputPath, VCProjectFileFormat InProjectFileFormat, StringBuilder ProjectFileBuilder)
        {
            base.GetVisualStudioPathsEntries(InPlatform, InConfiguration, TargetType, TargetRulesPath, ProjectFilePath, NMakeOutputPath, InProjectFileFormat, ProjectFileBuilder);

            if (IsVSLuminSupportInstalled(InProjectFileFormat) && TargetType == TargetType.Game && InPlatform == UnrealTargetPlatform.Lumin)
            {
                // When generating for a blueprint only project, use the blueprint only project's path to generate the visual studio path entries
                bool bGetEntriesForBlueprintOnlyProject = BPOnlyProjectPath != null;

                string MLSDK = Utils.CleanDirectorySeparators(Environment.GetEnvironmentVariable("MLSDK"), '\\');

                string GameName = bGetEntriesForBlueprintOnlyProject ? BPOnlyProjectPath.GetFileNameWithoutExtension() : TargetRulesPath.GetFileNameWithoutExtension();
                GameName = Path.GetFileNameWithoutExtension(GameName);

                string PackagePath = bGetEntriesForBlueprintOnlyProject ? BPOnlyProjectPath.Directory.FullName + "\\Binaries\\Lumin" : Utils.MakePathRelativeTo(NMakeOutputPath.Directory.FullName, ProjectFilePath.Directory.FullName);
                string PackageFile = PackagePath;
                string PackageName = GameName;
                if (InConfiguration != UnrealTargetConfiguration.Development)
                {
                    PackageName = GameName + "-" + InPlatform.ToString() + "-" + InConfiguration.ToString();
                }
                PackageFile = Path.Combine(PackageFile, PackageName + ".mpk");

                // Can't use $(NMakeOutput) directly since that is defined after <ELFFile> tag and thus ends up being translated as an empty string.
                string ELFFile = bGetEntriesForBlueprintOnlyProject ? PackagePath : Utils.MakePathRelativeTo(NMakeOutputPath.Directory.FullName, ProjectFilePath.Directory.FullName);
                // Provide path to stripped executable so all symbols are resolved from the external sym file instead.
                ELFFile = Path.Combine(ELFFile, "..\\..\\Intermediate\\Lumin\\Mabu\\Binaries", GetElfName(NMakeOutputPath));
                string DebuggerFlavor = "MLDebugger";

                string SymFile = Utils.MakePathRelativeTo(NMakeOutputPath.Directory.FullName, ProjectFilePath.Directory.FullName);
                SymFile = Path.Combine(SymFile, "..\\..\\Intermediate\\Lumin\\Mabu\\Binaries", Path.ChangeExtension(GetElfName(NMakeOutputPath), ".sym"));

                // following are defaults for debugger options
                string Attach               = "false";
                string EnableAutoStop       = "true";
                string AutoStopAtFunction   = "main";
                string EnablePrettyPrinting = "true";
                string MLDownloadOnStart    = "true";

                string CustomPathEntriesTemplate = "<MLSDK>{0}</MLSDK>" + ProjectFileGenerator.NewLine +
                                                   "<PackageFile>{1}</PackageFile>" + ProjectFileGenerator.NewLine +
                                                   "<ELFFile>{2}</ELFFile>" + ProjectFileGenerator.NewLine +
                                                   "<DebuggerFlavor>{3}</DebuggerFlavor>" + ProjectFileGenerator.NewLine +
                                                   "<Attach>{4}</Attach>" + ProjectFileGenerator.NewLine +
                                                   "<EnableAutoStop>{5}</EnableAutoStop>" + ProjectFileGenerator.NewLine +
                                                   "<AutoStopAtFunction>{6}</AutoStopAtFunction>" + ProjectFileGenerator.NewLine +
                                                   "<EnablePrettyPrinting>{7}</EnablePrettyPrinting>" + ProjectFileGenerator.NewLine +
                                                   "<MLDownloadOnStart>{8}</MLDownloadOnStart>" + ProjectFileGenerator.NewLine;
                // No need to provide SymFile path. The file is automatically picked up when it resides in the same folder and has the same name as the ElfFile
                // "<SymFile>{9}</SymFile>" + ProjectFileGenerator.NewLine;
                ProjectFileBuilder.Append(ProjectFileGenerator.NewLine + string.Format(CustomPathEntriesTemplate, MLSDK, PackageFile, ELFFile, DebuggerFlavor, Attach, EnableAutoStop, AutoStopAtFunction, EnablePrettyPrinting, MLDownloadOnStart));
            }
        }
示例#37
0
 public override void ResetBuildConfiguration(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
 {
     UEBuildConfiguration.bCompileICU = true;
     if (InPlatform == UnrealTargetPlatform.Win32)
     {
         SetupXPSupportFromConfiguration();
     }
 }
		/// <summary>
		/// Return any custom paths for VisualStudio this platform requires
		/// This include ReferencePath, LibraryPath, LibraryWPath, IncludePath and ExecutablePath.
		/// </summary>
		/// <param name="InPlatform">  The UnrealTargetPlatform being built</param>
		/// <param name="TargetType">  The type of target (game or program)</param>
		/// <returns>string    The custom path lines for the project file; Empty string if it doesn't require one</returns>
		public virtual string GetVisualStudioPathsEntries(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, TargetRules.TargetType TargetType, FileReference TargetRulesPath, FileReference ProjectFilePath, FileReference NMakeOutputPath)
		{
			// NOTE: We are intentionally overriding defaults for these paths with empty strings.  We never want Visual Studio's
			//       defaults for these fields to be propagated, since they are version-sensitive paths that may not reflect
			//       the environment that UBT is building in.  We'll set these environment variables ourselves!
			// NOTE: We don't touch 'ExecutablePath' because that would result in Visual Studio clobbering the system "Path"
			//       environment variable
			string PathsLines =
				"		<IncludePath />\n" +
				"		<ReferencePath />\n" +
				"		<LibraryPath />\n" +
				"		<LibraryWPath />\n" +
				"		<SourcePath />\n" +
				"		<ExcludePath />\n";

			return PathsLines;
		}
    private void PackageIPA(string BaseDirectory, string GameName, string ProjectName, string ProjectDirectory, UnrealTargetConfiguration TargetConfig, bool Distribution = false)
    {
        // create the ipa
        string IPAName = CombinePaths(ProjectDirectory, "Binaries", "IOS", (Distribution ? "Distro_" : "") + ProjectName + (TargetConfig != UnrealTargetConfiguration.Development ? ("-IOS-" + TargetConfig.ToString()) : "") + ".ipa");

        // delete the old one
        if (File.Exists(IPAName))
        {
            File.Delete(IPAName);
        }

        // make the subdirectory if needed
        string DestSubdir = Path.GetDirectoryName(IPAName);

        if (!Directory.Exists(DestSubdir))
        {
            Directory.CreateDirectory(DestSubdir);
        }

        // set up the directories
        string ZipWorkingDir = String.Format("Payload/{0}.app/", GameName);
        string ZipSourceDir  = string.Format("{0}/Payload/{1}.app", BaseDirectory, GameName);

        // create the file
        using (ZipFile Zip = new ZipFile())
        {
            // Set encoding to support unicode filenames
            Zip.AlternateEncodingUsage = ZipOption.Always;
            Zip.AlternateEncoding      = Encoding.UTF8;

            // set the compression level
            if (Distribution)
            {
                Zip.CompressionLevel = CompressionLevel.BestCompression;
            }

            // add the entire directory
            Zip.AddDirectory(ZipSourceDir, ZipWorkingDir);

            // Update permissions to be UNIX-style
            // Modify the file attributes of any added file to unix format
            foreach (ZipEntry E in Zip.Entries)
            {
                const byte FileAttributePlatform_NTFS = 0x0A;
                const byte FileAttributePlatform_UNIX = 0x03;
                const byte FileAttributePlatform_FAT  = 0x00;

                const int UNIX_FILETYPE_NORMAL_FILE = 0x8000;
                //const int UNIX_FILETYPE_SOCKET = 0xC000;
                //const int UNIX_FILETYPE_SYMLINK = 0xA000;
                //const int UNIX_FILETYPE_BLOCKSPECIAL = 0x6000;
                const int UNIX_FILETYPE_DIRECTORY = 0x4000;
                //const int UNIX_FILETYPE_CHARSPECIAL = 0x2000;
                //const int UNIX_FILETYPE_FIFO = 0x1000;

                const int UNIX_EXEC  = 1;
                const int UNIX_WRITE = 2;
                const int UNIX_READ  = 4;


                int MyPermissions    = UNIX_READ | UNIX_WRITE;
                int OtherPermissions = UNIX_READ;

                int PlatformEncodedBy = (E.VersionMadeBy >> 8) & 0xFF;
                int LowerBits         = 0;

                // Try to preserve read-only if it was set
                bool bIsDirectory = E.IsDirectory;

                // Check to see if this
                bool bIsExecutable = false;
                if (Path.GetFileNameWithoutExtension(E.FileName).Equals(GameName, StringComparison.InvariantCultureIgnoreCase))
                {
                    bIsExecutable = true;
                }

                if (bIsExecutable)
                {
                    // The executable will be encrypted in the final distribution IPA and will compress very poorly, so keeping it
                    // uncompressed gives a better indicator of IPA size for our distro builds
                    E.CompressionLevel = CompressionLevel.None;
                }

                if ((PlatformEncodedBy == FileAttributePlatform_NTFS) || (PlatformEncodedBy == FileAttributePlatform_FAT))
                {
                    FileAttributes OldAttributes = E.Attributes;
                    //LowerBits = ((int)E.Attributes) & 0xFFFF;

                    if ((OldAttributes & FileAttributes.Directory) != 0)
                    {
                        bIsDirectory = true;
                    }

                    // Permissions
                    if ((OldAttributes & FileAttributes.ReadOnly) != 0)
                    {
                        MyPermissions    &= ~UNIX_WRITE;
                        OtherPermissions &= ~UNIX_WRITE;
                    }
                }

                if (bIsDirectory || bIsExecutable)
                {
                    MyPermissions    |= UNIX_EXEC;
                    OtherPermissions |= UNIX_EXEC;
                }

                // Re-jigger the external file attributes to UNIX style if they're not already that way
                if (PlatformEncodedBy != FileAttributePlatform_UNIX)
                {
                    int NewAttributes = bIsDirectory ? UNIX_FILETYPE_DIRECTORY : UNIX_FILETYPE_NORMAL_FILE;

                    NewAttributes |= (MyPermissions << 6);
                    NewAttributes |= (OtherPermissions << 3);
                    NewAttributes |= (OtherPermissions << 0);

                    // Now modify the properties
                    E.AdjustExternalFileAttributes(FileAttributePlatform_UNIX, (NewAttributes << 16) | LowerBits);
                }
            }

            // Save it out
            Zip.Save(IPAName);
        }
    }
		/// <summary>
		/// Get whether this platform deploys
		/// </summary>
		/// <returns>bool  true if the 'Deploy' option should be enabled</returns>
		public virtual bool GetVisualStudioDeploymentEnabled(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
		{
			return false;
		}
    private void CodeSign(string BaseDirectory, string GameName, string RawProjectPath, UnrealTargetConfiguration TargetConfig, string LocalRoot, string ProjectName, string ProjectDirectory, bool IsCode, bool Distribution = false, string Provision = null, string Certificate = null, string SchemeName = null, string SchemeConfiguration = null)
    {
        // check for the proper xcodeproject
        bool   bWasGenerated = false;
        string XcodeProj     = EnsureXcodeProjectExists(RawProjectPath, LocalRoot, ProjectName, ProjectDirectory, IsCode, out bWasGenerated);

        string Arguments = "UBT_NO_POST_DEPLOY=true";

        Arguments += " /usr/bin/xcrun xcodebuild build -workspace \"" + XcodeProj + "\"";
        Arguments += " -scheme '";
        Arguments += SchemeName != null ? SchemeName : GameName;
        Arguments += "'";
        Arguments += " -configuration \"" + (SchemeConfiguration != null ? SchemeConfiguration : TargetConfig.ToString()) + "\"";
        Arguments += " -destination generic/platform=iOS";
        Arguments += " -sdk iphoneos";
        if (!string.IsNullOrEmpty(Certificate))
        {
            Arguments += " CODE_SIGN_IDENTITY=\"" + Certificate + "\"";
        }
        else
        {
            Arguments += " CODE_SIGN_IDENTITY=" + (Distribution ? "\"iPhone Distribution\"" : "\"iPhone Developer\"");
        }
        if (!string.IsNullOrEmpty(Provision))
        {
            // read the provision to get the UUID
            if (File.Exists(Environment.GetEnvironmentVariable("HOME") + "/Library/MobileDevice/Provisioning Profiles/" + Provision))
            {
                string UUID    = "";
                string AllText = File.ReadAllText(Environment.GetEnvironmentVariable("HOME") + "/Library/MobileDevice/Provisioning Profiles/" + Provision);
                int    idx     = AllText.IndexOf("<key>UUID</key>");
                if (idx > 0)
                {
                    idx = AllText.IndexOf("<string>", idx);
                    if (idx > 0)
                    {
                        idx       += "<string>".Length;
                        UUID       = AllText.Substring(idx, AllText.IndexOf("</string>", idx) - idx);
                        Arguments += " PROVISIONING_PROFILE=" + UUID;
                    }
                }
            }
        }
        ProcessResult Result = Run("/usr/bin/env", Arguments, null, ERunOptions.Default);

        if (bWasGenerated)
        {
            InternalUtils.SafeDeleteDirectory(XcodeProj, true);
        }
        if (Result.ExitCode != 0)
        {
            throw new AutomationException(ErrorCodes.Error_FailedToCodeSign, "CodeSign Failed");
        }
    }
示例#42
0
        /// <summary>
        /// Checks to see if the specified solution platform and configuration is able to map to this project
        /// </summary>
        /// <param name="ProjectTarget">The target that we're checking for a valid platform/config combination</param>
        /// <param name="Platform">Platform</param>
        /// <param name="Configuration">Configuration</param>
        /// <returns>True if this is a valid combination for this project, otherwise false</returns>
        public static bool IsValidProjectPlatformAndConfiguration(ProjectTarget ProjectTarget, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration)
        {
            var PlatformProjectGenerator = UEPlatformProjectGenerator.GetPlatformProjectGenerator(Platform, true);
            if (PlatformProjectGenerator == null)
            {
                return false;
            }

            UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform, true);
            if (BuildPlatform == null)
            {
                return false;
            }

            if (BuildPlatform.HasRequiredSDKsInstalled() == false)
            {
                return false;
            }

            var SupportedConfigurations = new List<UnrealTargetConfiguration>();
            var SupportedPlatforms = new List<UnrealTargetPlatform>();
            if (!ProjectFileGenerator.bCreateDummyConfigsForUnsupportedPlatforms || ProjectFileGenerator.bGeneratingRocketProjectFiles)
            {
                if( ProjectTarget.TargetRules != null )
                {
                    ProjectTarget.TargetRules.GetSupportedPlatforms(ref SupportedPlatforms);
                }
            }
            else
            {
                UnrealBuildTool.GetAllPlatforms(ref SupportedPlatforms);
            }
            bool bIncludeTestAndShippingConfigs = ProjectFileGenerator.bIncludeTestAndShippingConfigs || ProjectFileGenerator.bGeneratingRocketProjectFiles;
            if( ProjectTarget.TargetRules != null )
            {
                // Rocket projects always get shipping configs
                ProjectTarget.TargetRules.GetSupportedConfigurations(ref SupportedConfigurations, bIncludeTestAndShippingConfigs:bIncludeTestAndShippingConfigs);
            }

            // Add all of the extra platforms/configurations for this target
            {
                foreach( var ExtraPlatform in ProjectTarget.ExtraSupportedPlatforms )
                {
                    if( !SupportedPlatforms.Contains( ExtraPlatform ) )
                    {
                        SupportedPlatforms.Add( ExtraPlatform );
                    }
                }
                foreach( var ExtraConfig in ProjectTarget.ExtraSupportedConfigurations )
                {
                    if( bIncludeTestAndShippingConfigs || ( ExtraConfig != UnrealTargetConfiguration.Shipping && ExtraConfig != UnrealTargetConfiguration.Test ) )
                    {
                        if( !SupportedConfigurations.Contains( ExtraConfig ) )
                        {
                            SupportedConfigurations.Add( ExtraConfig );
                        }
                    }
                }
            }

            // Only build for supported platforms
            if (SupportedPlatforms.Contains(Platform) == false)
            {
                return false;
            }

            // Only build for supported configurations
            if (SupportedConfigurations.Contains(Configuration) == false)
            {
                return false;
            }

            // For Rocket projects, we currently only allow 64-bit versions of Debug and Development binaries to be compiled
            // and only 32-bit versions of Shipping binaries to be compiled.  This has to do with our choice of which build
            // configurations we want to ship with that product.  So to simplify things, we're merging Win32 and Win64
            // configurations together in the IDE under "Windows".  In order for this to work properly, we need to make
            // sure that Rocket projects only report the respective Windows platform that is valid for each configuration
            if( UnrealBuildTool.RunningRocket() && ProjectTarget.TargetRules != null )
            {
                if( Platform == UnrealTargetPlatform.Win32 || Platform == UnrealTargetPlatform.Win64 )
                {
                    // In Rocket, shipping game targets are always 32-bit
                    if( Configuration == UnrealTargetConfiguration.Shipping && ProjectTarget.TargetRules.Type == TargetRules.TargetType.RocketGame )
                    {
                        if( Platform != UnrealTargetPlatform.Win32 )
                        {
                            return false;
                        }
                    }
                    else
                    {
                        // Everything else is expecting to be 64-bit
                        if( Platform != UnrealTargetPlatform.Win64 )
                        {
                            return false;
                        }
                    }
                }
            }

            return true;
        }
示例#43
0
        // Anonymous function that writes project configuration data
        private void WriteConfiguration(string ProjectName, UnrealTargetConfiguration Configuration, UnrealTargetPlatform Platform, string TargetFilePath, TargetRules TargetRulesObject, StringBuilder VCProjectFileContent, StringBuilder VCUserFileContent)
        {
            UEPlatformProjectGenerator ProjGenerator = UEPlatformProjectGenerator.GetPlatformProjectGenerator(Platform, true);
            if (((ProjGenerator == null) && (Platform != UnrealTargetPlatform.Unknown)))
            {
                return;
            }

            string UProjectPath = "";
            bool bIsProjectTarget = UnrealBuildTool.HasUProjectFile() && Utils.IsFileUnderDirectory(TargetFilePath, UnrealBuildTool.GetUProjectPath());

            // @todo Rocket: HACK: Only use long project names on the UBT command-line for out-of-root projects for now.  We need to revisit all uses of HasUProjectFile and short names in general to fix this.
            if (bIsProjectTarget && !UnrealBuildTool.RunningRocket() && Utils.IsFileUnderDirectory(UnrealBuildTool.GetUProjectFile(), ProjectFileGenerator.RootRelativePath))
            {
                bIsProjectTarget = false;
            }

            if (bIsProjectTarget)
            {
                UProjectPath = "\"$(SolutionDir)$(SolutionName).uproject\"";
            }

            string ProjectConfigName = StubProjectConfigurationName;
            string ProjectPlatformName = StubProjectPlatformName;
            MakeProjectPlatformAndConfigurationNames(Platform, Configuration, TargetRulesObject.ConfigurationName, out ProjectPlatformName, out ProjectConfigName);
            var ConfigAndPlatformName = ProjectConfigName + "|" + ProjectPlatformName;
            string ConditionString = "Condition=\"'$(Configuration)|$(Platform)'=='" + ConfigAndPlatformName + "'\"";

            {
                VCProjectFileContent.Append(
                    "	<ImportGroup " + ConditionString + " Label=\"PropertySheets\">" + ProjectFileGenerator.NewLine +
                    "		<Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />" + ProjectFileGenerator.NewLine +
                    "	</ImportGroup>" + ProjectFileGenerator.NewLine);

                VCProjectFileContent.Append(
                    "	<PropertyGroup " + ConditionString + ">" + ProjectFileGenerator.NewLine);

                if (IsStubProject)
                {
                    string ProjectRelativeUnusedDirectory = NormalizeProjectPath(Path.Combine(ProjectFileGenerator.EngineRelativePath, BuildConfiguration.BaseIntermediateFolder, "Unused"));

                    VCProjectFileContent.Append(
                        "		<OutDir></OutDir>" + ProjectFileGenerator.NewLine +
                        "		<IntDir>" + ProjectRelativeUnusedDirectory + Path.DirectorySeparatorChar + "</IntDir>" + ProjectFileGenerator.NewLine +
                        "		<NMakeBuildCommandLine/>" + ProjectFileGenerator.NewLine +
                        "		<NMakeReBuildCommandLine/>" + ProjectFileGenerator.NewLine +
                        "		<NMakeCleanCommandLine/>" + ProjectFileGenerator.NewLine +
                        "		<NMakeOutput/>" + ProjectFileGenerator.NewLine);
                }
                else
                {
                    string TargetName = Utils.GetFilenameWithoutAnyExtensions(TargetFilePath);
                    var UBTPlatformName = IsStubProject ? StubProjectPlatformName : Platform.ToString();
                    var UBTConfigurationName = IsStubProject ? StubProjectConfigurationName : Configuration.ToString();

                    // Setup output path
                    UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform);

                    // Figure out if this is a monolithic build
                    bool bShouldCompileMonolithic = BuildPlatform.ShouldCompileMonolithicBinary(Platform);
                    bShouldCompileMonolithic |= TargetRulesObject.ShouldCompileMonolithic(Platform, Configuration);

                    // Get the output directory
                    string RootDirectory = Path.GetFullPath(ProjectFileGenerator.EngineRelativePath);
                    if ((TargetRules.IsAGame(TargetRulesObject.Type) || TargetRulesObject.Type == TargetRules.TargetType.Server) && bShouldCompileMonolithic && !TargetRulesObject.bOutputToEngineBinaries)
                    {
                        if (UnrealBuildTool.HasUProjectFile() && Utils.IsFileUnderDirectory(TargetFilePath, UnrealBuildTool.GetUProjectPath()))
                        {
                            RootDirectory = Path.GetFullPath(UnrealBuildTool.GetUProjectPath());
                        }
                        else
                        {
                            string UnrealProjectPath = UProjectInfo.GetProjectFilePath(ProjectName);
                            if (!String.IsNullOrEmpty(UnrealProjectPath))
                            {
                                RootDirectory = Path.GetDirectoryName(Path.GetFullPath(UnrealProjectPath));
                            }
                        }
                    }

                    // Get the output directory
                    string OutputDirectory = Path.Combine(RootDirectory, "Binaries", UBTPlatformName);

                    // Get the executable name (minus any platform or config suffixes)
                    string BaseExeName = TargetName;
                    if (!bShouldCompileMonolithic && TargetRulesObject.Type != TargetRules.TargetType.Program)
                    {
                        // Figure out what the compiled binary will be called so that we can point the IDE to the correct file
                        string TargetConfigurationName = TargetRulesObject.ConfigurationName;
                        if (TargetConfigurationName != TargetRules.TargetType.Game.ToString() && TargetConfigurationName != TargetRules.TargetType.RocketGame.ToString() && TargetConfigurationName != TargetRules.TargetType.Program.ToString())
                        {
                            BaseExeName = "UE4" + TargetConfigurationName;
                        }
                    }

                    // Make the output file path
                    string NMakePath = Path.Combine(OutputDirectory, BaseExeName);
                    if (Configuration != UnrealTargetConfiguration.Development && (Configuration != UnrealTargetConfiguration.DebugGame || bShouldCompileMonolithic))
                    {
                        NMakePath += "-" + UBTPlatformName + "-" + UBTConfigurationName;
                    }
                    NMakePath += BuildPlatform.GetActiveArchitecture();
                    NMakePath += BuildPlatform.GetBinaryExtension(UEBuildBinaryType.Executable);
                    NMakePath = BuildPlatform.ModifyNMakeOutput(NMakePath);

                    string PathStrings = (ProjGenerator != null) ? ProjGenerator.GetVisualStudioPathsEntries(Platform, Configuration, TargetRulesObject.Type, TargetFilePath, ProjectFilePath, NMakePath) : "";
                    if (string.IsNullOrEmpty(PathStrings) || (PathStrings.Contains("<IntDir>") == false))
                    {
                        string ProjectRelativeUnusedDirectory = "$(ProjectDir)..\\Build\\Unused";
                        VCProjectFileContent.Append(
                            PathStrings +
                            "		<OutDir>" + ProjectRelativeUnusedDirectory + Path.DirectorySeparatorChar + "</OutDir>" + ProjectFileGenerator.NewLine +
                            "		<IntDir>" + ProjectRelativeUnusedDirectory + Path.DirectorySeparatorChar + "</IntDir>" + ProjectFileGenerator.NewLine);
                    }
                    else
                    {
                        VCProjectFileContent.Append(PathStrings);
                    }

                    // Force specification of TargetName on XboxOne so that the manifest can identify the correct executable to the debugger.
                    if (Platform == UnrealTargetPlatform.XboxOne)
                    {
                        VCProjectFileContent.Append("		<TargetName>$(ProjectName)");
                        if (Configuration != UnrealTargetConfiguration.Development)
                        {
                            VCProjectFileContent.Append(UBTConfigurationName);
                        }
                        VCProjectFileContent.Append("</TargetName>" + ProjectFileGenerator.NewLine);
                    }

                    // This is the standard UE4 based project NMake build line:
                    //	..\..\Build\BatchFiles\Build.bat <TARGETNAME> <PLATFORM> <CONFIGURATION>
                    //	ie ..\..\Build\BatchFiles\Build.bat BlankProgram Win64 Debug

                    string ProjectPlatformConfiguration = " " + TargetName + " " + UBTPlatformName + " " + UBTConfigurationName;
                    string BatchFilesDirectoryName = Path.Combine(ProjectFileGenerator.EngineRelativePath, "Build", "BatchFiles");

                    // NMake Build command line
                    VCProjectFileContent.Append("		<NMakeBuildCommandLine>");
                    VCProjectFileContent.Append(EscapePath(NormalizeProjectPath(Path.Combine(BatchFilesDirectoryName, "Build.bat"))) + ProjectPlatformConfiguration.ToString());
                    if (bIsProjectTarget)
                    {
                        VCProjectFileContent.Append(" " + UProjectPath + (UnrealBuildTool.RunningRocket() ? " -rocket" : ""));
                    }
                    VCProjectFileContent.Append("</NMakeBuildCommandLine>" + ProjectFileGenerator.NewLine);

                    // NMake ReBuild command line
                    VCProjectFileContent.Append("		<NMakeReBuildCommandLine>");
                    VCProjectFileContent.Append(EscapePath(NormalizeProjectPath(Path.Combine(BatchFilesDirectoryName, "Rebuild.bat"))) + ProjectPlatformConfiguration.ToString());
                    if (bIsProjectTarget)
                    {
                        VCProjectFileContent.Append(" " + UProjectPath + (UnrealBuildTool.RunningRocket() ? " -rocket" : ""));
                    }
                    VCProjectFileContent.Append("</NMakeReBuildCommandLine>" + ProjectFileGenerator.NewLine);

                    // NMake Clean command line
                    VCProjectFileContent.Append("		<NMakeCleanCommandLine>");
                    VCProjectFileContent.Append(EscapePath(NormalizeProjectPath(Path.Combine(BatchFilesDirectoryName, "Clean.bat"))) + ProjectPlatformConfiguration.ToString());
                    if (bIsProjectTarget)
                    {
                        VCProjectFileContent.Append(" " + UProjectPath + (UnrealBuildTool.RunningRocket() ? " -rocket" : ""));
                    }
                    VCProjectFileContent.Append("</NMakeCleanCommandLine>" + ProjectFileGenerator.NewLine);
                    VCProjectFileContent.Append("		<NMakeOutput>");
                    VCProjectFileContent.Append(NormalizeProjectPath(NMakePath));
                    VCProjectFileContent.Append("</NMakeOutput>" + ProjectFileGenerator.NewLine);
                }
                VCProjectFileContent.Append("	</PropertyGroup>" + ProjectFileGenerator.NewLine);

                if (VCUserFileContent != null)
                {
                    if (UnrealBuildTool.HasUProjectFile())
                    {
                        if ((Platform == UnrealTargetPlatform.Win32) || (Platform == UnrealTargetPlatform.Win64))
                        {
                            VCUserFileContent.Append(
                                "	<PropertyGroup " + ConditionString + ">" + ProjectFileGenerator.NewLine);
                            if ((TargetRulesObject.Type != TargetRules.TargetType.RocketGame) && (TargetRulesObject.Type != TargetRules.TargetType.Game))
                            {
                                string DebugOptions = UProjectPath;

                                if(DebugOptions.Length == 0 && TargetRulesObject.Type == TargetRules.TargetType.Editor && ProjectName != "UE4")
                                {
                                    DebugOptions += ProjectName;
                                }

                                if (Configuration == UnrealTargetConfiguration.Debug || Configuration == UnrealTargetConfiguration.DebugGame)
                                {
                                    DebugOptions += " -debug";
                                }
                                else if (Configuration == UnrealTargetConfiguration.Shipping)
                                {
                                    DebugOptions += " -shipping";
                                }

                                VCUserFileContent.Append(
                                    "		<LocalDebuggerCommandArguments>" + DebugOptions + "</LocalDebuggerCommandArguments>" + ProjectFileGenerator.NewLine
                                    );
                            }
                            VCUserFileContent.Append(
                                "		<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>" + ProjectFileGenerator.NewLine
                                );
                            VCUserFileContent.Append(
                                "	</PropertyGroup>" + ProjectFileGenerator.NewLine
                                );
                        }
                    }

                    string PlatformUserFileStrings = (ProjGenerator != null) ? ProjGenerator.GetVisualStudioUserFileStrings(Platform, Configuration, ConditionString, TargetRulesObject, TargetFilePath, ProjectFilePath) : "";
                    VCUserFileContent.Append(PlatformUserFileStrings);
                }
            }

            string LayoutDirString = (ProjGenerator != null) ? ProjGenerator.GetVisualStudioLayoutDirSection(Platform, Configuration, ConditionString, TargetRulesObject.Type, TargetFilePath, ProjectFilePath) : "";
            VCProjectFileContent.Append(LayoutDirString);
        }
		/// <summary>
		/// Is this a valid configuration. Used primarily for Installed vs non-Installed.
		/// </summary>
		/// <param name="InConfiguration"></param>
		/// <returns>true if valid, false if not</returns>
		static public bool IsValidConfiguration(UnrealTargetConfiguration InConfiguration)
		{
			return InstalledPlatformInfo.Current.IsValidConfiguration(InConfiguration, EProjectType.Code);
		}
 public override bool GeneratePList(FileReference ProjectFile, UnrealTargetConfiguration Config, string ProjectDirectory, bool bIsUE4Game, string GameName, string ProjectName, string InEngineDir, string AppDirectory, List <string> UPLScripts, VersionNumber SdkVersion, string BundleID, out bool bSupportsPortrait, out bool bSupportsLandscape, out bool bSkipIcons)
 {
     bSupportsLandscape = bSupportsPortrait = true;
     bSkipIcons         = true;
     return(GenerateTVOSPList(ProjectDirectory, bIsUE4Game, GameName, ProjectName, InEngineDir, AppDirectory, null, BundleID));
 }
示例#46
0
 /**
  * Get whether this platform deploys
  *
  * @return	bool		true if the 'Deploy' option should be enabled
  */
 public override bool GetVisualStudioDeploymentEnabled(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
 {
     return(true);
 }
示例#47
0
 /**
  *	Gives the platform a chance to 'override' the configuration settings
  *	that are overridden on calls to RunUBT.
  *
  *	@param	InPlatform			The UnrealTargetPlatform being built
  *	@param	InConfiguration		The UnrealTargetConfiguration being built
  *
  *	@return	bool				true if debug info should be generated, false if not
  */
 public override void ResetBuildConfiguration(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
 {
     ValidateUEBuildConfiguration();
 }
    void CompilePluginWithUBT(FileReference HostProjectFile, FileReference HostProjectPluginFile, PluginDescriptor Plugin, string TargetName, TargetType TargetType, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, List <string> ReceiptFileNames, string InAdditionalArgs)
    {
        // Find a list of modules that need to be built for this plugin
        List <string> ModuleNames = new List <string>();

        if (Plugin.Modules != null)
        {
            foreach (ModuleDescriptor Module in Plugin.Modules)
            {
                bool bBuildDeveloperTools = (TargetType == TargetType.Editor || TargetType == TargetType.Program);
                bool bBuildEditor         = (TargetType == TargetType.Editor);
                if (Module.IsCompiledInConfiguration(Platform, TargetType, bBuildDeveloperTools, bBuildEditor))
                {
                    ModuleNames.Add(Module.Name);
                }
            }
        }

        // Add these modules to the build agenda
        if (ModuleNames.Count > 0)
        {
            string Arguments = "";            // String.Format("-plugin {0}", CommandUtils.MakePathSafeToUseWithCommandLine(PluginFile.FullName));
            foreach (string ModuleName in ModuleNames)
            {
                Arguments += String.Format(" -module {0}", ModuleName);
            }

            string Architecture = PlatformExports.GetDefaultArchitecture(Platform, HostProjectFile);

            string ReceiptFileName = TargetReceipt.GetDefaultPath(HostProjectPluginFile.Directory.FullName, TargetName, Platform, Configuration, Architecture);
            Arguments += String.Format(" -receipt {0}", CommandUtils.MakePathSafeToUseWithCommandLine(ReceiptFileName));
            ReceiptFileNames.Add(ReceiptFileName);

            if (!String.IsNullOrEmpty(InAdditionalArgs))
            {
                Arguments += InAdditionalArgs;
            }

            CommandUtils.RunUBT(CmdEnv, UE4Build.GetUBTExecutable(), String.Format("{0} {1} {2}{3} {4}", TargetName, Platform, Configuration, (HostProjectFile == null)? "" : String.Format(" -project=\"{0}\"", HostProjectFile.FullName), Arguments));
        }
    }
		/// <summary>
		/// Return the platform toolset string to write into the project configuration
		/// </summary>
		/// <param name="InPlatform">  The UnrealTargetPlatform being built</param>
		/// <param name="InConfiguration"> The UnrealTargetConfiguration being built</param>
		/// <returns>string    The custom configuration section for the project file; Empty string if it doesn't require one</returns>
		public virtual string GetVisualStudioPlatformToolsetString(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, VCProjectFile InProjectFile)
		{
			return "";
		}
示例#50
0
 /**
  *	Whether the platform requires cooked data
  *
  *	@param	InPlatform		The UnrealTargetPlatform being built
  *	@param	InConfiguration	The UnrealTargetConfiguration being built
  *	@return	bool			true if the platform requires cooked data, false if not
  */
 public override bool BuildRequiresCookedData(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
 {
     return(true);
 }
		/// <summary>
		/// Return any custom layout directory sections
		/// </summary>
		/// <param name="InPlatform">  The UnrealTargetPlatform being built</param>
		/// <param name="TargetType">  The type of target (game or program)</param>
		/// <returns>string    The custom property import lines for the project file; Empty string if it doesn't require one</returns>
		public virtual string GetVisualStudioLayoutDirSection(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, string InConditionString, TargetRules.TargetType TargetType, FileReference TargetRulesPath, FileReference ProjectFilePath, FileReference NMakeOutputPath)
		{
			return "";
		}
示例#52
0
        /// <summary>
        /// Returns the standard path to the build receipt for a given target
        /// </summary>
        /// <param name="BaseDir">Base directory for the target being built; either the project directory or engine directory.</param>
        /// <param name="TargetName">The target being built</param>
        /// <param name="Platform">The target platform</param>
        /// <param name="Configuration">The target configuration</param>
        /// <param name="BuildArchitecture">The architecture being built</param>
        /// <returns>Path to the receipt for this target</returns>
        public static FileReference GetDefaultPath(DirectoryReference BaseDir, string TargetName, UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string BuildArchitecture)
        {
            // Get the architecture suffix. Platforms have the option of overriding whether to include this string in filenames.
            string ArchitectureSuffix = "";

            if (!String.IsNullOrEmpty(BuildArchitecture) && UEBuildPlatform.GetBuildPlatform(Platform).RequiresArchitectureSuffix())
            {
                ArchitectureSuffix = BuildArchitecture;
            }

            // Build the output filename
            if (String.IsNullOrEmpty(ArchitectureSuffix) && Configuration == UnrealTargetConfiguration.Development)
            {
                return(FileReference.Combine(BaseDir, "Binaries", Platform.ToString(), String.Format("{0}.target", TargetName)));
            }
            else
            {
                return(FileReference.Combine(BaseDir, "Binaries", Platform.ToString(), String.Format("{0}-{1}-{2}{3}.target", TargetName, Platform.ToString(), Configuration.ToString(), ArchitectureSuffix)));
            }
        }
		/// <summary>
		/// Get the text to insert into the user file for the given platform/configuration/target
		/// </summary>
		/// <param name="InPlatform">The platform being added</param>
		/// <param name="InConfiguration">The configuration being added</param>
		/// <param name="InConditionString">The condition string </param>
		/// <param name="InTargetRules">The target rules </param>
		/// <param name="TargetRulesPath">The target rules path</param>
		/// <param name="ProjectFilePath">The project file path</param>
		/// <returns>The string to append to the user file</returns>
		public virtual string GetVisualStudioUserFileStrings(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration,
			string InConditionString, TargetRules InTargetRules, FileReference TargetRulesPath, FileReference ProjectFilePath)
		{
			return "";
		}
示例#54
0
        /// <summary>
        /// Read a receipt from disk.
        /// </summary>
        /// <param name="Location">Filename to read from</param>
        /// <param name="EngineDir">Engine directory for expanded variables</param>
        /// <param name="ProjectDir">Project directory for expanded variables</param>
        public static TargetReceipt Read(FileReference Location, DirectoryReference EngineDir, DirectoryReference ProjectDir)
        {
            JsonObject RawObject = JsonObject.Read(Location);

            // Read the initial fields
            string TargetName = RawObject.GetStringField("TargetName");
            UnrealTargetPlatform      Platform      = RawObject.GetEnumField <UnrealTargetPlatform>("Platform");
            UnrealTargetConfiguration Configuration = RawObject.GetEnumField <UnrealTargetConfiguration>("Configuration");

            // Try to read the build version
            BuildVersion Version;

            if (!BuildVersion.TryParse(RawObject.GetObjectField("Version"), out Version))
            {
                throw new JsonParseException("Invalid 'Version' field");
            }

            // Create the receipt
            TargetReceipt Receipt = new TargetReceipt(TargetName, Platform, Configuration, Version);

            // Read the build products
            JsonObject[] BuildProductObjects;
            if (RawObject.TryGetObjectArrayField("BuildProducts", out BuildProductObjects))
            {
                foreach (JsonObject BuildProductObject in BuildProductObjects)
                {
                    string           Path;
                    BuildProductType Type;
                    if (BuildProductObject.TryGetStringField("Path", out Path) && BuildProductObject.TryGetEnumField("Type", out Type))
                    {
                        FileReference File = ExpandPathVariables(Path, EngineDir, ProjectDir);

                        string Module;
                        BuildProductObject.TryGetStringField("Module", out Module);

                        Receipt.AddBuildProduct(File, Type);
                    }
                }
            }

            // Read the runtime dependencies
            JsonObject[] RuntimeDependencyObjects;
            if (RawObject.TryGetObjectArrayField("RuntimeDependencies", out RuntimeDependencyObjects))
            {
                foreach (JsonObject RuntimeDependencyObject in RuntimeDependencyObjects)
                {
                    string Path;
                    if (RuntimeDependencyObject.TryGetStringField("Path", out Path))
                    {
                        FileReference File = ExpandPathVariables(Path, EngineDir, ProjectDir);

                        StagedFileType Type;
                        if (!RuntimeDependencyObject.TryGetEnumField("Type", out Type))
                        {
                            // Previous format included an optional IgnoreIfMissing flag, which was only used for debug files. We can explicitly reference them as DebugNonUFS files now.
                            bool bIgnoreIfMissing;
                            if (RuntimeDependencyObject.TryGetBoolField("IgnoreIfMissing", out bIgnoreIfMissing))
                            {
                                bIgnoreIfMissing = false;
                            }
                            Type = bIgnoreIfMissing? StagedFileType.DebugNonUFS : StagedFileType.NonUFS;
                        }

                        Receipt.RuntimeDependencies.Add(File, Type);
                    }
                }
            }

            // Read the additional properties
            JsonObject[] AdditionalPropertyObjects;
            if (RawObject.TryGetObjectArrayField("AdditionalProperties", out AdditionalPropertyObjects))
            {
                foreach (JsonObject AdditionalPropertyObject in AdditionalPropertyObjects)
                {
                    string Name;
                    if (AdditionalPropertyObject.TryGetStringField("Name", out Name))
                    {
                        string Value;
                        if (AdditionalPropertyObject.TryGetStringField("Value", out Value))
                        {
                            Receipt.AdditionalProperties.Add(new ReceiptProperty(Name, Value));
                        }
                    }
                }
            }

            return(Receipt);
        }
示例#55
0
        /// <summary>
        /// Given a target platform and configuration, generates a platform and configuration name string to use in Visual Studio projects.
        /// Unlike with solution configurations, Visual Studio project configurations only support certain types of platforms, so we'll
        /// generate a configuration name that has the platform "built in", and use a default platform type
        /// </summary>
        /// <param name="Platform">Actual platform</param>
        /// <param name="Configuration">Actual configuration</param>
        /// <param name="TargetConfigurationName">The configuration name from the target rules, or null if we don't have one</param>
        /// <param name="ProjectPlatformName">Name of platform string to use for Visual Studio project</param>
        /// <param name="ProjectConfigurationName">Name of configuration string to use for Visual Studio project</param>
        public void MakeProjectPlatformAndConfigurationNames(UnrealTargetPlatform Platform, UnrealTargetConfiguration Configuration, string TargetConfigurationName, out string ProjectPlatformName, out string ProjectConfigurationName)
        {
            if (IsStubProject)
            {
                if (Platform != UnrealTargetPlatform.Unknown || Configuration != UnrealTargetConfiguration.Unknown)
                {
                    throw new BuildException("Stub project was expecting platform and configuration type to be set to Unknown");
                }
                ProjectPlatformName = StubProjectPlatformName;
                ProjectConfigurationName = StubProjectConfigurationName;
            }
            else
            {
                // If this is a C# project, then the project platform name must always be "Any CPU"
                if (this is VCSharpProjectFile)
                {
                    ProjectConfigurationName = Configuration.ToString();
                    ProjectPlatformName = VCProjectFileGenerator.DotNetPlatformName;
                }
                else
                {
                    var PlatformProjectGenerator = UEPlatformProjectGenerator.GetPlatformProjectGenerator(Platform, bInAllowFailure: true);

                    // Check to see if this platform is supported directly by Visual Studio projects.
                    bool HasActualVSPlatform = (PlatformProjectGenerator != null) ? PlatformProjectGenerator.HasVisualStudioSupport(Platform, Configuration) : false;

                    if (HasActualVSPlatform)
                    {
                        // Great!  Visual Studio supports this platform natively, so we don't need to make up
                        // a fake project configuration name.

                        // Allow the platform to specify the name used in VisualStudio.
                        // Note that the actual name of the platform on the Visual Studio side may be different than what
                        // UnrealBuildTool calls it (e.g. "Win64" -> "x64".) GetVisualStudioPlatformName() will figure this out.
                        ProjectConfigurationName = Configuration.ToString();
                        ProjectPlatformName = PlatformProjectGenerator.GetVisualStudioPlatformName(Platform, Configuration);
                    }
                    else
                    {
                        // Visual Studio doesn't natively support this platform, so we fake it by mapping it to
                        // a project configuration that has the platform name in that configuration as a suffix,
                        // and then using "Win32" as the actual VS platform name
                        ProjectConfigurationName = ProjectConfigurationNameOverride == "" ? Platform.ToString() + "_" + Configuration.ToString() : ProjectConfigurationNameOverride;
                        ProjectPlatformName = ProjectPlatformNameOverride == "" ? VCProjectFileGenerator.DefaultPlatformName : ProjectPlatformNameOverride;
                    }

                    if( !String.IsNullOrEmpty( TargetConfigurationName ) )
                    {
                        ProjectConfigurationName += "_" + TargetConfigurationName;
                    }
                }
            }
        }
示例#56
0
 /// <summary>
 /// Whether the editor should be built for this platform or not
 /// </summary>
 /// <param name="InPlatform"> The UnrealTargetPlatform being built</param>
 /// <param name="InConfiguration">The UnrealTargetConfiguration being built</param>
 /// <returns>bool   true if the editor should be built, false if not</returns>
 public override bool ShouldNotBuildEditor(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
 {
     return(true);
 }
 public override bool ShouldCompileMonolithic(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
 {
     return true;
 }
示例#58
0
 public override bool BuildRequiresCookedData(UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration)
 {
     return(true);            // for iOS can only run cooked. this is mostly for testing console code paths.
 }
示例#59
0
 /// <summary>
 /// Is this a valid configuration
 /// Used primarily for Rocket vs non-Rocket
 /// </summary>
 /// <param name="InConfiguration"></param>
 /// <returns>true if valid, false if not</returns>
 static public bool IsValidConfiguration(UnrealTargetConfiguration InConfiguration)
 {
     if (RunningRocket())
     {
         if (
             (InConfiguration != UnrealTargetConfiguration.Development)
             && (InConfiguration != UnrealTargetConfiguration.DebugGame)
             && (InConfiguration != UnrealTargetConfiguration.Shipping)
             )
         {
             return false;
         }
     }
     return true;
 }
示例#60
0
        /// <summary>
        /// Entry point for the commandlet
        /// </summary>
        public override void ExecuteBuild()
        {
            string OutputDir = ParseParamValue("OutputDir");
            string ContentOnlyPlatformsString = ParseParamValue("ContentOnlyPlatforms");
            IEnumerable <UnrealTargetPlatform> ContentOnlyPlatforms = Enumerable.Empty <UnrealTargetPlatform>();

            if (!String.IsNullOrWhiteSpace(ContentOnlyPlatformsString))
            {
                ContentOnlyPlatforms = ContentOnlyPlatformsString.Split(';').Where(x => !String.IsNullOrWhiteSpace(x)).Select(x => (UnrealTargetPlatform)Enum.Parse(typeof(UnrealTargetPlatform), x));
            }
            string AnalyticsTypeOverride = ParseParamValue("AnalyticsTypeOverride");

            // Write InstalledBuild.txt to indicate Engine is installed
            string InstalledBuildFile = CommandUtils.CombinePaths(OutputDir, "Engine/Build/InstalledBuild.txt");

            CommandUtils.CreateDirectory(CommandUtils.GetDirectoryName(InstalledBuildFile));
            CommandUtils.WriteAllText(InstalledBuildFile, "");

            string         OutputEnginePath     = Path.Combine(OutputDir, "Engine");
            string         OutputBaseEnginePath = Path.Combine(OutputEnginePath, "Config", "BaseEngine.ini");
            FileAttributes OutputAttributes     = FileAttributes.ReadOnly;
            List <String>  IniLines             = new List <String>();

            // Should always exist but if not, we don't need extra line
            if (File.Exists(OutputBaseEnginePath))
            {
                OutputAttributes = File.GetAttributes(OutputBaseEnginePath);
                IniLines.Add("");
            }
            else
            {
                CommandUtils.CreateDirectory(CommandUtils.GetDirectoryName(OutputBaseEnginePath));
                CommandUtils.WriteAllText(OutputBaseEnginePath, "");
                OutputAttributes = File.GetAttributes(OutputBaseEnginePath) | OutputAttributes;
            }

            // Create list of platform configurations installed in a Rocket build
            List <InstalledPlatformInfo.InstalledPlatformConfiguration> InstalledConfigs = new List <InstalledPlatformInfo.InstalledPlatformConfiguration>();

            foreach (UnrealTargetPlatform CodeTargetPlatform in Enum.GetValues(typeof(UnrealTargetPlatform)))
            {
                UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(CodeTargetPlatform, true);
                if (BuildPlatform != null)
                {
                    string Architecture = BuildPlatform.CreateContext(null).GetActiveArchitecture();

                    // Try to parse additional Architectures from the command line
                    string Architectures    = ParseParamValue(CodeTargetPlatform.ToString() + "Architectures");
                    string GPUArchitectures = ParseParamValue(CodeTargetPlatform.ToString() + "GPUArchitectures");

                    // Build a list of pre-compiled architecture combinations for this platform if any
                    List <string> AllArchNames;

                    if (!String.IsNullOrWhiteSpace(Architectures) && !String.IsNullOrWhiteSpace(GPUArchitectures))
                    {
                        AllArchNames = (from Arch in Architectures.Split('+')
                                        from GPUArch in GPUArchitectures.Split('+')
                                        select "-" + Arch + "-" + GPUArch).ToList();
                    }
                    else if (!String.IsNullOrWhiteSpace(Architectures))
                    {
                        AllArchNames = Architectures.Split('+').ToList();
                    }
                    else
                    {
                        AllArchNames = new List <string>();
                    }

                    // Check whether this platform should only be used for content based projects
                    EProjectType ProjectType = ContentOnlyPlatforms.Contains(CodeTargetPlatform) ? EProjectType.Content : EProjectType.Any;

                    // Allow Content only platforms to be shown as options in all projects
                    bool bCanBeDisplayed = ProjectType == EProjectType.Content;
                    foreach (UnrealTargetConfiguration CodeTargetConfiguration in Enum.GetValues(typeof(UnrealTargetConfiguration)))
                    {
                        // Need to check for development receipt as we use that for the Engine code in DebugGame
                        UnrealTargetConfiguration EngineConfiguration = (CodeTargetConfiguration == UnrealTargetConfiguration.DebugGame) ? UnrealTargetConfiguration.Development : CodeTargetConfiguration;
                        string ReceiptFileName = TargetReceipt.GetDefaultPath(OutputEnginePath, "UE4Game", CodeTargetPlatform, EngineConfiguration, Architecture);

                        if (File.Exists(ReceiptFileName))
                        {
                            // Strip the output folder so that this can be used on any machine
                            ReceiptFileName = new FileReference(ReceiptFileName).MakeRelativeTo(new DirectoryReference(OutputDir));

                            // If we have pre-compiled architectures for this platform then add an entry for each of these -
                            // there isn't a receipt for each architecture like some other platforms
                            if (AllArchNames.Count > 0)
                            {
                                foreach (string Arch in AllArchNames)
                                {
                                    InstalledConfigs.Add(new InstalledPlatformInfo.InstalledPlatformConfiguration(CodeTargetConfiguration, CodeTargetPlatform, TargetRules.TargetType.Game, Arch, ReceiptFileName, ProjectType, bCanBeDisplayed));
                                }
                            }
                            else
                            {
                                InstalledConfigs.Add(new InstalledPlatformInfo.InstalledPlatformConfiguration(CodeTargetConfiguration, CodeTargetPlatform, TargetRules.TargetType.Game, Architecture, ReceiptFileName, ProjectType, bCanBeDisplayed));
                            }
                        }
                    }
                }
            }

            UnrealBuildTool.InstalledPlatformInfo.WriteConfigFileEntries(InstalledConfigs, ref IniLines);

            if (!String.IsNullOrEmpty(AnalyticsTypeOverride))
            {
                // Write Custom Analytics type setting
                IniLines.Add("");
                IniLines.Add("[Analytics]");
                IniLines.Add(String.Format("UE4TypeOverride=\"{0}\"", AnalyticsTypeOverride));
            }

            // Make sure we can write to the the config file
            File.SetAttributes(OutputBaseEnginePath, OutputAttributes & ~FileAttributes.ReadOnly);
            File.AppendAllLines(OutputBaseEnginePath, IniLines);
            File.SetAttributes(OutputBaseEnginePath, OutputAttributes);
        }