Example #1
0
        internal static DirectoryReference GetCppCXMetadataLocation(WindowsCompiler Compiler, string CompilerVersion)
        {
            VersionNumber      SelectedToolChainVersion;
            DirectoryReference SelectedToolChainDir;

            if (!WindowsPlatform.TryGetToolChainDir(Compiler, CompilerVersion, out SelectedToolChainVersion, out SelectedToolChainDir))
            {
                return(null);
            }

            return(GetCppCXMetadataLocation(Compiler, SelectedToolChainDir));
        }
        /// <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)
            {
                if (WindowsPlatform.TryGetToolChainDir(WindowsCompiler.VisualStudio2019, null, out SelectedToolChainVersion, out SelectedToolChainDir))
                {
                    ToolChain = WindowsCompiler.VisualStudio2019;
                }
                else if (WindowsPlatform.TryGetToolChainDir(WindowsCompiler.VisualStudio2017, null, out SelectedToolChainVersion, out SelectedToolChainDir))
                {
                    ToolChain = WindowsCompiler.VisualStudio2017;
                }
                else
                {
                    throw new BuildException("{0} or {1} must be installed in order to build this target.", WindowsPlatform.GetCompilerName(WindowsCompiler.VisualStudio2019), WindowsPlatform.GetCompilerName(WindowsCompiler.VisualStudio2017));
                }
            }
            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));
        }