/**
  *	Retrieve the UEPlatformProjectGenerator instance for the given TargetPlatform
  *
  *	@param	InPlatform					The STTargetPlatform being built
  *	@param	bInAllowFailure				If true, do not throw an exception and return null
  *
  *	@return	UEPlatformProjectGenerator	The instance of the project generator
  */
 public static STPlatformProjectGenerator GetPlatformProjectGenerator(STTargetPlatform InPlatform, bool bInAllowFailure = false)
 {
     if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true)
     {
         return ProjectGeneratorDictionary[InPlatform];
     }
     if (bInAllowFailure == true)
     {
         return null;
     }
     throw new BuildException("GetPlatformProjectGenerator: No PlatformProjectGenerator found for {0}", InPlatform.ToString());
 }
Exemplo n.º 2
0
 /**
  *	Register the given platforms UEBuildDeploy instance
  *
  *	@param	InPlatform			The UnrealTargetPlatform to register with
  *	@param	InBuildDeploy		The UEBuildDeploy instance to use for the InPlatform
  */
 public static void RegisterBuildDeploy(STTargetPlatform InPlatform, ISTBuildDeploy InBuildDeploy)
 {
     if (BuildDeployDictionary.ContainsKey(InPlatform) == true)
     {
         Log.TraceWarning("RegisterBuildDeply Warning: Registering build deploy {0} for {1} when it is already set to {2}",
             InBuildDeploy.ToString(), InPlatform.ToString(), BuildDeployDictionary[InPlatform].ToString());
         BuildDeployDictionary[InPlatform] = InBuildDeploy;
     }
     else
     {
         BuildDeployDictionary.Add(InPlatform, InBuildDeploy);
     }
 }
 /**
  *	Register the given platforms UEPlatformProjectGenerator instance
  *
  *	@param	InPlatform			The STTargetPlatform to register with
  *	@param	InProjectGenerator	The UEPlatformProjectGenerator instance to use for the InPlatform
  */
 public static void RegisterPlatformProjectGenerator(STTargetPlatform InPlatform, STPlatformProjectGenerator InProjectGenerator)
 {
     // Make sure the build platform is legal
     var BuildPlatform = STBuildPlatform.GetBuildPlatform(InPlatform, true);
     if (BuildPlatform != null)
     {
         if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true)
         {
             Log.TraceInformation("RegisterPlatformProjectGenerator Warning: Registering project generator {0} for {1} when it is already set to {2}",
                 InProjectGenerator.ToString(), InPlatform.ToString(), ProjectGeneratorDictionary[InPlatform].ToString());
             ProjectGeneratorDictionary[InPlatform] = InProjectGenerator;
         }
         else
         {
             ProjectGeneratorDictionary.Add(InPlatform, InProjectGenerator);
         }
     }
     else
     {
         Log.TraceVerbose("Skipping project file generator registration for {0} due to no valid BuildPlatform.", InPlatform.ToString());
     }
 }
 /**
  *	Return the VisualStudio platform name for this build platform
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *	@param	InConfiguration		The STTargetConfiguration being built
  *
  *	@return	string				The name of the platform that VisualStudio recognizes
  */
 public virtual string GetVisualStudioPlatformName(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration)
 {
     // By default, return the platform string
     return InPlatform.ToString();
 }
Exemplo n.º 5
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(STTargetPlatform Platform, STTargetConfiguration Configuration, string TargetConfigurationName, out string ProjectPlatformName, out string ProjectConfigurationName)
        {
            if (IsStubProject)
            {
                if (Platform != STTargetPlatform.Unknown || Configuration != STTargetConfiguration.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 = STPlatformProjectGenerator.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
                        // STBuildTool 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;
                    }
                }
            }
        }
