/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="Platform">The platform to find the compiler for</param>
        /// <param name="Compiler">The compiler to use</param>
        /// <param name="CompilerDir">The compiler directory</param>
        /// <param name="CompilerVersion">The compiler version number</param>
        /// <param name="Architecture">The compiler Architecture</param>
        /// <param name="ToolChain">The base toolchain version</param>
        /// <param name="ToolChainDir">Directory containing the toolchain</param>
        /// <param name="ToolChainVersion">Version of the toolchain</param>
        /// <param name="WindowsSdkDir">Root directory containing the Windows Sdk</param>
        /// <param name="WindowsSdkVersion">Version of the Windows Sdk</param>
        public VCEnvironment(UnrealTargetPlatform Platform, WindowsCompiler Compiler, DirectoryReference CompilerDir, VersionNumber CompilerVersion, WindowsArchitecture Architecture, WindowsCompiler ToolChain, DirectoryReference ToolChainDir, VersionNumber ToolChainVersion, DirectoryReference WindowsSdkDir, VersionNumber WindowsSdkVersion)
        {
            this.Compiler          = Compiler;
            this.CompilerDir       = CompilerDir;
            this.CompilerVersion   = CompilerVersion;
            this.Architecture      = Architecture;
            this.ToolChain         = ToolChain;
            this.ToolChainDir      = ToolChainDir;
            this.ToolChainVersion  = ToolChainVersion;
            this.WindowsSdkDir     = WindowsSdkDir;
            this.WindowsSdkVersion = WindowsSdkVersion;

            // Get the standard VC paths
            DirectoryReference VCToolPath = GetVCToolPath(ToolChain, ToolChainDir, Architecture);

            // Compile using 64 bit tools for 64 bit targets, and 32 for 32.
            CompilerPath = GetCompilerToolPath(Platform, Compiler, Architecture, CompilerDir);

            // Regardless of the target, if we're linking on a 64 bit machine, we want to use the 64 bit linker (it's faster than the 32 bit linker and can handle large linking jobs)
            DirectoryReference DefaultLinkerDir = VCToolPath;

            LinkerPath         = GetLinkerToolPath(Platform, Compiler, DefaultLinkerDir);
            LibraryManagerPath = GetLibraryLinkerToolPath(Platform, Compiler, DefaultLinkerDir);

            // Get the resource compiler path from the Windows SDK
            ResourceCompilerPath = GetResourceCompilerToolPath(Platform, WindowsSdkDir, WindowsSdkVersion);

            // Get all the system include paths
            SetupEnvironment(Platform);
        }
