本文整理汇总了C#中CPPTargetPlatform类的典型用法代码示例。如果您正苦于以下问题:C# CPPTargetPlatform类的具体用法?C# CPPTargetPlatform怎么用?C# CPPTargetPlatform使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CPPTargetPlatform类属于命名空间,在下文中一共展示了CPPTargetPlatform类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VCEnvironment
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%"));
}
}
示例2: VCEnvironment
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));
}
示例3: GetPlatformToolChain
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());
}
示例4: RegisterRemoteToolChain
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);
}
示例5: SetEnvironment
/// <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;
}
示例6: SetEnvironment
/**
* 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;
}
示例7: VCEnvironment
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%"));
}
}
示例8: RegisterPlatformToolChain
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);
}
}
示例9: GetBuildPlatformForCPPTargetPlatform
/**
* 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());
}
示例10: ValidateBuildConfiguration
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;
}
示例11: GetVCIncludePaths
/** 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;
}
示例12: CreateToolChain
public override UEToolChain CreateToolChain(CPPTargetPlatform Platform)
{
return new AndroidToolChain(ProjectFile);
}
示例13: GetResourceCompilerToolPath
/** 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");
}
示例14: GetPlatformVSToolPath
/** 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");
}
示例15: FindWindowsSDKInstallationFolder
/// <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;
}