本文整理汇总了C#中CPPTargetPlatform类的典型用法代码示例。如果您正苦于以下问题:C#CPPTargetPlatform类的具体用法?C#CPPTargetPlatform怎么用?C#CPPTargetPlatform使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:VCEnvironment
privateVCEnvironment(CPPTargetPlatformInPlatform)
{
Platform=InPlatform;
//IfVisualStudioisnotinstalled,theWindowsSDKpathwillbeused,whichalsohappenstobethesame
//directory.(ItinstallsthetoolchainintothefolderwhereVisualStudiowouldhaveinstalleditto).
BaseVSToolPath=WindowsPlatform.GetVSComnToolsPath();
if(string.IsNullOrEmpty(BaseVSToolPath))
{
thrownewBuildException("VisualStudio2012orVisualStudio2013mustbeinstalledinordertobuildthistarget.");
}
WindowsSDKDir=FindWindowsSDKInstallationFolder(Platform);
PlatformVSToolPath=GetPlatformVSToolPath(Platform,BaseVSToolPath);
CompilerPath=GetCompilerToolPath(PlatformVSToolPath);
CLExeVersion=FindCLExeVersion(CompilerPath);
LinkerPath=GetLinkerToolPath(PlatformVSToolPath);
LibraryLinkerPath=GetLibraryLinkerToolPath(PlatformVSToolPath);
ResourceCompilerPath=GetResourceCompilerToolPath(Platform,WindowsSDKDir);
varVCVarsBatchFile=Path.Combine(BaseVSToolPath,(Platform==CPPTargetPlatform.Win64)?"../../VC/bin/x86_amd64/vcvarsx86_amd64.bat":"vsvars32.bat");
Utils.SetEnvironmentVariablesFromBatchFile(VCVarsBatchFile);
//WhentargetingWindowsXPonVisualStudio2012+,weneedtooverridetheWindowsSDKincludeandlibpathset
//bythebatchfileenvironment(http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx)
if(WindowsPlatform.IsWindowsXPSupported())
{
//Libandbinfoldershaveax64subfolderfor64bitdevelopment.
varConfigSuffix=(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%"));
}
}
原文链接:
http://www.jxszl.com/biancheng/C/556809.html