Exemplo n.º 6
0
        /** Given a UBT-built binary name (e.g. "Core"), returns a relative path to the binary for the current build configuration (e.g. "../Binaries/Win64/Core-Win64-Debug.lib") */
        public static string[] MakeBinaryPaths(string ModuleName, string BinaryName, STTargetPlatform Platform,
            STTargetConfiguration Configuration, STBuildBinaryType BinaryType, TargetRules.TargetType? TargetType, PluginInfo PluginInfo, string AppName, bool bForceNameAsForDevelopment = false, string ExeBinariesSubFolder = null)
        {
            // Determine the binary extension for the platform and binary type.
            var BuildPlatform = STBuildPlatform.GetBuildPlatform(Platform);
            string BinaryExtension;

            if (!BuildConfiguration.bRunUnrealCodeAnalyzer)
            {
                BinaryExtension = BuildPlatform.GetBinaryExtension(BinaryType);
            }
            else
            {
                BinaryExtension = @"-" + BuildConfiguration.UCAModuleToAnalyze + @".analysis";
            }

            STTargetConfiguration LocalConfig = Configuration;
            if (Configuration == STTargetConfiguration.DebugGame && !String.IsNullOrEmpty(ModuleName) && !RulesCompiler.IsGameModule(ModuleName))
            {
                LocalConfig = STTargetConfiguration.Development;
            }

            string ModuleBinariesSubDir = "";
            if (BinaryType == STBuildBinaryType.DynamicLinkLibrary && (string.IsNullOrEmpty(ModuleName) == false))
            {
                // Allow for modules to specify sub-folders in the Binaries folder
                var RulesFilename = RulesCompiler.GetModuleFilename(ModuleName);
                // Plugins can be binary-only and can have no rules object
                if (PluginInfo == null || !String.IsNullOrEmpty(RulesFilename))
                {
                    ModuleRules ModuleRulesObj = RulesCompiler.CreateModuleRules(ModuleName, new TargetInfo(Platform, Configuration, TargetType), out RulesFilename);
                    if (ModuleRulesObj != null)
                    {
                        ModuleBinariesSubDir = ModuleRulesObj.BinariesSubFolder;
                    }
                }
            }
            else if (BinaryType == STBuildBinaryType.Executable && string.IsNullOrEmpty(ExeBinariesSubFolder) == false)
            {
                ModuleBinariesSubDir = ExeBinariesSubFolder;
            }

            //@todo.Rocket: This just happens to work since exp and lib files go into intermediate...

            // Build base directory string ("../Binaries/<Platform>/")
            string BinariesDirName;
            if (TargetType.HasValue && TargetType.Value == TargetRules.TargetType.Program && STBuildTool.HasUProjectFile() && !ProjectFileGenerator.bGenerateProjectFiles)
            {
                BinariesDirName = Path.Combine(STBuildTool.GetUProjectPath(), "Binaries");
            }
            else if (PluginInfo != null)
            {
                BinariesDirName = Path.Combine(PluginInfo.Directory, "Binaries");
            }
            else
            {
                BinariesDirName = Path.Combine("..", "Binaries");
            }
            var BaseDirectory = Path.Combine(BinariesDirName, Platform.ToString());
            if (ModuleBinariesSubDir.Length > 0)
            {
                BaseDirectory = Path.Combine(BaseDirectory, ModuleBinariesSubDir);
            }

            string BinarySuffix = "";
            if ((PluginInfo != null) && (BinaryType != STBuildBinaryType.DynamicLinkLibrary))
            {
                BinarySuffix = "-Static";
            }

            // append the architecture to the end of the binary name
            BinarySuffix = BuildPlatform.ApplyArchitectureName(BinarySuffix);

            string OutBinaryPath = "";
            // Append binary file name
            string Prefix = "";
            if (Platform == STTargetPlatform.Linux && (BinaryType == STBuildBinaryType.DynamicLinkLibrary || BinaryType == STBuildBinaryType.StaticLibrary))
            {
                Prefix = "lib";
            }

            if (LocalConfig == STTargetConfiguration.Development || bForceNameAsForDevelopment)
            {
                OutBinaryPath = Path.Combine(BaseDirectory, String.Format("{3}{0}{1}{2}", BinaryName, BinarySuffix, BinaryExtension, Prefix));
            }
            else
            {
                OutBinaryPath = Path.Combine(BaseDirectory, String.Format("{5}{0}-{1}-{2}{3}{4}",
                    BinaryName, Platform.ToString(), LocalConfig.ToString(), BinarySuffix, BinaryExtension, Prefix));
            }

            return BuildPlatform.FinalizeBinaryPaths(OutBinaryPath);
        }
Exemplo n.º 7
0
        /**
         *	Retrieve the CPPTargetPlatform for the given STTargetPlatform
         *
         *	@param	InSTTargetPlatform		The STTargetPlatform being build
         *
         *	@return	CPPTargetPlatform			The CPPTargetPlatform to compile for
         */
        public override CPPTargetPlatform GetCPPTargetPlatform(STTargetPlatform InSTTargetPlatform)
        {
            switch (InSTTargetPlatform)
            {
                case STTargetPlatform.Win32:
                    return CPPTargetPlatform.Win32;

                case STTargetPlatform.Win64:
                    return CPPTargetPlatform.Win64;
            }
            throw new BuildException("WindowsPlatform::GetCPPTargetPlatform: Invalid request for {0}", InSTTargetPlatform.ToString());
        }
Exemplo n.º 8
0
 /**
  *	Register the given platforms UEBuildPlatform instance
  *
  *	@param	InPlatform			The STTargetPlatform to register with
  *	@param	InBuildPlatform		The UEBuildPlatform instance to use for the InPlatform
  */
 public static void RegisterBuildPlatform(STTargetPlatform InPlatform, STBuildPlatform InBuildPlatform)
 {
     if (BuildPlatformDictionary.ContainsKey(InPlatform) == true)
     {
         Log.TraceWarning("RegisterBuildPlatform Warning: Registering build platform {0} for {1} when it is already set to {2}",
             InBuildPlatform.ToString(), InPlatform.ToString(), BuildPlatformDictionary[InPlatform].ToString());
         BuildPlatformDictionary[InPlatform] = InBuildPlatform;
     }
     else
     {
         BuildPlatformDictionary.Add(InPlatform, InBuildPlatform);
     }
 }
Exemplo n.º 9
0
 /**
  *	Retrieve the ISTBuildPlatform instance for the given TargetPlatform
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *	@param	bInAllowFailure		If true, do not throw an exception and return null
  *
  *	@return	UEBuildPlatform		The instance of the build platform
  */
 public static ISTBuildPlatform GetBuildPlatform(STTargetPlatform InPlatform, bool bInAllowFailure = false)
 {
     if (BuildPlatformDictionary.ContainsKey(InPlatform) == true)
     {
         return BuildPlatformDictionary[InPlatform];
     }
     if (bInAllowFailure == true)
     {
         return null;
     }
     throw new BuildException("GetBuildPlatform: No BuildPlatform found for {0}", InPlatform.ToString());
 }