コード例 #1
0
        /// <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="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, CppPlatform Platform, string CompilerVersion, string WindowsSdkVersion)
        {
            // Get the actual toolchain directory
            VersionNumber      SelectedToolChainVersion;
            DirectoryReference SelectedToolChainDir;

            if (!WindowsPlatform.TryGetVCToolChainDir(Compiler, CompilerVersion, 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));
            }

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

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

            return(new VCEnvironment(Compiler, Platform, SelectedToolChainDir, SelectedToolChainVersion, SelectedWindowsSdkDir, SelectedWindowsSdkVersion));
        }