示例#2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="Info">Target information</param>
 public HoloLensTargetRules(TargetInfo Info)
 {
     if (Info.Platform == UnrealTargetPlatform.HoloLens && !String.IsNullOrEmpty(Info.Architecture))
     {
         Architecture = (WindowsArchitecture)Enum.Parse(typeof(WindowsArchitecture), Info.Architecture, true);
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="Platform">The platform to find the compiler for</param>
        /// <param name="Compiler">The compiler to use</param>
        /// <param name="CompilerDir">The compiler directory</param>
        /// <param name="CompilerVersion">The compiler version number</param>
        /// <param name="Architecture">The compiler Architecture</param>
        /// <param name="ToolChain">The base toolchain version</param>
        /// <param name="ToolChainDir">Directory containing the toolchain</param>
        /// <param name="ToolChainVersion">Version of the toolchain</param>
        /// <param name="WindowsSdkDir">Root directory containing the Windows Sdk</param>
        /// <param name="WindowsSdkVersion">Version of the Windows Sdk</param>
        public VCEnvironment(UnrealTargetPlatform Platform, WindowsCompiler Compiler, DirectoryReference CompilerDir, VersionNumber CompilerVersion, WindowsArchitecture Architecture, WindowsCompiler ToolChain, DirectoryReference ToolChainDir, VersionNumber ToolChainVersion, DirectoryReference WindowsSdkDir, VersionNumber WindowsSdkVersion)
        {
            this.Compiler          = Compiler;
            this.CompilerDir       = CompilerDir;
            this.CompilerVersion   = CompilerVersion;
            this.Architecture      = Architecture;
            this.ToolChain         = ToolChain;
            this.ToolChainDir      = ToolChainDir;
            this.ToolChainVersion  = ToolChainVersion;
            this.WindowsSdkDir     = WindowsSdkDir;
            this.WindowsSdkVersion = WindowsSdkVersion;

            // Get the standard VC paths
            DirectoryReference VCToolPath = GetVCToolPath(ToolChain, ToolChainDir, Architecture);

            // Compile using 64 bit tools for 64 bit targets, and 32 for 32.
            CompilerPath = GetCompilerToolPath(Platform, Compiler, Architecture, CompilerDir);

            // Add the compiler path and directory as environment variables for the process so they may be used elsewhere.
            Environment.SetEnvironmentVariable("VC_COMPILER_PATH", CompilerPath.FullName, EnvironmentVariableTarget.Process);
            Environment.SetEnvironmentVariable("VC_COMPILER_DIR", CompilerPath.Directory.FullName, EnvironmentVariableTarget.Process);

            // Regardless of the target, if we're linking on a 64 bit machine, we want to use the 64 bit linker (it's faster than the 32 bit linker and can handle large linking jobs)
            DirectoryReference DefaultLinkerDir = VCToolPath;

            LinkerPath         = GetLinkerToolPath(Platform, Compiler, DefaultLinkerDir);
            LibraryManagerPath = GetLibraryLinkerToolPath(Platform, Compiler, DefaultLinkerDir);

            // Get the resource compiler path from the Windows SDK
            ResourceCompilerPath = GetResourceCompilerToolPath(Platform, WindowsSdkDir, WindowsSdkVersion);

            ISPCCompilerPath = GetISPCCompilerToolPath(Platform);

            // Add both toolchain paths to the PATH environment variable. There are some support DLLs which are only added to one of the paths, but which the toolchain in the other directory
            // needs to run (eg. mspdbcore.dll).
            if (Architecture == WindowsArchitecture.x64)
            {
                AddDirectoryToPath(GetVCToolPath(ToolChain, ToolChainDir, WindowsArchitecture.x64));
                AddDirectoryToPath(GetVCToolPath(ToolChain, ToolChainDir, WindowsArchitecture.x86));
            }
            else if (Architecture == WindowsArchitecture.x86)
            {
                AddDirectoryToPath(GetVCToolPath(ToolChain, ToolChainDir, WindowsArchitecture.x86));
                AddDirectoryToPath(GetVCToolPath(ToolChain, ToolChainDir, WindowsArchitecture.x64));
            }
            else if (Architecture == WindowsArchitecture.ARM64)
            {
                AddDirectoryToPath(GetVCToolPath(ToolChain, ToolChainDir, WindowsArchitecture.ARM64));
                AddDirectoryToPath(GetVCToolPath(ToolChain, ToolChainDir, WindowsArchitecture.x86));
                AddDirectoryToPath(GetVCToolPath(ToolChain, ToolChainDir, WindowsArchitecture.x64));
            }


            // Get all the system include paths
            SetupEnvironment(Platform);
        }
 /// <summary>
 /// Returns the common name of the current architecture
 /// </summary>
 /// <param name="arch">The architecture enum</param>
 /// <returns>String with the name</returns>
 public static string GetArchitectureSubpath(WindowsArchitecture arch)
 {
     return(WindowsPlatform.GetArchitectureSubpath(arch));
 }
示例#5
0
        public override bool PrepTargetForDeployment(TargetReceipt Receipt)
        {
            // Use the project name if possible - InTarget.AppName changes for 'Client'/'Server' builds
            string ProjectName = Receipt.ProjectFile != null?Receipt.ProjectFile.GetFileNameWithoutAnyExtensions() : Receipt.Launch.GetFileNameWithoutExtension();

            Log.TraceInformation("Prepping {0} for deployment to {1}", ProjectName, Receipt.Platform.ToString());
            System.DateTime PrepDeployStartTime = DateTime.UtcNow;

            // Note: TargetReceipt.Read now expands path variables internally.
            TargetReceipt NewReceipt      = null;
            FileReference ReceiptFileName = TargetReceipt.GetDefaultPath(Receipt.ProjectDir != null ? Receipt.ProjectDir : UnrealBuildTool.EngineDirectory, Receipt.TargetName, Receipt.Platform, Receipt.Configuration, "Multi");

            if (!TargetReceipt.TryRead(ReceiptFileName, UnrealBuildTool.EngineDirectory, out NewReceipt))
            {
                NewReceipt = new TargetReceipt(Receipt.ProjectFile, Receipt.TargetName, Receipt.TargetType, Receipt.Platform, Receipt.Configuration, Receipt.Version, "Multi");
            }

            AddWinMDReferencesFromReceipt(Receipt, Receipt.ProjectDir != null ? Receipt.ProjectDir : UnrealBuildTool.EngineDirectory, UnrealBuildTool.EngineDirectory.ParentDirectory.FullName);

            //PrepForUATPackageOrDeploy(InTarget.ProjectFile, InAppName, InTarget.ProjectDirectory.FullName, InTarget.OutputPath.FullName, TargetBuildEnvironment.RelativeEnginePath, false, "", false);
            List <UnrealTargetConfiguration> TargetConfigs = new List <UnrealTargetConfiguration> {
                Receipt.Configuration
            };
            List <string> ExePaths = new List <string> {
                Receipt.Launch.FullName
            };
            string RelativeEnginePath = UnrealBuildTool.EngineDirectory.MakeRelativeTo(DirectoryReference.GetCurrentDirectory());

            WindowsArchitecture Arch = WindowsArchitecture.ARM64;

            if (Receipt.Architecture.ToLower() == "x64")
            {
                Arch = WindowsArchitecture.x64;
            }

            string SDK     = "";
            var    Results = Receipt.AdditionalProperties.Where(x => x.Name == "SDK");

            if (Results.Any())
            {
                SDK = Results.First().Value;
            }
            HoloLensExports.InitWindowsSdkToolPath(SDK);

            string AbsoluteExeDirectory         = Path.GetDirectoryName(ExePaths[0]);
            UnrealTargetPlatform Platform       = UnrealTargetPlatform.HoloLens;
            string        IntermediateDirectory = Path.Combine(Receipt.ProjectDir != null ? Receipt.ProjectDir.FullName : UnrealBuildTool.EngineDirectory.FullName, "Intermediate", "Deploy", WindowsExports.GetArchitectureSubpath(Arch));
            List <string> UpdatedFiles          = new HoloLensManifestGenerator().CreateManifest(Platform, Arch, AbsoluteExeDirectory, IntermediateDirectory, Receipt.ProjectFile, Receipt.ProjectDir != null ? Receipt.ProjectDir.FullName : UnrealBuildTool.EngineDirectory.FullName, TargetConfigs, ExePaths, WinMDReferences);

            PrepForUATPackageOrDeploy(Receipt.ProjectFile, ProjectName, Receipt.ProjectDir != null ? Receipt.ProjectDir.FullName : UnrealBuildTool.EngineDirectory.FullName, Arch, TargetConfigs, ExePaths, RelativeEnginePath, false, "", false);
            MakePackage(Receipt, NewReceipt, Arch, UpdatedFiles);
            CopyDataAndSymbolsBetweenReceipts(Receipt, NewReceipt, Arch);

            NewReceipt.Write(ReceiptFileName, UnrealBuildTool.EngineDirectory);

            // Log out the time taken to deploy...
            double PrepDeployDuration = (DateTime.UtcNow - PrepDeployStartTime).TotalSeconds;

            Log.TraceInformation("HoloLens deployment preparation took {0:0.00} seconds", PrepDeployDuration);

            return(true);
        }
示例#6
0
        private void CopyDataAndSymbolsBetweenReceipts(TargetReceipt Receipt, TargetReceipt NewReceipt, WindowsArchitecture Architecture)
        {
            NewReceipt.AdditionalProperties.AddRange(Receipt.AdditionalProperties);
            NewReceipt.AdditionalProperties = NewReceipt.AdditionalProperties.GroupBy(e => e.Name).Select(g => g.First()).ToList();

            NewReceipt.BuildProducts.AddRange(Receipt.BuildProducts.FindAll(x => x.Type == BuildProductType.SymbolFile));
            NewReceipt.BuildProducts = NewReceipt.BuildProducts.GroupBy(e => e.Path).Select(g => g.First()).ToList();

            NewReceipt.RuntimeDependencies.AddRange(Receipt.RuntimeDependencies.FindAll(x => x.Type != StagedFileType.NonUFS));
            NewReceipt.RuntimeDependencies = new RuntimeDependencyList(NewReceipt.RuntimeDependencies.GroupBy(e => e.Path).Select(g => g.First()).ToList());
        }
示例#7
0
        private void MakePackage(TargetReceipt Receipt, TargetReceipt NewReceipt, WindowsArchitecture Architecture, List <string> UpdatedFiles)
        {
            string OutputName             = String.Format("{0}_{1}_{2}_{3}", Receipt.TargetName, Receipt.Platform, Receipt.Configuration, WindowsExports.GetArchitectureSubpath(Architecture));
            string IntermediateDirectory  = Path.Combine(Receipt.ProjectDir != null ? Receipt.ProjectDir.FullName : UnrealBuildTool.EngineDirectory.FullName, "Intermediate", "Deploy", WindowsExports.GetArchitectureSubpath(Architecture));
            string OutputDirectory        = Receipt.Launch.Directory.FullName;
            string OutputAppX             = Path.Combine(OutputDirectory, OutputName + ".appx");
            string SigningCertificate     = @"Build\HoloLens\SigningCertificate.pfx";
            string SigningCertificatePath = Path.Combine(Receipt.ProjectDir != null ? Receipt.ProjectDir.FullName : UnrealBuildTool.EngineDirectory.FullName, SigningCertificate);

            string MapFilename = Path.Combine(IntermediateDirectory, OutputName + ".pkgmap");
            var    LocalRoot   = Receipt.ProjectDir;
            var    EngineRoot  = UnrealBuildTool.RootDirectory;
            var    AddedFiles  = new Dictionary <string, string>();
            bool   PackageFileNeedToBeUpdated = !File.Exists(OutputAppX);

            DateTime AppXTime = DateTime.Now;

            PackageFileNeedToBeUpdated = true;

            if (!PackageFileNeedToBeUpdated)
            {
                AppXTime = File.GetLastWriteTimeUtc(OutputAppX);
            }

            {
                foreach (var Product in Receipt.BuildProducts)
                {
                    if (Product.Type == BuildProductType.Executable || Product.Type == BuildProductType.DynamicLibrary || Product.Type == BuildProductType.RequiredResource)
                    {
                        string Filename;
                        if (AddedFiles.ContainsKey(Product.Path.FullName))
                        {
                            continue;
                        }

                        if (LocalRoot != null && Product.Path.IsUnderDirectory(LocalRoot))
                        {
                            Filename = Product.Path.MakeRelativeTo(LocalRoot.ParentDirectory);
                        }
                        else if (Product.Path.IsUnderDirectory(EngineRoot))
                        {
                            Filename = Product.Path.MakeRelativeTo(EngineRoot);
                        }
                        else
                        {
                            throw new BuildException("Failed to parse target receipt file.  See log for details.");
                        }

                        AddedFiles.Add(Product.Path.FullName, Filename);
                    }
                }

                foreach (var Dep in Receipt.RuntimeDependencies)
                {
                    if (Dep.Type == StagedFileType.NonUFS)
                    {
                        if (AddedFiles.ContainsKey(Dep.Path.FullName))
                        {
                            continue;
                        }

                        string Filename;
                        if (LocalRoot != null && Dep.Path.IsUnderDirectory(LocalRoot))
                        {
                            Filename = Dep.Path.MakeRelativeTo(LocalRoot.ParentDirectory);
                        }
                        else if (Dep.Path.IsUnderDirectory(EngineRoot))
                        {
                            Filename = Dep.Path.MakeRelativeTo(EngineRoot);
                        }
                        else
                        {
                            throw new BuildException("Failed to parse target receipt file.  See log for details.");
                        }

                        AddedFiles.Add(Dep.Path.FullName, Filename);
                    }
                }
            }

            string ManifestName = String.Format("AppxManifest_{0}.xml", WindowsExports.GetArchitectureSubpath(Architecture));

            AddedFiles.Add(Path.Combine(OutputDirectory, ManifestName), "AppxManifest.xml");

            //manually add resources
            string PriFileName = String.Format("resources_{0}.pri", WindowsExports.GetArchitectureSubpath(Architecture));

            AddedFiles.Add(Path.Combine(OutputDirectory, PriFileName), "resources.pri");
            {
                DirectoryReference ResourceFolder = DirectoryReference.Combine(Receipt.Launch.Directory, WindowsExports.GetArchitectureSubpath(Architecture));
                foreach (var ResourcePath in UpdatedFiles)
                {
                    var ResourceFile = new FileReference(ResourcePath);

                    if (ResourceFile.IsUnderDirectory(ResourceFolder))
                    {
                        AddedFiles.Add(ResourceFile.FullName, ResourceFile.MakeRelativeTo(ResourceFolder));
                    }
                    else
                    {
                        Log.TraceError("Wrong path to resource \'{0}\', the resource should be in \'{1}\'", ResourceFile.FullName, ResourceFolder.FullName);
                        throw new BuildException("Failed to generate AppX file.  See log for details.");
                    }
                }
            }


            FileReference SourceNetworkManifestPath = new FileReference(Path.Combine(OutputDirectory, "NetworkManifest.xml"));

            if (FileReference.Exists(SourceNetworkManifestPath))
            {
                AddedFiles.Add(SourceNetworkManifestPath.FullName, "NetworkManifest.xml");
            }
            FileReference SourceXboxConfigPath = new FileReference(Path.Combine(OutputDirectory, "xboxservices.config"));

            if (FileReference.Exists(SourceXboxConfigPath))
            {
                AddedFiles.Add(SourceXboxConfigPath.FullName, "xboxservices.config");
            }

            do
            {
                if (PackageFileNeedToBeUpdated)
                {
                    break;
                }

                if (!File.Exists(MapFilename))
                {
                    PackageFileNeedToBeUpdated = true;
                    break;
                }
                string[] lines      = File.ReadAllLines(MapFilename, Encoding.UTF8);
                int      filesCount = 0;

                foreach (var line in lines)
                {
                    if (line[0] == '[')
                    {
                        continue;
                    }

                    string[] files = line.Split('\t');

                    if (files.Length != 2)
                    {
                        PackageFileNeedToBeUpdated = true;
                        break;
                    }

                    files[0] = files[0].Trim('\"');
                    files[1] = files[1].Trim('\"');

                    if (!AddedFiles.ContainsKey(files[0]))
                    {
                        PackageFileNeedToBeUpdated = true;
                        break;
                    }

                    if (AddedFiles[files[0]] != files[1])
                    {
                        PackageFileNeedToBeUpdated = true;
                        break;
                    }

                    if (File.GetLastWriteTimeUtc(files[0]).CompareTo(AppXTime) >= 0)
                    {
                        PackageFileNeedToBeUpdated = true;
                        break;
                    }

                    ++filesCount;
                }

                if (PackageFileNeedToBeUpdated)
                {
                    break;
                }

                if (filesCount != AddedFiles.Count)
                {
                    PackageFileNeedToBeUpdated = true;
                    break;
                }

                if (File.Exists(SigningCertificatePath) && File.GetLastWriteTimeUtc(SigningCertificatePath).CompareTo(AppXTime) >= 0)
                {
                    PackageFileNeedToBeUpdated = true;
                    break;
                }
            }while(false);

            if (!PackageFileNeedToBeUpdated)
            {
                NewReceipt.BuildProducts.Add(new BuildProduct(new FileReference(OutputAppX), BuildProductType.Package));
                return;
            }

            try
            {
                DeployHelper_DeleteFile(OutputAppX);
            }
            catch (Exception exceptionMessage)
            {
                Log.TraceError("Failed to delete {0} from deployment: {1}", OutputAppX, exceptionMessage);
                throw new BuildException("Failed to generate AppX file.  See log for details.");
            }

            var AppXRecipeBuiltFiles = new StringBuilder();

            AppXRecipeBuiltFiles.AppendLine(@"[Files]");
            foreach (var f in AddedFiles)
            {
                AppXRecipeBuiltFiles.AppendLine(String.Format("\"{0}\"\t\"{1}\"", f.Key, f.Value));
            }
            File.WriteAllText(MapFilename, AppXRecipeBuiltFiles.ToString(), Encoding.UTF8);

            NewReceipt.BuildProducts.Add(new BuildProduct(new FileReference(MapFilename), BuildProductType.MapFile));
        }
示例#8
0
        public bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string ProjectName, string ProjectDirectory, WindowsArchitecture Architecture, List <UnrealTargetConfiguration> TargetConfigurations, List <string> ExecutablePaths, string EngineDirectory, bool bForDistribution, string CookFlavor, bool bIsDataDeploy)
        {
            //@todo need to support dlc and other targets
            //string LocalizedContentDirectory = Path.Combine(ProjectDirectory, "Content", "Localization", "Game");
            string AbsoluteExeDirectory = Path.GetDirectoryName(ExecutablePaths[0]);
            //bool IsGameSpecificExe = ProjectFile != null && AbsoluteExeDirectory.StartsWith(ProjectDirectory);
            //string RelativeExeFilePath = Path.Combine(IsGameSpecificExe ? ProjectName : "Engine", "Binaries", "HoloLens", Path.GetFileName(ExecutablePaths[0]));

            //string TargetDirectory = Path.Combine(ProjectDirectory, "Saved", "HoloLens");


            // If using a secure networking manifest, copy it to the output directory.
            string NetworkManifest = Path.Combine(ProjectDirectory, "Config", "HoloLens", "NetworkManifest.xml");

            if (File.Exists(NetworkManifest))
            {
                CopyFile(NetworkManifest, Path.Combine(AbsoluteExeDirectory, "NetworkManifest.xml"), false);
            }

            // If using Xbox Live generate the json config file expected by the SDK
            DirectoryReference ConfigDirRef = DirectoryReference.FromFile(ProjectFile);

            if (ConfigDirRef == null && !string.IsNullOrEmpty(UnrealBuildTool.GetRemoteIniPath()))
            {
                ConfigDirRef = new DirectoryReference(UnrealBuildTool.GetRemoteIniPath());
            }

            //MakeAppXPath = HoloLensExports.GetWindowsSdkToolPath("makeappx.exe");
            //SignToolPath = HoloLensExports.GetWindowsSdkToolPath("signtool.exe");

            return(true);
        }
        /// <summary>
        /// Creates an environment with the given settings
        /// </summary>
        /// <param name="Compiler">The compiler version to use</param>
        /// <param name="Platform">The platform to target</param>
        /// <param name="Architecture">The Architecture to target</param>
        /// <param name="CompilerVersion">The specific toolchain version to use</param>
        /// <param name="WindowsSdkVersion">Version of the Windows SDK to use</param>
        /// <returns>New environment object with paths for the given settings</returns>
        public static VCEnvironment Create(WindowsCompiler Compiler, UnrealTargetPlatform Platform, WindowsArchitecture Architecture, string CompilerVersion, string WindowsSdkVersion)
        {
            // Get the compiler version info
            VersionNumber      SelectedCompilerVersion;
            DirectoryReference SelectedCompilerDir;

            if (!WindowsPlatform.TryGetToolChainDir(Compiler, CompilerVersion, out SelectedCompilerVersion, out SelectedCompilerDir))
            {
                throw new BuildException("{0}{1} must be installed in order to build this target.", WindowsPlatform.GetCompilerName(Compiler), String.IsNullOrEmpty(CompilerVersion)? "" : String.Format(" ({0})", CompilerVersion));
            }

            // Get the toolchain info
            WindowsCompiler    ToolChain;
            VersionNumber      SelectedToolChainVersion;
            DirectoryReference SelectedToolChainDir;

            if (Compiler == WindowsCompiler.Clang || Compiler == WindowsCompiler.Intel)
            {
                ToolChain = WindowsCompiler.VisualStudio2017;
                if (!WindowsPlatform.TryGetToolChainDir(ToolChain, null, out SelectedToolChainVersion, out SelectedToolChainDir))
                {
                    throw new BuildException("{0}{1} must be installed in order to build this target.", WindowsPlatform.GetCompilerName(Compiler), String.IsNullOrEmpty(CompilerVersion)? "" : String.Format(" ({0})", CompilerVersion));
                }
            }
            else
            {
                ToolChain = Compiler;
                SelectedToolChainVersion = SelectedCompilerVersion;
                SelectedToolChainDir     = SelectedCompilerDir;
            }

            // Get the actual Windows SDK directory
            VersionNumber      SelectedWindowsSdkVersion;
            DirectoryReference SelectedWindowsSdkDir;

            if (!WindowsPlatform.TryGetWindowsSdkDir(WindowsSdkVersion, out SelectedWindowsSdkVersion, out SelectedWindowsSdkDir))
            {
                throw new BuildException("Windows SDK{0} must be installed in order to build this target.", String.IsNullOrEmpty(WindowsSdkVersion) ? "" : String.Format(" ({0})", WindowsSdkVersion));
            }

            return(new VCEnvironment(Platform, Compiler, SelectedCompilerDir, SelectedCompilerVersion, Architecture, ToolChain, SelectedToolChainDir, SelectedToolChainVersion, SelectedWindowsSdkDir, SelectedWindowsSdkVersion));
        }
 /// <summary>
 /// Gets the path to the compiler.
 /// </summary>
 static FileReference GetCompilerToolPath(UnrealTargetPlatform Platform, WindowsCompiler Compiler, WindowsArchitecture Architecture, DirectoryReference CompilerDir)
 {
     if (Compiler == WindowsCompiler.Clang)
     {
         return(FileReference.Combine(CompilerDir, "bin", "clang-cl.exe"));
     }
     else if (Compiler == WindowsCompiler.Intel)
     {
         if (Platform == UnrealTargetPlatform.Win32)
         {
             return(FileReference.Combine(CompilerDir, "bin", "ia32", "icl.exe"));
         }
         else
         {
             return(FileReference.Combine(CompilerDir, "bin", "intel64", "icl.exe"));
         }
     }
     else
     {
         return(FileReference.Combine(GetVCToolPath(Compiler, CompilerDir, Architecture), "cl.exe"));
     }
 }
        /// <summary>
        /// Gets the path to the tool binaries.
        /// </summary>
        /// <param name="Compiler">The compiler version</param>
        /// <param name="VCToolChainDir">Base directory for the VC toolchain</param>
        /// <param name="Architecture">Target Architecture</param>
        /// <returns>Directory containing the 32-bit toolchain binaries</returns>
        static DirectoryReference GetVCToolPath(WindowsCompiler Compiler, DirectoryReference VCToolChainDir, WindowsArchitecture Architecture)
        {
            if (Compiler >= WindowsCompiler.VisualStudio2017)
            {
                FileReference NativeCompilerPath = FileReference.Combine(VCToolChainDir, "bin", "HostX64", WindowsExports.GetArchitectureSubpath(Architecture), "cl.exe");
                if (FileReference.Exists(NativeCompilerPath))
                {
                    return(NativeCompilerPath.Directory);
                }

                FileReference CrossCompilerPath = FileReference.Combine(VCToolChainDir, "bin", "HostX86", WindowsExports.GetArchitectureSubpath(Architecture), "cl.exe");
                if (FileReference.Exists(CrossCompilerPath))
                {
                    return(CrossCompilerPath.Directory);
                }
            }
            else
            {
                if (Architecture == WindowsArchitecture.x86)
                {
                    FileReference CompilerPath = FileReference.Combine(VCToolChainDir, "bin", "cl.exe");
                    if (FileReference.Exists(CompilerPath))
                    {
                        return(CompilerPath.Directory);
                    }
                }
                else if (Architecture == WindowsArchitecture.x64)
                {
                    // Use the native 64-bit compiler if present
                    FileReference NativeCompilerPath = FileReference.Combine(VCToolChainDir, "bin", "amd64", "cl.exe");
                    if (FileReference.Exists(NativeCompilerPath))
                    {
                        return(NativeCompilerPath.Directory);
                    }

                    // Otherwise use the amd64-on-x86 compiler. VS2012 Express only includes the latter.
                    FileReference CrossCompilerPath = FileReference.Combine(VCToolChainDir, "bin", "x86_amd64", "cl.exe");
                    if (FileReference.Exists(CrossCompilerPath))
                    {
                        return(CrossCompilerPath.Directory);
                    }
                }
                else if (Architecture == WindowsArchitecture.ARM32)
                {
                    // Use the native 64-bit compiler if present
                    FileReference NativeCompilerPath = FileReference.Combine(VCToolChainDir, "bin", "amd64_arm", "cl.exe");
                    if (FileReference.Exists(NativeCompilerPath))
                    {
                        return(NativeCompilerPath.Directory);
                    }

                    // Otherwise use the amd64-on-x86 compiler. VS2012 Express only includes the latter.
                    FileReference CrossCompilerPath = FileReference.Combine(VCToolChainDir, "bin", "x86_arm", "cl.exe");
                    if (FileReference.Exists(CrossCompilerPath))
                    {
                        return(CrossCompilerPath.Directory);
                    }
                }
            }

            throw new BuildException("No required compiler toolchain found in {0}", VCToolChainDir);
        }
示例#12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="ProjectFile"></param>
 /// <param name="InProjectName"></param>
 /// <param name="InProjectDirectory"></param>
 /// <param name="Architecture"></param>
 /// <param name="InTargetConfigurations"></param>
 /// <param name="InExecutablePaths"></param>
 /// <param name="InEngineDir"></param>
 /// <param name="bForDistribution"></param>
 /// <param name="CookFlavor"></param>
 /// <param name="bIsDataDeploy"></param>
 /// <returns></returns>
 public bool PrepForUATPackageOrDeploy(FileReference ProjectFile, string InProjectName, string InProjectDirectory, WindowsArchitecture Architecture, List <UnrealTargetConfiguration> InTargetConfigurations, List <string> InExecutablePaths, string InEngineDir, bool bForDistribution, string CookFlavor, bool bIsDataDeploy)
 {
     return(InnerDeploy.PrepForUATPackageOrDeploy(ProjectFile, InProjectName, InProjectDirectory, Architecture, InTargetConfigurations, InExecutablePaths, InEngineDir, bForDistribution, CookFlavor, bIsDataDeploy));
 }