/// <summary> /// Gets the path to the resource compiler's rc.exe for the specified platform. /// </summary> string GetResourceCompilerToolPath(CPPTargetPlatform Platform, bool bSupportWindowsXP) { // 64 bit -- we can use the 32 bit version to target 64 bit on 32 bit OS. if (Platform == CPPTargetPlatform.Win64) { if (WindowsPlatform.bUseWindowsSDK10) { return(Path.Combine(WindowsSDKExtensionDir, "bin/x64/rc.exe")); } else { return(Path.Combine(WindowsSDKDir, "bin/x64/rc.exe")); } } if (!bSupportWindowsXP) // Windows XP requires use to force Windows SDK 7.1 even on the newer compiler, so we need the old path RC.exe { if (WindowsPlatform.bUseWindowsSDK10) { return(Path.Combine(WindowsSDKExtensionDir, "bin/x86/rc.exe")); } else { return(Path.Combine(WindowsSDKDir, "bin/x86/rc.exe")); } } return(Path.Combine(WindowsSDKDir, "bin/rc.exe")); }
public static IUEToolChain GetPlatformToolChain(CPPTargetPlatform Platform) { UEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(UEBuildTarget.CPPTargetPlatformToUnrealTargetPlatform(Platform)); UEBuildPlatformContext Context = BuildPlatform.CreateContext(null); return(Context.CreateToolChain(BuildPlatform.DefaultCppPlatform)); }
/// <returns>The path to Windows SDK directory for the specified version.</returns> private static string FindWindowsSDKInstallationFolder(CPPTargetPlatform InPlatform) { // When targeting Windows XP on Visual Studio 2012+, we need to point at the older Windows SDK 7.1A that comes // installed with Visual Studio 2012 Update 1. (http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx) string Version; if (WindowsPlatform.IsWindowsXPSupported()) { Version = "v7.1A"; } else { switch (WindowsPlatform.Compiler) { case WindowsCompiler.VisualStudio2015: if (WindowsPlatform.bUseWindowsSDK10) { Version = "v10.0"; } else { Version = "v8.1"; } break; case WindowsCompiler.VisualStudio2013: Version = "v8.1"; break; case WindowsCompiler.VisualStudio2012: Version = "v8.0"; break; default: throw new BuildException("Unexpected compiler setting when trying to determine Windows SDK folder"); } } // Based on VCVarsQueryRegistry string FinalResult = null; foreach (string IndividualVersion in Version.Split('|')) { var Result = Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" + IndividualVersion, "InstallationFolder", null) ?? Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\" + IndividualVersion, "InstallationFolder", null) ?? Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\" + IndividualVersion, "InstallationFolder", null); if (Result != null) { FinalResult = (string)Result; break; } } if (FinalResult == null) { throw new BuildException("Windows SDK {0} must be installed in order to build this target.", Version); } return(FinalResult); }
/// <summary> /// Copy constructor. /// </summary> public CPPEnvironmentConfiguration(CPPEnvironmentConfiguration InCopyEnvironment) { Platform = InCopyEnvironment.Platform; Configuration = InCopyEnvironment.Configuration; Architecture = InCopyEnvironment.Architecture; OutputDirectory = InCopyEnvironment.OutputDirectory; PCHOutputDirectory = InCopyEnvironment.PCHOutputDirectory; LocalShadowDirectory = InCopyEnvironment.LocalShadowDirectory; PrecompiledHeaderIncludeFilename = InCopyEnvironment.PrecompiledHeaderIncludeFilename; PrecompiledHeaderAction = InCopyEnvironment.PrecompiledHeaderAction; bUseRTTI = InCopyEnvironment.bUseRTTI; bUseAVX = InCopyEnvironment.bUseAVX; bFasterWithoutUnity = InCopyEnvironment.bFasterWithoutUnity; MinSourceFilesForUnityBuildOverride = InCopyEnvironment.MinSourceFilesForUnityBuildOverride; MinFilesUsingPrecompiledHeaderOverride = InCopyEnvironment.MinFilesUsingPrecompiledHeaderOverride; bBuildLocallyWithSNDBS = InCopyEnvironment.bBuildLocallyWithSNDBS; bEnableExceptions = InCopyEnvironment.bEnableExceptions; bEnableShadowVariableWarning = InCopyEnvironment.bEnableShadowVariableWarning; bOptimizeCode = InCopyEnvironment.bOptimizeCode; bCreateDebugInfo = InCopyEnvironment.bCreateDebugInfo; bIsBuildingLibrary = InCopyEnvironment.bIsBuildingLibrary; bIsBuildingDLL = InCopyEnvironment.bIsBuildingDLL; bUseStaticCRT = InCopyEnvironment.bUseStaticCRT; bEnableOSX109Support = InCopyEnvironment.bEnableOSX109Support; CPPIncludeInfo.IncludePaths.UnionWith(InCopyEnvironment.CPPIncludeInfo.IncludePaths); CPPIncludeInfo.SystemIncludePaths.UnionWith(InCopyEnvironment.CPPIncludeInfo.SystemIncludePaths); ForceIncludeFiles.AddRange(InCopyEnvironment.ForceIncludeFiles); Definitions.AddRange(InCopyEnvironment.Definitions); AdditionalArguments = InCopyEnvironment.AdditionalArguments; AdditionalFrameworks.AddRange(InCopyEnvironment.AdditionalFrameworks); }
private VCEnvironment(CPPTargetPlatform InPlatform) { Platform = InPlatform; // If Visual Studio is not installed, the Windows SDK path will be used, which also happens to be the same // directory. (It installs the toolchain into the folder where Visual Studio would have installed it to). BaseVSToolPath = WindowsPlatform.GetVSComnToolsPath(); if (string.IsNullOrEmpty(BaseVSToolPath)) { throw new BuildException("Visual Studio 2012 or Visual Studio 2013 must be installed in order to build this target."); } WindowsSDKDir = FindWindowsSDKInstallationFolder(Platform); PlatformVSToolPath = GetPlatformVSToolPath(Platform, BaseVSToolPath); CompilerPath = GetCompilerToolPath(PlatformVSToolPath); CLExeVersion = FindCLExeVersion(CompilerPath); LinkerPath = GetLinkerToolPath(PlatformVSToolPath); LibraryLinkerPath = GetLibraryLinkerToolPath(PlatformVSToolPath); ResourceCompilerPath = GetResourceCompilerToolPath(Platform, WindowsSDKDir); var VCVarsBatchFile = Path.Combine(BaseVSToolPath, (Platform == CPPTargetPlatform.Win64) ? "../../VC/bin/x86_amd64/vcvarsx86_amd64.bat" : "vsvars32.bat"); Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile); // When targeting Windows XP on Visual Studio 2012+, we need to override the Windows SDK include and lib path set // by the batch file environment (http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx) if (WindowsPlatform.IsWindowsXPSupported()) { // Lib and bin folders have a x64 subfolder for 64 bit development. var ConfigSuffix = (Platform == CPPTargetPlatform.Win64) ? "\\x64" : ""; Environment.SetEnvironmentVariable("PATH", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "bin" + ConfigSuffix + ";%PATH%")); Environment.SetEnvironmentVariable("LIB", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "lib" + ConfigSuffix + ";%LIB%")); Environment.SetEnvironmentVariable("INCLUDE", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "include;%INCLUDE%")); } }
/** Gets the path to the resource compiler's rc.exe for the specified platform. */ string GetResourceCompilerToolPath(CPPTargetPlatform Platform) { // 64 bit -- we can use the 32 bit version to target 64 bit on 32 bit OS. if (Platform == CPPTargetPlatform.Win64 || Platform == CPPTargetPlatform.UWP) { if (WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2015 && WindowsPlatform.bUseWindowsSDK10) { return(Path.Combine(WindowsSDKExtensionDir, "bin/x64/rc.exe")); } else { return(Path.Combine(WindowsSDKDir, "bin/x64/rc.exe")); } } // @todo UWP: Verify that Windows XP will compile using VS 2015 (it should be supported) if (!WindowsPlatform.IsWindowsXPSupported()) // Windows XP requires use to force Windows SDK 7.1 even on the newer compiler, so we need the old path RC.exe { if (WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2015 && WindowsPlatform.bUseWindowsSDK10) { return(Path.Combine(WindowsSDKExtensionDir, "bin/x86/rc.exe")); } else { return(Path.Combine(WindowsSDKDir, "bin/x86/rc.exe")); } } return(Path.Combine(WindowsSDKDir, "bin/rc.exe")); }
private VCEnvironment(CPPTargetPlatform InPlatform, bool bSupportWindowsXP) { Platform = InPlatform; // Get the Visual Studio install directory WindowsPlatform.TryGetVSInstallDir(WindowsPlatform.Compiler, out VSInstallDir); // Get the Visual C++ compiler install directory. if(!WindowsPlatform.TryGetVCInstallDir(WindowsPlatform.Compiler, out VCInstallDir)) { throw new BuildException(WindowsPlatform.GetCompilerName(WindowsPlatform.Compiler) + " must be installed in order to build this target."); } WindowsSDKDir = FindWindowsSDKInstallationFolder(Platform, bSupportWindowsXP); WindowsSDKLibVersion = FindWindowsSDKLibVersion(WindowsSDKDir); WindowsSDKExtensionDir = FindWindowsSDKExtensionInstallationFolder(); NetFxSDKExtensionDir = FindNetFxSDKExtensionInstallationFolder(); WindowsSDKExtensionHeaderLibVersion = FindWindowsSDKExtensionLatestVersion(WindowsSDKExtensionDir); UniversalCRTDir = bSupportWindowsXP ? "" : FindUniversalCRTInstallationFolder(); UniversalCRTVersion = bSupportWindowsXP ? "0.0.0.0" : FindUniversalCRTVersion(UniversalCRTDir); VCToolPath32 = GetVCToolPath32(VCInstallDir); VCToolPath64 = GetVCToolPath64(VCInstallDir); // Compile using 64 bit tools for 64 bit targets, and 32 for 32. DirectoryReference CompilerDir = (Platform == CPPTargetPlatform.Win64) ? VCToolPath64 : VCToolPath32; // 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 LinkerDir = VCToolPath64; CompilerPath = GetCompilerToolPath(InPlatform, CompilerDir); CLExeVersion = FindCLExeVersion(CompilerPath.FullName); LinkerPath = GetLinkerToolPath(InPlatform, LinkerDir); LibraryManagerPath = GetLibraryLinkerToolPath(InPlatform, LinkerDir); ResourceCompilerPath = new FileReference(GetResourceCompilerToolPath(Platform, bSupportWindowsXP)); // Make sure the base 32-bit VS tool path is in the PATH, regardless of which configuration we're using. The toolchain may need to reference support DLLs from this directory (eg. mspdb120.dll). string PathEnvironmentVariable = Environment.GetEnvironmentVariable("PATH") ?? ""; if (!PathEnvironmentVariable.Split(';').Any(x => String.Compare(x, VCToolPath32.FullName, true) == 0)) { PathEnvironmentVariable = VCToolPath32.FullName + ";" + PathEnvironmentVariable; Environment.SetEnvironmentVariable("PATH", PathEnvironmentVariable); } // Setup the INCLUDE environment variable List<string> IncludePaths = GetVisualCppIncludePaths(VCInstallDir.FullName, UniversalCRTDir, UniversalCRTVersion, NetFxSDKExtensionDir, WindowsSDKDir, WindowsSDKLibVersion, bSupportWindowsXP); if(InitialIncludePaths != null) { IncludePaths.Add(InitialIncludePaths); } Environment.SetEnvironmentVariable("INCLUDE", String.Join(";", IncludePaths)); // Setup the LIB environment variable List<string> LibraryPaths = GetVisualCppLibraryPaths(VCInstallDir.FullName, UniversalCRTDir, UniversalCRTVersion, NetFxSDKExtensionDir, WindowsSDKDir, WindowsSDKLibVersion, Platform, bSupportWindowsXP); if(InitialLibraryPaths != null) { LibraryPaths.Add(InitialLibraryPaths); } Environment.SetEnvironmentVariable("LIB", String.Join(";", LibraryPaths)); }
/// <summary> /// Copy constructor. /// </summary> public LinkEnvironmentConfiguration(LinkEnvironmentConfiguration InCopyEnvironment) { Platform = InCopyEnvironment.Platform; Configuration = InCopyEnvironment.Configuration; Architecture = InCopyEnvironment.Architecture; OutputDirectory = InCopyEnvironment.OutputDirectory; IntermediateDirectory = InCopyEnvironment.IntermediateDirectory; LocalShadowDirectory = InCopyEnvironment.LocalShadowDirectory; OutputFilePaths = InCopyEnvironment.OutputFilePaths.ToList(); ProjectFile = InCopyEnvironment.ProjectFile; LibraryPaths.AddRange(InCopyEnvironment.LibraryPaths); ExcludedLibraries.AddRange(InCopyEnvironment.ExcludedLibraries); AdditionalLibraries.AddRange(InCopyEnvironment.AdditionalLibraries); Frameworks.AddRange(InCopyEnvironment.Frameworks); AdditionalShadowFiles.AddRange(InCopyEnvironment.AdditionalShadowFiles); AdditionalFrameworks.AddRange(InCopyEnvironment.AdditionalFrameworks); WeakFrameworks.AddRange(InCopyEnvironment.WeakFrameworks); AdditionalBundleResources.AddRange(InCopyEnvironment.AdditionalBundleResources); DelayLoadDLLs.AddRange(InCopyEnvironment.DelayLoadDLLs); AdditionalArguments = InCopyEnvironment.AdditionalArguments; bCreateDebugInfo = InCopyEnvironment.bCreateDebugInfo; bIsBuildingLibrary = InCopyEnvironment.bIsBuildingLibrary; bIsBuildingDLL = InCopyEnvironment.bIsBuildingDLL; bIsBuildingConsoleApplication = InCopyEnvironment.bIsBuildingConsoleApplication; WindowsEntryPointOverride = InCopyEnvironment.WindowsEntryPointOverride; bIsCrossReferenced = InCopyEnvironment.bIsCrossReferenced; bHasExports = InCopyEnvironment.bHasExports; bIsBuildingDotNetAssembly = InCopyEnvironment.bIsBuildingDotNetAssembly; }
/// <summary> /// Gets the path to the linker. /// </summary> static FileReference GetLinkerToolPath(CPPTargetPlatform Platform, DirectoryReference PlatformVSToolPath) { // If we were asked to use Clang, then we'll redirect the path to the compiler to the LLVM installation directory if (WindowsPlatform.bCompileWithClang && WindowsPlatform.bAllowClangLinker) { string Result = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "LLVM", "bin", "lld.exe"); if (!File.Exists(Result)) { Result = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "LLVM", "bin", "lld.exe"); } if (!File.Exists(Result)) { throw new BuildException("Clang was selected as the Windows compiler, but LLVM/Clang does not appear to be installed. Could not find: " + Result); } return(new FileReference(Result)); } if (WindowsPlatform.bCompileWithICL && WindowsPlatform.bAllowICLLinker) { var Result = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IntelSWTools", "compilers_and_libraries", "windows", "bin", Platform == CPPTargetPlatform.Win32 ? "ia32" : "intel64", "xilink.exe"); if (!File.Exists(Result)) { throw new BuildException("ICL was selected as the Windows compiler, but does not appear to be installed. Could not find: " + Result); } return(new FileReference(Result)); } return(FileReference.Combine(PlatformVSToolPath, "link.exe")); }
public static IUEToolChain GetPlatformToolChain(CPPTargetPlatform InPlatform) { if (CPPToolChainDictionary.ContainsKey(InPlatform) == true) { return CPPToolChainDictionary[InPlatform]; } throw new BuildException("GetPlatformToolChain: No tool chain found for {0}", InPlatform.ToString()); }
protected void RegisterRemoteToolChain(UnrealTargetPlatform InPlatform, CPPTargetPlatform CPPPlatform) { RemoteToolChainPlatform = InPlatform; // Register this tool chain for IOS Log.TraceVerbose(" Registered for {0}", CPPPlatform.ToString()); UEToolChain.RegisterPlatformToolChain(CPPPlatform, this); }
public static IUEToolChain GetPlatformToolChain(CPPTargetPlatform InPlatform) { if (CPPToolChainDictionary.ContainsKey(InPlatform) == true) { return(CPPToolChainDictionary[InPlatform]); } throw new BuildException("GetPlatformToolChain: No tool chain found for {0}", InPlatform.ToString()); }
/// <summary> /// Whether PDB files should be used /// </summary> /// <param name="InPlatform"> The CPPTargetPlatform being built</param> /// <param name="InConfiguration"> The CPPTargetConfiguration being built</param> /// <param name="bInCreateDebugInfo">true if debug info is getting create, false if not</param> /// <returns>bool true if PDB files should be used, false if not</returns> public override bool ShouldUsePDBFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration, bool bCreateDebugInfo) { // Only supported on PC. if (bCreateDebugInfo && ShouldUseIncrementalLinking(Platform, Configuration)) { return(true); } return(false); }
/// <summary> /// Initializes environment variables required by toolchain. Different for 32 and 64 bit. /// </summary> public static VCEnvironment SetEnvironment(CPPTargetPlatform Platform, bool bSupportWindowsXP) { if (EnvVars != null && EnvVars.Platform == Platform) { return(EnvVars); } EnvVars = new VCEnvironment(Platform, bSupportWindowsXP); return(EnvVars); }
/// <summary> /// Initializes environment variables required by toolchain. Different for 32 and 64 bit. /// </summary> public static VCEnvironment SetEnvironment(CPPTargetPlatform Platform, bool bSupportWindowsXP) { if (EnvVars != null && EnvVars.Platform == Platform) { return EnvVars; } EnvVars = new VCEnvironment(Platform, bSupportWindowsXP); return EnvVars; }
/** * Initializes environment variables required by toolchain. Different for 32 and 64 bit. */ public static VCEnvironment SetEnvironment(CPPTargetPlatform Platform) { if (EnvVars != null && EnvVars.Platform == Platform) { return EnvVars; } EnvVars = new VCEnvironment(Platform); return EnvVars; }
/** * Initializes environment variables required by toolchain. Different for 32 and 64 bit. */ public static VCEnvironment SetEnvironment(CPPTargetPlatform Platform) { if (EnvVars != null && EnvVars.Platform == Platform) { return(EnvVars); } EnvVars = new VCEnvironment(Platform); return(EnvVars); }
private VCEnvironment(CPPTargetPlatform InPlatform) { Platform = InPlatform; // If Visual Studio is not installed, the Windows SDK path will be used, which also happens to be the same // directory. (It installs the toolchain into the folder where Visual Studio would have installed it to). BaseVSToolPath = WindowsPlatform.GetVSComnToolsPath(); if (string.IsNullOrEmpty(BaseVSToolPath)) { throw new BuildException("Visual Studio 2012, 2013 or 2015 must be installed in order to build this target."); } WindowsSDKDir = FindWindowsSDKInstallationFolder(Platform); WindowsSDKExtensionDir = FindWindowsSDKExtensionInstallationFolder(); NetFxSDKExtensionDir = FindNetFxSDKExtensionInstallationFolder(); WindowsSDKExtensionHeaderLibVersion = FindWindowsSDKExtensionLatestVersion(WindowsSDKExtensionDir); PlatformVSToolPath = GetPlatformVSToolPath(Platform, BaseVSToolPath); CompilerPath = GetCompilerToolPath(PlatformVSToolPath); CLExeVersion = FindCLExeVersion(CompilerPath); LinkerPath = GetLinkerToolPath(PlatformVSToolPath); LibraryLinkerPath = GetLibraryLinkerToolPath(PlatformVSToolPath); ResourceCompilerPath = GetResourceCompilerToolPath(Platform); // We ensure an extra trailing slash because of a user getting an odd error where the paths seemed to get concatenated wrongly: // // C:\Programme\Microsoft Visual Studio 12.0\Common7\Tools../../VC/bin/x86_amd64/vcvarsx86_amd64.bat // // https://answers.unrealengine.com/questions/233640/unable-to-create-project-files-for-48-preview-3.html // bool bUse64BitCompiler = Platform == CPPTargetPlatform.Win64 || Platform == CPPTargetPlatform.UWP; string BaseToolPathWithTrailingSlash = BaseVSToolPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; string VCVarsBatchFile = Path.Combine(BaseToolPathWithTrailingSlash, bUse64BitCompiler ? @"..\..\VC\bin\x86_amd64\vcvarsx86_amd64.bat" : "vsvars32.bat"); if (Platform == CPPTargetPlatform.UWP && UWPPlatform.bBuildForStore) { Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile, "store"); } else { Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile); } // When targeting Windows XP on Visual Studio 2012+, we need to override the Windows SDK include and lib path set // by the batch file environment (http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx) if (WindowsPlatform.IsWindowsXPSupported()) { // Lib and bin folders have a x64 subfolder for 64 bit development. var ConfigSuffix = (Platform == CPPTargetPlatform.Win64) ? "\\x64" : ""; Environment.SetEnvironmentVariable("PATH", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "bin" + ConfigSuffix + ";%PATH%")); Environment.SetEnvironmentVariable("LIB", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "lib" + ConfigSuffix + ";%LIB%")); Environment.SetEnvironmentVariable("INCLUDE", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "include;%INCLUDE%")); } }
private VCEnvironment(CPPTargetPlatform InPlatform) { Platform = InPlatform; // If Visual Studio is not installed, the Windows SDK path will be used, which also happens to be the same // directory. (It installs the toolchain into the folder where Visual Studio would have installed it to). BaseVSToolPath = WindowsPlatform.GetVSComnToolsPath(); if (string.IsNullOrEmpty(BaseVSToolPath)) { throw new BuildException("Visual Studio 2012, 2013 or 2015 must be installed in order to build this target."); } WindowsSDKDir = FindWindowsSDKInstallationFolder(Platform); WindowsSDKExtensionDir = FindWindowsSDKExtensionInstallationFolder(); NetFxSDKExtensionDir = FindNetFxSDKExtensionInstallationFolder(); WindowsSDKExtensionHeaderLibVersion = FindWindowsSDKExtensionLatestVersion(WindowsSDKExtensionDir); PlatformVSToolPath = GetPlatformVSToolPath (Platform, BaseVSToolPath); CompilerPath = GetCompilerToolPath (PlatformVSToolPath); CLExeVersion = FindCLExeVersion (CompilerPath); LinkerPath = GetLinkerToolPath (PlatformVSToolPath); LibraryLinkerPath = GetLibraryLinkerToolPath (PlatformVSToolPath); ResourceCompilerPath = GetResourceCompilerToolPath(Platform); // We ensure an extra trailing slash because of a user getting an odd error where the paths seemed to get concatenated wrongly: // // C:\Programme\Microsoft Visual Studio 12.0\Common7\Tools../../VC/bin/x86_amd64/vcvarsx86_amd64.bat // // https://answers.unrealengine.com/questions/233640/unable-to-create-project-files-for-48-preview-3.html // bool bUse64BitCompiler = Platform == CPPTargetPlatform.Win64 || Platform == CPPTargetPlatform.UWP; string BaseToolPathWithTrailingSlash = BaseVSToolPath.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; string VCVarsBatchFile = Path.Combine(BaseToolPathWithTrailingSlash, bUse64BitCompiler ? @"..\..\VC\bin\x86_amd64\vcvarsx86_amd64.bat" : "vsvars32.bat"); if (Platform == CPPTargetPlatform.UWP && UWPPlatform.bBuildForStore) { Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile, "store"); } else { Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile); } // When targeting Windows XP on Visual Studio 2012+, we need to override the Windows SDK include and lib path set // by the batch file environment (http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx) if (WindowsPlatform.IsWindowsXPSupported()) { // Lib and bin folders have a x64 subfolder for 64 bit development. var ConfigSuffix = (Platform == CPPTargetPlatform.Win64) ? "\\x64" : ""; Environment.SetEnvironmentVariable("PATH", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "bin" + ConfigSuffix + ";%PATH%")); Environment.SetEnvironmentVariable("LIB", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "lib" + ConfigSuffix + ";%LIB%")); Environment.SetEnvironmentVariable("INCLUDE", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "include;%INCLUDE%")); } }
public static void RegisterPlatformToolChain(CPPTargetPlatform InPlatform, IUEToolChain InToolChain) { if (CPPToolChainDictionary.ContainsKey(InPlatform) == true) { Log.TraceInformation("RegisterPlatformToolChain Warning: Registering tool chain {0} for {1} when it is already set to {2}", InToolChain.ToString(), InPlatform.ToString(), CPPToolChainDictionary[InPlatform].ToString()); CPPToolChainDictionary[InPlatform] = InToolChain; } else { CPPToolChainDictionary.Add(InPlatform, InToolChain); } }
/** * Retrieve the UEBuildPlatform instance for the given CPPTargetPlatform * * @param InPlatform The CPPTargetPlatform being built * @param bInAllowFailure If true, do not throw an exception and return null * * @return UEBuildPlatform The instance of the build platform */ public static UEBuildPlatform GetBuildPlatformForCPPTargetPlatform(CPPTargetPlatform InPlatform, bool bInAllowFailure = false) { UnrealTargetPlatform UTPlatform = UEBuildTarget.CPPTargetPlatformToUnrealTargetPlatform(InPlatform); if (BuildPlatformDictionary.ContainsKey(UTPlatform) == true) { return BuildPlatformDictionary[UTPlatform]; } if (bInAllowFailure == true) { return null; } throw new BuildException("UEBuildPlatform::GetBuildPlatformForCPPTargetPlatform: No BuildPlatform found for {0}", InPlatform.ToString()); }
/** Accesses the bin directory for the VC toolchain for the specified platform. */ static string GetVCToolPath(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration, string ToolName) { // Initialize environment variables required for spawned tools. InitializeEnvironmentVariables(Platform); // Out variable that is going to contain fully qualified path to executable upon return. string VCToolPath = ""; // is target 64-bit? bool bIsTarget64Bit = true; // We need to differentiate between 32 and 64 bit toolchain on Windows. { // rc.exe resides in the Windows SDK folder. if (ToolName.ToUpperInvariant() == "RC") { // 64 bit -- we can use the 32 bit version to target 64 bit on 32 bit OS. if (bIsTarget64Bit) { VCToolPath = Path.Combine(WindowsSDKDir, "bin/x64/rc.exe"); } // 32 bit else { VCToolPath = Path.Combine(WindowsSDKDir, "bin/x86/rc.exe"); } } // cl.exe and link.exe are found in the toolchain specific folders (32 vs. 64 bit). We do however use the 64 bit linker if available // even when targeting 32 bit as it's noticeably faster. else { // Grab path to Visual Studio binaries from the system environment string BaseVSToolPath = WindowsPlatform.GetVSComnToolsPath(WindowsCompiler.VisualStudio2012); if (string.IsNullOrEmpty(BaseVSToolPath)) { throw new BuildException("Visual Studio 2012 must be installed in order to build this target."); } if (Platform == CPPTargetPlatform.WinRT_ARM) { VCToolPath = Path.Combine(BaseVSToolPath, "../../VC/bin/x86_arm/" + ToolName + ".exe"); } else { VCToolPath = Path.Combine(BaseVSToolPath, "../../VC/bin/amd64/" + ToolName + ".exe"); } } } return(VCToolPath); }
/** Gets the path to the resource compiler's rc.exe for the specified platform. */ static string GetResourceCompilerToolPath(CPPTargetPlatform Platform, string WindowsSDKDir) { // 64 bit -- we can use the 32 bit version to target 64 bit on 32 bit OS. if (Platform == CPPTargetPlatform.Win64) { return(Path.Combine(WindowsSDKDir, "bin/x64/rc.exe")); } if (!WindowsPlatform.IsWindowsXPSupported()) // Windows XP requires use to force Windows SDK 7.1 even on the newer compiler, so we need the old path RC.exe { return(Path.Combine(WindowsSDKDir, "bin/x86/rc.exe")); } return(Path.Combine(WindowsSDKDir, "bin/rc.exe")); }
private VCEnvironment(CPPTargetPlatform InPlatform) { Platform = InPlatform; // If Visual Studio is not installed, the Windows SDK path will be used, which also happens to be the same // directory. (It installs the toolchain into the folder where Visual Studio would have installed it to). BaseVSToolPath = WindowsPlatform.GetVSComnToolsPath(); if (string.IsNullOrEmpty(BaseVSToolPath)) { throw new BuildException("Visual Studio 2012, 2013 or 2015 must be installed in order to build this target."); } WindowsSDKDir = FindWindowsSDKInstallationFolder(Platform); WindowsSDKExtensionDir = FindWindowsSDKExtensionInstallationFolder(); NetFxSDKExtensionDir = FindNetFxSDKExtensionInstallationFolder(); WindowsSDKExtensionHeaderLibVersion = FindWindowsSDKExtensionLatestVersion(WindowsSDKExtensionDir); PlatformVSToolPath = GetPlatformVSToolPath(Platform, BaseVSToolPath); CompilerPath = GetCompilerToolPath(PlatformVSToolPath); CLExeVersion = FindCLExeVersion(CompilerPath); LinkerPath = GetLinkerToolPath(PlatformVSToolPath); LibraryLinkerPath = GetLibraryLinkerToolPath(PlatformVSToolPath); ResourceCompilerPath = GetResourceCompilerToolPath(Platform); var VCVarsBatchFile = Path.Combine(BaseVSToolPath, (Platform == CPPTargetPlatform.Win64 || Platform == CPPTargetPlatform.UWP) ? "../../VC/bin/x86_amd64/vcvarsx86_amd64.bat" : "vsvars32.bat"); if (Platform == CPPTargetPlatform.UWP && UWPPlatform.bBuildForStore) { Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile, "store"); } else { Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile); } // When targeting Windows XP on Visual Studio 2012+, we need to override the Windows SDK include and lib path set // by the batch file environment (http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx) if (WindowsPlatform.IsWindowsXPSupported()) { // Lib and bin folders have a x64 subfolder for 64 bit development. var ConfigSuffix = (Platform == CPPTargetPlatform.Win64) ? "\\x64" : ""; Environment.SetEnvironmentVariable("PATH", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "bin" + ConfigSuffix + ";%PATH%")); Environment.SetEnvironmentVariable("LIB", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "lib" + ConfigSuffix + ";%LIB%")); Environment.SetEnvironmentVariable("INCLUDE", Utils.ResolveEnvironmentVariable(WindowsSDKDir + "include;%INCLUDE%")); } }
public override void ValidateBuildConfiguration(CPPTargetConfiguration Configuration, CPPTargetPlatform Platform, bool bCreateDebugInfo) { if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac) { // @todo: Temporarily disable precompiled header files when building remotely due to errors BuildConfiguration.bUsePCHFiles = false; } BuildConfiguration.bCheckExternalHeadersForModification = BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac; BuildConfiguration.bCheckSystemHeadersForModification = BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac; BuildConfiguration.ProcessorCountMultiplier = MacToolChain.GetAdjustedProcessorCountMultiplier(); BuildConfiguration.bUseSharedPCHs = false; BuildConfiguration.bUsePDBFiles = bCreateDebugInfo && Configuration != CPPTargetConfiguration.Debug && Platform == CPPTargetPlatform.Mac && BuildConfiguration.bGeneratedSYMFile; // we always deploy - the build machines need to be able to copy the files back, which needs the full bundle BuildConfiguration.bDeployAfterCompile = true; }
/** Accesses the directory for .NET Framework binaries such as MSBuild */ static string GetDotNetFrameworkToolPath(CPPTargetPlatform Platform, string ToolName) { // Initialize environment variables required for spawned tools. InitializeEnvironmentVariables(Platform); string FrameworkDirectory = Environment.GetEnvironmentVariable("FrameworkDir"); string FrameworkVersion = Environment.GetEnvironmentVariable("FrameworkVersion"); if (FrameworkDirectory == null || FrameworkVersion == null) { throw new BuildException("NOTE: Please ensure that 64bit Tools are installed with DevStudio - there is usually an option to install these during install"); } string DotNetFrameworkBinDir = Path.Combine(FrameworkDirectory, FrameworkVersion); string ToolPath = Path.Combine(DotNetFrameworkBinDir, ToolName + ".exe"); return(ToolPath); }
/// <summary> /// Gets the path to the compiler. /// </summary> static FileReference GetCompilerToolPath(CPPTargetPlatform Platform, DirectoryReference PlatformVSToolPath) { // If we were asked to use Clang, then we'll redirect the path to the compiler to the LLVM installation directory if (WindowsPlatform.bCompileWithClang) { string CompilerDriverName; string Result; if (WindowsPlatform.bUseVCCompilerArgs) { // Use 'clang-cl', a wrapper around Clang that supports Visual C++ compiler command-line arguments CompilerDriverName = "clang-cl.exe"; } else { // Use regular Clang compiler on Windows CompilerDriverName = "clang.exe"; } Result = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "LLVM", "bin", CompilerDriverName); if (!File.Exists(Result)) { Result = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "LLVM", "bin", CompilerDriverName); } if (!File.Exists(Result)) { throw new BuildException("Clang was selected as the Windows compiler, but LLVM/Clang does not appear to be installed. Could not find: " + Result); } return(new FileReference(Result)); } if (WindowsPlatform.bCompileWithICL) { var Result = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IntelSWTools", "compilers_and_libraries", "windows", "bin", Platform == CPPTargetPlatform.Win32 ? "ia32" : "intel64", "icl.exe"); if (!File.Exists(Result)) { throw new BuildException("ICL was selected as the Windows compiler, but does not appear to be installed. Could not find: " + Result); } return(new FileReference(Result)); } return(FileReference.Combine(PlatformVSToolPath, "cl.exe")); }
/// <summary> /// Gets the path to the library linker. /// </summary> static FileReference GetLibraryLinkerToolPath(CPPTargetPlatform Platform, DirectoryReference PlatformVSToolPath) { // 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) //@todo.WIN32: Using the 64-bit linker appears to be broken at the moment. if (WindowsPlatform.bCompileWithICL && WindowsPlatform.bAllowICLLinker) { var Result = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "IntelSWTools", "compilers_and_libraries", "windows", "bin", Platform == CPPTargetPlatform.Win32 ? "ia32" : "intel64", "xilib.exe"); if (!File.Exists(Result)) { throw new BuildException("ICL was selected as the Windows compiler, but does not appear to be installed. Could not find: " + Result); } return(new FileReference(Result)); } return(FileReference.Combine(PlatformVSToolPath, "lib.exe")); }
/** Gets the path to the tool binaries for the specified platform. */ static string GetPlatformVSToolPath(CPPTargetPlatform Platform, string BaseVSToolPath) { // 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) //@todo.WIN32: Using the 64-bit linker appears to be broken at the moment. if (Platform == CPPTargetPlatform.Win64 || Platform == CPPTargetPlatform.UWP) { // Use the native 64-bit compiler if present, otherwise use the amd64-on-x86 compiler. VS2012 Express only includes the latter. var Result = Path.Combine(BaseVSToolPath, "../../VC/bin/amd64"); if (Directory.Exists(Result)) { return(Result); } return(Path.Combine(BaseVSToolPath, "../../VC/bin/x86_amd64")); } return(Path.Combine(BaseVSToolPath, "../../VC/bin")); }
/** Gets the default include paths for the given platform. */ public static string GetVCIncludePaths(CPPTargetPlatform Platform) { Debug.Assert(Platform == CPPTargetPlatform.Win32 || Platform == CPPTargetPlatform.Win64); // Make sure we've got the environment variables set up for this target VCEnvironment.SetEnvironment(Platform); // Also add any include paths from the INCLUDE environment variable. MSVC is not necessarily running with an environment that // matches what UBT extracted from the vcvars*.bat using SetEnvironmentVariablesFromBatchFile(). We'll use the variables we // extracted to populate the project file's list of include paths // @todo projectfiles: Should we only do this for VC++ platforms? var IncludePaths = Environment.GetEnvironmentVariable("INCLUDE"); if (!String.IsNullOrEmpty(IncludePaths) && !IncludePaths.EndsWith(";")) { IncludePaths += ";"; } return IncludePaths; }
/// <summary> /// Gets the default include paths for the given platform. /// </summary> public static string GetVCIncludePaths(CPPTargetPlatform Platform) { Debug.Assert(Platform == CPPTargetPlatform.UWP); // Make sure we've got the environment variables set up for this target VCEnvironment.SetEnvironment(Platform, false); // Also add any include paths from the INCLUDE environment variable. MSVC is not necessarily running with an environment that // matches what UBT extracted from the vcvars*.bat using SetEnvironmentVariablesFromBatchFile(). We'll use the variables we // extracted to populate the project file's list of include paths // @todo projectfiles: Should we only do this for VC++ platforms? var IncludePaths = Environment.GetEnvironmentVariable("INCLUDE"); if (!String.IsNullOrEmpty(IncludePaths) && !IncludePaths.EndsWith(";")) { IncludePaths += ";"; } return(IncludePaths); }
/** * Initializes environment variables required by toolchain. Different for 32 and 64 bit. */ static void InitializeEnvironmentVariables(CPPTargetPlatform Platform) { if (!bAreEnvironmentVariablesAlreadyInitialized) { string VCVarsBatchFile = ""; // Grab path to Visual Studio binaries from the system environment string BaseVSToolPath = WindowsPlatform.GetVSComnToolsPath(WindowsCompiler.VisualStudio2012); if (string.IsNullOrEmpty(BaseVSToolPath)) { BaseVSToolPath = "C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/Tools/"; if (Directory.Exists("C:/Program Files (x86)/Microsoft Visual Studio 11.0/Common7/Tools/") == false) { throw new BuildException("Visual Studio 2012 must be installed in order to build this target."); } } // 64 bit tool chain. if (Platform == CPPTargetPlatform.WinRT_ARM) { VCVarsBatchFile = Path.Combine(BaseVSToolPath, "../../VC/bin/x86_arm/vcvarsx86_arm.bat"); } else { VCVarsBatchFile = Path.Combine(BaseVSToolPath, "../../VC/bin/x86_amd64/vcvarsx86_amd64.bat"); } // @todo: This is failing when building the Win32 target through NMake!!!! Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile); if (WinRTPlatform.ShouldCompileWinRT() == true) { string EnvVarName = Utils.ResolveEnvironmentVariable(WindowsSDKDir + "Windows Metadata" + ";%LIBPATH%"); Environment.SetEnvironmentVariable("LIBPATH", EnvVarName); } bAreEnvironmentVariablesAlreadyInitialized = true; } }
public UEToolChain(CPPTargetPlatform InCppPlatform) { CppPlatform = InCppPlatform; }
/** * Whether PDB files should be used * * @param InPlatform The CPPTargetPlatform being built * @param InConfiguration The CPPTargetConfiguration being built * @param bInCreateDebugInfo true if debug info is getting create, false if not * * @return bool true if PDB files should be used, false if not */ public override bool ShouldUsePDBFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration, bool bCreateDebugInfo) { // Only supported on PC. if (bCreateDebugInfo && ShouldUseIncrementalLinking(Platform, Configuration)) { return true; } return false; }
public override void ValidateBuildConfiguration(CPPTargetConfiguration Configuration, CPPTargetPlatform Platform, bool bCreateDebugInfo) { if( WindowsPlatform.bCompileWithClang ) { // @todo clang: Shared PCHs don't work on clang yet because the PCH will have definitions assigned to different values // than the consuming translation unit. Unlike the warning in MSVC, this is a compile in Clang error which cannot be suppressed BuildConfiguration.bUseSharedPCHs = false; // @todo clang: PCH files aren't supported by "clang-cl" yet (no /Yc support, and "-x c++-header" cannot be specified) if( WindowsPlatform.bUseVCCompilerArgs ) { BuildConfiguration.bUsePCHFiles = false; } } }
/** Accesses the bin directory for the VC toolchain for the specified platform. */ static string GetVCToolPath(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration, string ToolName) { // Initialize environment variables required for spawned tools. InitializeEnvironmentVariables(Platform); // Out variable that is going to contain fully qualified path to executable upon return. string VCToolPath = ""; // is target 64-bit? bool bIsTarget64Bit = true; // We need to differentiate between 32 and 64 bit toolchain on Windows. { // rc.exe resides in the Windows SDK folder. if (ToolName.ToUpperInvariant() == "RC") { // 64 bit -- we can use the 32 bit version to target 64 bit on 32 bit OS. if (bIsTarget64Bit) { VCToolPath = Path.Combine(WindowsSDKDir, "bin/x64/rc.exe"); } // 32 bit else { VCToolPath = Path.Combine(WindowsSDKDir, "bin/x86/rc.exe"); } } // cl.exe and link.exe are found in the toolchain specific folders (32 vs. 64 bit). We do however use the 64 bit linker if available // even when targeting 32 bit as it's noticeably faster. else { // Grab path to Visual Studio binaries from the system environment string BaseVSToolPath = WindowsPlatform.GetVSComnToolsPath(WindowsCompiler.VisualStudio2012); if (string.IsNullOrEmpty(BaseVSToolPath)) { throw new BuildException("Visual Studio 2012 must be installed in order to build this target."); } if (Platform == CPPTargetPlatform.WinRT_ARM) { VCToolPath = Path.Combine(BaseVSToolPath, "../../VC/bin/x86_arm/" + ToolName + ".exe"); } else { VCToolPath = Path.Combine(BaseVSToolPath, "../../VC/bin/amd64/" + ToolName + ".exe"); } } } return VCToolPath; }
/// <summary> /// Creates a toolchain instance for the given platform. /// </summary> /// <param name="Platform">The platform to create a toolchain for</param> /// <returns>New toolchain instance.</returns> public override UEToolChain CreateToolChain(CPPTargetPlatform Platform) { return new IOSToolChain(ProjectFile, this); }
/// <summary> /// Whether PDB files should be used /// </summary> /// <param name="InPlatform"> The CPPTargetPlatform being built</param> /// <param name="InConfiguration"> The CPPTargetConfiguration being built</param> /// <param name="bInCreateDebugInfo">true if debug info is getting create, false if not</param> /// <returns>bool true if PDB files should be used, false if not</returns> public override bool ShouldUsePDBFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration, bool bCreateDebugInfo) { return(bCreateDebugInfo); }
protected IOSPlatform(IOSPlatformSDK InSDK, UnrealTargetPlatform TargetPlatform, CPPTargetPlatform CPPPlatform) : base(TargetPlatform, CPPPlatform) { SDK = InSDK; }
private VCEnvironment(CPPTargetPlatform InPlatform, bool bSupportWindowsXP) { Platform = InPlatform; // If Visual Studio is not installed, the Windows SDK path will be used, which also happens to be the same // directory. (It installs the toolchain into the folder where Visual Studio would have installed it to). BaseVSToolPath = WindowsPlatform.GetVSComnToolsPath(); if (string.IsNullOrEmpty(BaseVSToolPath)) { throw new BuildException("Visual Studio 2015 must be installed in order to build this target."); } WindowsSDKDir = FindWindowsSDKInstallationFolder(Platform, bSupportWindowsXP); WindowsSDKLibVersion = FindWindowsSDKLibVersion(WindowsSDKDir); WindowsSDKExtensionDir = FindWindowsSDKExtensionInstallationFolder(); NetFxSDKExtensionDir = FindNetFxSDKExtensionInstallationFolder(); VisualCppDir = FindVisualCppInstallationFolder(WindowsPlatform.Compiler); WindowsSDKExtensionHeaderLibVersion = FindWindowsSDKExtensionLatestVersion(WindowsSDKExtensionDir); UniversalCRTDir = FindUniversalCRTInstallationFolder(); UniversalCRTVersion = FindUniversalCRTVersion(UniversalCRTDir); VSToolPath32Bit = GetVSToolPath32Bit(BaseVSToolPath); VSToolPath64Bit = GetVSToolPath64Bit(BaseVSToolPath); // Compile using 64 bit tools for 64 bit targets, and 32 for 32. string CompilerVSToolPath = (Platform == CPPTargetPlatform.Win64 || Platform == CPPTargetPlatform.UWP) ? VSToolPath64Bit : VSToolPath32Bit; // 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) string LinkerVSToolPath = VSToolPath64Bit; CompilerPath = GetCompilerToolPath(CompilerVSToolPath); CLExeVersion = FindCLExeVersion(CompilerPath); LinkerPath = GetLinkerToolPath(LinkerVSToolPath); LibraryLinkerPath = GetLibraryLinkerToolPath(LinkerVSToolPath); ResourceCompilerPath = GetResourceCompilerToolPath(Platform, bSupportWindowsXP); // Make sure the base 32-bit VS tool path is in the PATH, regardless of which configuration we're using. The toolchain may need to reference support DLLs from this directory (eg. mspdb120.dll). string PathEnvironmentVariable = Environment.GetEnvironmentVariable("PATH"); if (!PathEnvironmentVariable.Split(';').Any(x => String.Compare(x, VSToolPath32Bit, true) == 0)) { PathEnvironmentVariable = VSToolPath32Bit + ";" + PathEnvironmentVariable; Environment.SetEnvironmentVariable("PATH", PathEnvironmentVariable); } // Setup the INCLUDE environment variable List <string> IncludePaths = GetVisualCppIncludePaths(VisualCppDir, UniversalCRTDir, UniversalCRTVersion, NetFxSDKExtensionDir, WindowsSDKDir, WindowsSDKLibVersion); if (InitialIncludePaths != null) { IncludePaths.Add(InitialIncludePaths); } Environment.SetEnvironmentVariable("INCLUDE", String.Join(";", IncludePaths)); // Setup the LIB environment variable List <string> LibraryPaths = GetVisualCppLibraryPaths(VisualCppDir, UniversalCRTDir, UniversalCRTVersion, NetFxSDKExtensionDir, WindowsSDKDir, WindowsSDKLibVersion, Platform); if (InitialLibraryPaths != null) { LibraryPaths.Add(InitialLibraryPaths); } Environment.SetEnvironmentVariable("LIB", String.Join(";", LibraryPaths)); }
/// <summary> /// Sets the Visual C++ LIB environment variable /// </summary> static List <string> GetVisualCppLibraryPaths(string VisualCppDir, string UniversalCRTDir, string UniversalCRTVersion, string NetFXSDKDir, string WindowsSDKDir, string WindowsSDKLibVersion, CPPTargetPlatform Platform) { List <string> LibraryPaths = new List <string>(); // Add the standard Visual C++ library paths if (Platform == CPPTargetPlatform.UWP && UWPPlatform.bBuildForStore) { string StoreLibraryDir = Path.Combine(VisualCppDir, "LIB", "amd64", "store"); if (Directory.Exists(StoreLibraryDir)) { LibraryPaths.Add(StoreLibraryDir); } } else if (Platform == CPPTargetPlatform.Win32) { string StdLibraryDir = Path.Combine(VisualCppDir, "LIB"); if (Directory.Exists(StdLibraryDir)) { LibraryPaths.Add(StdLibraryDir); } string AtlMfcLibraryDir = Path.Combine(VisualCppDir, "ATLMFC", "LIB"); if (Directory.Exists(AtlMfcLibraryDir)) { LibraryPaths.Add(AtlMfcLibraryDir); } } else { string StdLibraryDir = Path.Combine(VisualCppDir, "LIB", "amd64"); if (Directory.Exists(StdLibraryDir)) { LibraryPaths.Add(StdLibraryDir); } string AtlMfcLibraryDir = Path.Combine(VisualCppDir, "ATLMFC", "LIB", "amd64"); if (Directory.Exists(AtlMfcLibraryDir)) { LibraryPaths.Add(AtlMfcLibraryDir); } } // Add the Universal CRT if (!String.IsNullOrEmpty(UniversalCRTDir) && !String.IsNullOrEmpty(UniversalCRTVersion)) { if (Platform == CPPTargetPlatform.Win32) { LibraryPaths.Add(Path.Combine(UniversalCRTDir, "lib", UniversalCRTVersion, "ucrt", "x86")); } else { LibraryPaths.Add(Path.Combine(UniversalCRTDir, "lib", UniversalCRTVersion, "ucrt", "x64")); } } // Add the NETFXSDK include path if (!String.IsNullOrEmpty(NetFXSDKDir)) { if (Platform == CPPTargetPlatform.Win32) { LibraryPaths.Add(Path.Combine(NetFXSDKDir, "lib", "um", "x86")); } else { LibraryPaths.Add(Path.Combine(NetFXSDKDir, "lib", "um", "x64")); } } // Add the standard Windows SDK paths if (Platform == CPPTargetPlatform.Win32) { LibraryPaths.Add(Path.Combine(WindowsSDKDir, "lib", WindowsSDKLibVersion, "um", "x86")); } else { LibraryPaths.Add(Path.Combine(WindowsSDKDir, "lib", WindowsSDKLibVersion, "um", "x64")); } // Add the existing library paths string ExistingLibraryPaths = Environment.GetEnvironmentVariable("LIB"); if (ExistingLibraryPaths != null) { LibraryPaths.AddRange(ExistingLibraryPaths.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); } return(LibraryPaths); }
public override void ValidateBuildConfiguration(CPPTargetConfiguration Configuration, CPPTargetPlatform Platform, bool bCreateDebugInfo) { // check the base first base.ValidateBuildConfiguration(Configuration, Platform, bCreateDebugInfo); BuildConfiguration.bUsePCHFiles = false; BuildConfiguration.bUseSharedPCHs = false; BuildConfiguration.bCheckExternalHeadersForModification = false; BuildConfiguration.bCheckSystemHeadersForModification = false; BuildConfiguration.ProcessorCountMultiplier = IOSToolChain.GetAdjustedProcessorCountMultiplier(); BuildConfiguration.bDeployAfterCompile = true; }
/** Accesses the directory for .NET Framework binaries such as MSBuild */ static string GetDotNetFrameworkToolPath(CPPTargetPlatform Platform, string ToolName) { // Initialize environment variables required for spawned tools. InitializeEnvironmentVariables(Platform); string FrameworkDirectory = Environment.GetEnvironmentVariable("FrameworkDir"); string FrameworkVersion = Environment.GetEnvironmentVariable("FrameworkVersion"); if (FrameworkDirectory == null || FrameworkVersion == null) { throw new BuildException("NOTE: Please ensure that 64bit Tools are installed with DevStudio - there is usually an option to install these during install"); } string DotNetFrameworkBinDir = Path.Combine(FrameworkDirectory, FrameworkVersion); string ToolPath = Path.Combine(DotNetFrameworkBinDir, ToolName + ".exe"); return ToolPath; }
/** * Validate configuration for this platform * NOTE: This function can/will modify BuildConfiguration! * * @param InPlatform The CPPTargetPlatform being built * @param InConfiguration The CPPTargetConfiguration being built * @param bInCreateDebugInfo true if debug info is getting create, false if not */ public override void ValidateBuildConfiguration(CPPTargetConfiguration Configuration, CPPTargetPlatform Platform, bool bCreateDebugInfo) { UEBuildConfiguration.bCompileSimplygon = false; }
public override bool ShouldUsePCHFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration) { return true; }
public override UEToolChain CreateToolChain(CPPTargetPlatform Platform) { return new AndroidToolChain(ProjectFile); }
/// <returns>The path to Windows SDK directory for the specified version.</returns> private static string FindWindowsSDKInstallationFolder(CPPTargetPlatform InPlatform) { // When targeting Windows XP on Visual Studio 2012+, we need to point at the older Windows SDK 7.1A that comes // installed with Visual Studio 2012 Update 1. (http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx) string Version; if (WindowsPlatform.IsWindowsXPSupported()) { Version = "v7.1A"; } else switch (WindowsPlatform.Compiler) { case WindowsCompiler.VisualStudio2015: if( WindowsPlatform.bUseWindowsSDK10 ) { Version = "v10.0"; } else { Version = "v8.1"; } break; case WindowsCompiler.VisualStudio2013: Version = "v8.1"; break; case WindowsCompiler.VisualStudio2012: Version = "v8.0"; break; default: throw new BuildException("Unexpected compiler setting when trying to determine Windows SDK folder"); } // Based on VCVarsQueryRegistry string FinalResult = null; foreach (string IndividualVersion in Version.Split('|')) { var Result = Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SDKs\Windows\" + IndividualVersion, "InstallationFolder", null) ?? Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\" + IndividualVersion, "InstallationFolder", null) ?? Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\" + IndividualVersion, "InstallationFolder", null); if (Result != null) { FinalResult = (string)Result; break; } } if (FinalResult == null) { throw new BuildException("Windows SDK {0} must be installed in order to build this target.", Version); } return FinalResult; }
/// <summary> /// Whether incremental linking should be used /// </summary> /// <param name="InPlatform"> The CPPTargetPlatform being built</param> /// <param name="InConfiguration"> The CPPTargetConfiguration being built</param> /// <returns>bool true if incremental linking should be used, false if not</returns> public override bool ShouldUseIncrementalLinking(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration) { return(Configuration == CPPTargetConfiguration.Debug); }
/// <summary> /// Creates a toolchain instance for the given platform. /// </summary> /// <param name="Platform">The platform to create a toolchain for</param> /// <returns>New toolchain instance.</returns> public override UEToolChain CreateToolChain(CPPTargetPlatform Platform) { return(new HTML5ToolChain()); }
/** Gets the path to the tool binaries for the specified platform. */ static string GetPlatformVSToolPath(CPPTargetPlatform Platform, string BaseVSToolPath) { // 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) //@todo.WIN32: Using the 64-bit linker appears to be broken at the moment. if (Platform == CPPTargetPlatform.Win64 || Platform == CPPTargetPlatform.UWP) { // Use the native 64-bit compiler if present, otherwise use the amd64-on-x86 compiler. VS2012 Express only includes the latter. var Result = Path.Combine(BaseVSToolPath, "../../VC/bin/amd64"); if (Directory.Exists(Result)) { return Result; } return Path.Combine(BaseVSToolPath, "../../VC/bin/x86_amd64"); } return Path.Combine(BaseVSToolPath, "../../VC/bin"); }
/// <summary> /// Whether PCH files should be used /// </summary> /// <param name="InPlatform"> The CPPTargetPlatform being built</param> /// <param name="InConfiguration"> The CPPTargetConfiguration being built</param> /// <returns>bool true if PCH files should be used, false if not</returns> public override bool ShouldUsePCHFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration) { return(false); }
/** * Whether PDB files should be used * * @param InPlatform The CPPTargetPlatform being built * @param InConfiguration The CPPTargetConfiguration being built * @param bInCreateDebugInfo true if debug info is getting create, false if not * * @return bool true if PDB files should be used, false if not */ public override bool ShouldUsePDBFiles(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration, bool bCreateDebugInfo) { return true; }
/** * Whether incremental linking should be used * * @param InPlatform The CPPTargetPlatform being built * @param InConfiguration The CPPTargetConfiguration being built * * @return bool true if incremental linking should be used, false if not */ public override bool ShouldUseIncrementalLinking(CPPTargetPlatform Platform, CPPTargetConfiguration Configuration) { return (Configuration == CPPTargetConfiguration.Debug); }
public TargetInfo(TargetInfo Target) { Platform = Target.Platform; Architecture = Target.Architecture; Configuration = Target.Configuration; }
/** Gets the path to the resource compiler's rc.exe for the specified platform. */ string GetResourceCompilerToolPath(CPPTargetPlatform Platform) { // 64 bit -- we can use the 32 bit version to target 64 bit on 32 bit OS. if (Platform == CPPTargetPlatform.Win64 || Platform == CPPTargetPlatform.UWP) { if (WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2015 && WindowsPlatform.bUseWindowsSDK10) { return Path.Combine(WindowsSDKExtensionDir, "bin/x64/rc.exe"); } else { return Path.Combine(WindowsSDKDir, "bin/x64/rc.exe"); } } // @todo UWP: Verify that Windows XP will compile using VS 2015 (it should be supported) if (!WindowsPlatform.IsWindowsXPSupported()) // Windows XP requires use to force Windows SDK 7.1 even on the newer compiler, so we need the old path RC.exe { if (WindowsPlatform.Compiler == WindowsCompiler.VisualStudio2015 && WindowsPlatform.bUseWindowsSDK10) { return Path.Combine(WindowsSDKExtensionDir, "bin/x86/rc.exe"); } else { return Path.Combine(WindowsSDKDir, "bin/x86/rc.exe"); } } return Path.Combine(WindowsSDKDir, "bin/rc.exe"); }
/// <summary> /// Validates the configuration. E.g. some options are mutually exclusive whereof some imply others. Also /// some functionality is not available on all platforms. /// @warning: the order of validation is important /// </summary> /// <param name="Configuration">Current configuration (e.g. development, debug, ...)</param> /// <param name="Platform">Current platform (e.g. Win32, PS3, ...)</param> /// <param name="bCreateDebugInfo">True if debug info should be created</param> public static void ValidateConfiguration(CPPTargetConfiguration Configuration, CPPTargetPlatform Platform, bool bCreateDebugInfo) { var BuildPlatform = UEBuildPlatform.GetBuildPlatformForCPPTargetPlatform(Platform); // E&C support. if( bSupportEditAndContinue ) { bUseIncrementalLinking = BuildPlatform.ShouldUseIncrementalLinking(Platform, Configuration); } // Incremental linking. if (bUseIncrementalLinking) { bUsePDBFiles = BuildPlatform.ShouldUsePDBFiles(Platform, Configuration, bCreateDebugInfo); } // Detailed stats if (bLogDetailedActionStats && bAllowXGE) { // Some build machines apparently have this turned on, so if you really want detailed stats, don't run with XGE bLogDetailedActionStats = false; } if (UnrealBuildTool.RunningRocket()) { bAllowXGE = false; } // PDB if (bUsePDBFiles) { // NOTE: Currently we allow XGE to run, even with PDBs, until we notice an issue with this bool bDisallowXGEWithPDBFiles = false; if (bDisallowXGEWithPDBFiles) { // Force local execution as we have one PDB for all files using the same PCH. This currently doesn't // scale well with XGE due to required networking bandwidth. Xoreax mentioned that this was going to // be fixed in a future version of the software. bAllowXGE = false; } } // Allow for the build platform to perform custom validation here... // NOTE: This CAN modify the static BuildConfiguration settings!!!! BuildPlatform.ValidateBuildConfiguration(Configuration, Platform, bCreateDebugInfo); if (!BuildPlatform.CanUseXGE()) { bAllowXGE = false; } if (!BuildPlatform.CanUseDistcc()) { bAllowDistcc = false; } }
/** Copy constructor. */ public LinkEnvironmentConfiguration(LinkEnvironmentConfiguration InCopyEnvironment) { OutputDirectory = InCopyEnvironment.OutputDirectory; IntermediateDirectory = InCopyEnvironment.IntermediateDirectory; LocalShadowDirectory = InCopyEnvironment.LocalShadowDirectory; OutputFilePath = InCopyEnvironment.OutputFilePath; TargetPlatform = InCopyEnvironment.TargetPlatform; TargetConfiguration = InCopyEnvironment.TargetConfiguration; TargetArchitecture = InCopyEnvironment.TargetArchitecture; LibraryPaths.AddRange(InCopyEnvironment.LibraryPaths); ExcludedLibraries.AddRange(InCopyEnvironment.ExcludedLibraries); AdditionalLibraries.AddRange(InCopyEnvironment.AdditionalLibraries); Frameworks.AddRange(InCopyEnvironment.Frameworks); AdditionalFrameworks.AddRange(InCopyEnvironment.AdditionalFrameworks); WeakFrameworks.AddRange(InCopyEnvironment.WeakFrameworks); DelayLoadDLLs.AddRange(InCopyEnvironment.DelayLoadDLLs); AdditionalArguments = InCopyEnvironment.AdditionalArguments; bCreateDebugInfo = InCopyEnvironment.bCreateDebugInfo; CLRMode = InCopyEnvironment.CLRMode; bIsBuildingLibrary = InCopyEnvironment.bIsBuildingLibrary; bIsBuildingDLL = InCopyEnvironment.bIsBuildingDLL; bIsBuildingConsoleApplication = InCopyEnvironment.bIsBuildingConsoleApplication; bBuildAdditionalConsoleApplication = InCopyEnvironment.bBuildAdditionalConsoleApplication; WindowsEntryPointOverride = InCopyEnvironment.WindowsEntryPointOverride; bIsCrossReferenced = InCopyEnvironment.bIsCrossReferenced; bHasExports = InCopyEnvironment.bHasExports; bIsBuildingDotNetAssembly = InCopyEnvironment.bIsBuildingDotNetAssembly; }