• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Native.NativeCompileSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.DotNet.Tools.Compiler.Native.NativeCompileSettings的典型用法代码示例。如果您正苦于以下问题:C# NativeCompileSettings类的具体用法?C# NativeCompileSettings怎么用?C# NativeCompileSettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NativeCompileSettings类属于Microsoft.DotNet.Tools.Compiler.Native命名空间,在下文中一共展示了NativeCompileSettings类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            // Flags
            argsList.AddRange(_cflags);
            
            // Input File
            var inLibFile = DetermineInFile(config);
            argsList.Add(inLibFile);

            // Pass the optional native compiler flags if specified
            if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
            {
                argsList.Add(config.CppCompilerFlags);
            }
            
            // ILC SDK Libs
            var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
            argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)));

            // AppDep Libs
            var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04", config.Architecture.ToString());
            argsList.AddRange(_appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib)));

            // Output
            var libOut = DetermineOutputFile(config);
            argsList.Add($"-o");
            argsList.Add($"{libOut}");

            CompilerArgs = argsList;
        }
开发者ID:noahfalk,项目名称:cli,代码行数:32,代码来源:LinuxRyuJitCompileStep.cs


示例2: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();
            
            // Use a Custom Link Step
            argsList.Add("/c");
            
            // Add Includes
            var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc");
            argsList.Add("/I");
            argsList.Add($"{ilcSdkIncPath}");
            
            // Configuration Based Compiler Options 
            argsList.AddRange(ConfigurationCompilerOptionsMap[config.BuildType]);
            
            // Pass the optional native compiler flags if specified
            if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
            {
                argsList.Add(config.CppCompilerFlags);
            }

            // Output
            var objOut = DetermineOutputFile(config);
            argsList.Add($"/Fo{objOut}");
            
            // Input File
            var inCppFile = DetermineInFile(config);
            argsList.Add($"{inCppFile}");

            this.CompilerArgs = argsList;
        }
开发者ID:khellang,项目名称:cli,代码行数:31,代码来源:WindowsCppCompileStep.cs


示例3: DetermineOutputFile

        public string DetermineOutputFile(NativeCompileSettings config)
        {
            var intermediateDirectory = config.IntermediateDirectory;

            var filename = Path.GetFileNameWithoutExtension(config.InputManagedAssemblyPath);

            var outfile = Path.Combine(intermediateDirectory, filename + CompilerOutputExtension);

            return outfile;
        }
开发者ID:niemyjski,项目名称:cli,代码行数:10,代码来源:WindowsCppCompileStep.cs


示例4: Create

		public static NativeCompiler Create(NativeCompileSettings config)
		{
			var invoker = new ILCompilerInvoker(config);
			var intCompiler = IntermediateCompiler.Create(config);
			
			var nc = new NativeCompiler() 
			{
				invoker = invoker, 
				intermediateCompiler = intCompiler
			};
			
			return nc;
		}
开发者ID:yonglehou,项目名称:cli-1,代码行数:13,代码来源:NativeCompiler.cs


示例5: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();
            
            // Flags
            argsList.Add(cflags);

            var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc");
            argsList.Add("-I");
            argsList.Add($"\"{ilcSdkIncPath}\"");

            // Input File
            var inCppFile = DetermineInFile(config);
            argsList.Add(inCppFile);

            // Lib flags
            argsList.Add(libFlags);

            // Pass the optional native compiler flags if specified
            if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
            {
                argsList.Add(config.CppCompilerFlags);
            }
            
            // ILC SDK Libs
            var IlcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
            foreach (var lib in IlcSdkLibs)
            {
                var libPath = Path.Combine(IlcSdkLibPath, lib);

                // Forward the library to linked to the linker
                argsList.Add("-Xlinker");
                argsList.Add(libPath);
            }

            // AppDep Libs
            var baseAppDeplibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10/x64");
            foreach (var lib in appdeplibs)
            {
                var appDeplibPath = Path.Combine(baseAppDeplibPath, lib);
                argsList.Add("-Xlinker");
                argsList.Add(appDeplibPath);
            }

            // Output
            var libOut = DetermineOutputFile(config);
            argsList.Add($"-o \"{libOut}\"");

            this.CompilerArgStr = string.Join(" ", argsList);
        }
开发者ID:yonglehou,项目名称:cli-1,代码行数:50,代码来源:MacCppCompileStep.cs


示例6: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            var managedPath = Path.Combine(config.IlcPath, ILCompiler);
            if (!File.Exists(managedPath))
            {
                throw new FileNotFoundException("Unable to find ILCompiler at " + managedPath);
            }

            argsList.Add($"{managedPath}");
            
            // Input File 
            var inputFilePath = config.InputManagedAssemblyPath;
            argsList.Add($"{inputFilePath}");
            
            // System.Private.* References
            var coreLibsPath = Path.Combine(config.IlcSdkPath, "sdk");
            foreach (var reference in Directory.EnumerateFiles(coreLibsPath, "*.dll"))
            {
                argsList.Add($"-r");
                argsList.Add($"{reference}");
            }
            
            // AppDep References
            foreach (var reference in config.ReferencePaths)
            {
                argsList.Add($"-r");
                argsList.Add($"{reference}");
            }
            
            // Set Output DetermineOutFile
            var outFile = DetermineOutputFile(config);
            argsList.Add($"-out");
            argsList.Add($"{outFile}");
            
            // Add Mode Flag TODO
            if (config.NativeMode == NativeIntermediateMode.cpp)
            {
                argsList.Add("-cpp");
            }
            
            // Custom Ilc Args support
            if (! string.IsNullOrEmpty(config.IlcArgs))
            {
                argsList.Add(config.IlcArgs);
            }
                        
            Args = argsList;
        }
开发者ID:robmen,项目名称:dotnetcli,代码行数:50,代码来源:ILCompilerInvoker.cs


示例7: CreatePlatformNativeSteps

		private static List<IPlatformNativeStep> CreatePlatformNativeSteps(NativeCompileSettings config)
		{
			if (config.NativeMode == NativeIntermediateMode.cpp)
			{
				return CreateCppSteps(config);
			}
			else if (config.NativeMode == NativeIntermediateMode.ryujit)
			{
				return CreateJitSteps(config);
			}
            else
            {
                throw new Exception("Unrecognized Mode");
            }
		}
开发者ID:yonglehou,项目名称:cli-1,代码行数:15,代码来源:IntermediateCompiler.cs


示例8: CompileToNative

		public bool CompileToNative(NativeCompileSettings config)
		{	
			int result = invoker.Invoke();
            if(result != 0)
            {
                return false;
            }

            result = intermediateCompiler.Invoke();
            if (result != 0)
            {
                return false;
            }

            return true;
		}
开发者ID:yonglehou,项目名称:cli-1,代码行数:16,代码来源:NativeCompiler.cs


示例9: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            argsList.AddRange(DefaultLinkerOptions);

            // Configuration Based Linker Options 
            argsList.AddRange(ConfigurationLinkerOptionsMap[config.BuildType]);
            
            //Output
            var outFile = DetermineOutputFile(config);
            argsList.Add($"/out:{outFile}");
            
            // Constant Libs
            foreach (var lib in ConstantLinkLibs)
            {
                argsList.Add(lib);
            }

            // ILC SDK Libs
            var SDKLibs = IlcSdkLibMap[config.NativeMode];
            var IlcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
            foreach (var lib in SDKLibs)
            {
                var sdkLibPath = Path.Combine(IlcSdkLibPath, lib);
                argsList.Add($"{sdkLibPath}");
            }

            // Link Libs
            foreach(var path in config.LinkLibPaths){
                argsList.Add($"{path}");
            }
            
            //arch
            argsList.Add($"/MACHINE:{config.Architecture}");

            //Input Obj file
            var inputFile = DetermineInputFile(config);
            argsList.Add($"{inputFile}");

            this.Args = argsList;
        }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:42,代码来源:WindowsLinkStep.cs


示例10: RunMcg

        private static int RunMcg(NativeCompileSettings config)
        {
            var mcgArgs = new List<string>();
            string outPath = Path.Combine(Path.GetDirectoryName(config.InputManagedAssemblyPath), "Interop");
            mcgArgs.Add($"{config.InputManagedAssemblyPath}");
            mcgArgs.Add("--p");
            mcgArgs.Add(config.Architecture.ToString());
            mcgArgs.Add("--outputpath");
            mcgArgs.Add(outPath);

            var ilSdkPath = Path.Combine(config.IlcSdkPath, "sdk");        
                
            mcgArgs.Add("--r");
            mcgArgs.Add(Path.Combine(ilSdkPath,"System.Private.Interop.dll"));
            mcgArgs.Add("--r");
            mcgArgs.Add(Path.Combine(ilSdkPath, "System.Private.CoreLib.dll"));
            mcgArgs.Add("--r");
            mcgArgs.Add(Path.Combine(config.AppDepSDKPath, "System.Runtime.Handles.dll"));
            mcgArgs.Add("--r");
            mcgArgs.Add(Path.Combine(config.AppDepSDKPath, "System.Runtime.dll"));


            // Write Response File
            var rsp = Path.Combine(config.IntermediateDirectory, $"dotnet-compile-mcg.rsp");
            File.WriteAllLines(rsp, mcgArgs);

            var corerun = Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName);
            var mcgExe = Path.Combine(AppContext.BaseDirectory, "mcg.exe");

            List<string> args = new List<string>();
            args.Add(mcgExe);
            args.AddRange(new string[] { "--rsp", $"{rsp}" });


            var result = Command.Create(corerun, args.ToArray())
                                .ForwardStdErr()
                                .ForwardStdOut()
                                .Execute();
            
            return result.ExitCode;
        }
开发者ID:noahfalk,项目名称:cli,代码行数:41,代码来源:Program.cs


示例11: RunMcg

        private static int RunMcg(NativeCompileSettings config)
        {
            var mcgArgs = new List<string>();
            string outPath = Path.Combine(Path.GetDirectoryName(config.InputManagedAssemblyPath), "Interop");
            mcgArgs.Add($"{config.InputManagedAssemblyPath}");
            mcgArgs.Add("--p");
            mcgArgs.Add(config.Architecture.ToString());
            mcgArgs.Add("--outputpath");
            mcgArgs.Add(outPath);

            var ilSdkPath = Path.Combine(config.IlcSdkPath, "sdk");
            foreach (string refPath in Directory.EnumerateFiles(ilSdkPath, "*.dll"))
            {

                mcgArgs.Add("--r");
                mcgArgs.Add(refPath);
            }

            foreach (string refPath in Directory.EnumerateFiles(config.AppDepSDKPath, "*.dll"))
            {
                // System.Runtime.Extensions define an internal type called System.Runtime.InteropServices.Marshal which 
                // conflicts with Marshal from S.P.Interop , we don't need System.Runtime.Extensions anyways,skip it.
                if (refPath.Contains("System.Runtime.Extensions.dll")) continue;

                mcgArgs.Add("--r");
                mcgArgs.Add(refPath);
            }

            // Write Response File
            var rsp = Path.Combine(config.IntermediateDirectory, $"dotnet-compile-mcg.rsp");
            File.WriteAllLines(rsp, mcgArgs);

            var result = Command.Create("dotnet-mcg", new string[] {"--rsp", $"{rsp}" })
                                .ForwardStdErr()
                                .ForwardStdOut()
                                .Execute();

            // Add interop assembly to project context 
            return result.ExitCode;
        }
开发者ID:khellang,项目名称:cli,代码行数:40,代码来源:Program.cs


示例12: RunMcg

        private static int RunMcg(NativeCompileSettings config)
        {
            var mcgArgs = new List<string>();
            string outPath = Path.Combine(Path.GetDirectoryName(config.InputManagedAssemblyPath), "Interop");
            mcgArgs.Add($"{config.InputManagedAssemblyPath}");
            mcgArgs.Add("--p");
            mcgArgs.Add(config.Architecture.ToString());
            mcgArgs.Add("--outputpath");
            mcgArgs.Add(outPath);

            // Write Response File
            var rsp = Path.Combine(config.IntermediateDirectory, $"dotnet-compile-mcg.rsp");
            File.WriteAllLines(rsp, mcgArgs);

            var result = Command.Create("dotnet-mcg", new string[] {"--rsp", $"{rsp}" })
                                .ForwardStdErr()
                                .ForwardStdOut()
                                .Execute();

            // Add interop assembly to project context 
            return result.ExitCode;
        }
开发者ID:robmen,项目名称:dotnetcli,代码行数:22,代码来源:Program.cs


示例13: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            // Flags
            argsList.Add(cflags);
            
            // Input File
            var inLibFile = DetermineInFile(config);
            argsList.Add(inLibFile);

            // Pass the optional native compiler flags if specified
            if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
            {
                argsList.Add(config.CppCompilerFlags);
            }
            
            // ILC SDK Libs
            var IlcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");
            foreach (var lib in IlcSdkLibs)
            {
                var libPath = Path.Combine(IlcSdkLibPath, lib);
                argsList.Add(libPath);
            }

            // AppDep Libs
            var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04", config.Architecture.ToString());
            foreach (var lib in appdeplibs)
            {
                var appDepLibPath = Path.Combine(baseAppDepLibPath, lib);
                argsList.Add(appDepLibPath);
            }

            // Output
            var libOut = DetermineOutputFile(config);
            argsList.Add($"-o \"{libOut}\"");

            this.CompilerArgStr = string.Join(" ", argsList);
        }
开发者ID:yonglehou,项目名称:cli-1,代码行数:39,代码来源:LinuxRyuJitCompileStep.cs


示例14: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            var managedPath = Path.Combine(config.IlcPath, ILCompiler);
            argsList.Add(managedPath);

            // Input File
            var inputFilePath = config.InputManagedAssemblyPath;
            argsList.Add(inputFilePath);

            // System.Private.CoreLib Reference
            var coreLibPath = Path.Combine(config.IlcPath, OSCoreLibNameMap[config.OS]);
            argsList.Add($"-r \"{coreLibPath}\"");

            // Dependency References
            foreach (var reference in config.ReferencePaths)
            {
                argsList.Add($"-r \"{reference}\"");
            }

            // Set Output DetermineOutFile
            var outFile = DetermineOutputFile(config);
            argsList.Add($"-out \"{outFile}\"");

            // Add Mode Flag TODO
            if (config.NativeMode == NativeIntermediateMode.cpp)
            {
                argsList.Add("-cpp");
            }

            // Custom Ilc Args support
            if (! string.IsNullOrEmpty(config.IlcArgs))
            {
                argsList.Add(config.IlcArgs);
            }

            this.ArgStr = string.Join(" ", argsList);
        }
开发者ID:niemyjski,项目名称:cli,代码行数:39,代码来源:ILCompilerInvoker.cs


示例15: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            // Input File 
            var inputFilePath = config.InputManagedAssemblyPath;
            argsList.Add($"{inputFilePath}");
            
            // System.Private.* References
            var coreLibsPath = Path.Combine(config.IlcSdkPath, "sdk");
            foreach (var reference in Directory.EnumerateFiles(coreLibsPath, "*.dll"))
            {
                argsList.Add($"-r:{reference}");
            }
            
            // AppDep References
            foreach (var reference in config.ReferencePaths)
            {
                argsList.Add($"-r:{reference}");
            }
            
            // Set Output DetermineOutFile
            var outFile = DetermineOutputFile(config);
            argsList.Add($"-o:{outFile}");
            
            // Add Mode Flag TODO
            if (config.NativeMode == NativeIntermediateMode.cpp)
            {
                argsList.Add("--cpp");
            }
            
            // Custom Ilc Args support
            foreach (var ilcArg in config.IlcArgs)
            {
                argsList.Add(ilcArg);
            }
                        
            Args = argsList;
        }
开发者ID:noahfalk,项目名称:cli,代码行数:39,代码来源:ILCompilerInvoker.cs


示例16: CreateJitSteps

		private static List<IPlatformNativeStep> CreateJitSteps(NativeCompileSettings config)
		{
            var stepList = new List<IPlatformNativeStep>();

            if (config.OS == OSMode.Windows)
			{
                stepList.Add(new WindowsLinkStep(config));
			}
			else if (config.OS == OSMode.Linux)
			{
                stepList.Add(new LinuxRyuJitCompileStep(config));
			}
			else if (config.OS == OSMode.Mac)
			{
				stepList.Add(new MacRyuJitCompileStep(config));
			}
			else
			{
				throw new Exception("Unrecognized Operating System. Unable to create Intermediate Compiler.");	
			}

            return stepList;
		}
开发者ID:yonglehou,项目名称:cli-1,代码行数:23,代码来源:IntermediateCompiler.cs


示例17: CreateCppSteps

        private static List<IPlatformNativeStep> CreateCppSteps(NativeCompileSettings config)
        {
            var stepList = new List<IPlatformNativeStep>();

            if (config.OS == OSMode.Windows)
            {
                stepList.Add(new WindowsCppCompileStep(config));
                stepList.Add(new WindowsLinkStep(config));
            }
            else if (config.OS == OSMode.Linux)
            {
                stepList.Add(new LinuxCppCompileStep(config));
            }
            else if (config.OS == OSMode.Mac)
            {
                throw new NotImplementedException("Mac not yet supported.");
            }
            else
            {
                throw new Exception("Unrecognized Operating System. Unable to create Intermediate Compiler.");
            }

            return stepList;
        }
开发者ID:niemyjski,项目名称:cli,代码行数:24,代码来源:IntermediateCompiler.cs


示例18: DetermineOutputFile

 public string DetermineOutputFile(NativeCompileSettings config)
 {
     throw new NotImplementedException("Mac cpp Not supported yet.");
 }
开发者ID:niemyjski,项目名称:cli,代码行数:4,代码来源:MacCppCompileStep.cs


示例19: MacCppCompileStep

 public MacCppCompileStep(NativeCompileSettings config)
 {
     throw new NotImplementedException("Mac Cpp Not Supported Yet");
 }
开发者ID:niemyjski,项目名称:cli,代码行数:4,代码来源:MacCppCompileStep.cs


示例20: InitializeArgs

        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            // Use a Custom Link Step
            argsList.Add("/c");

            // Add Includes
            argsList.Add("/I");
            argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk\\Windows_NT"));

            argsList.Add("/I");
            argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk"));

            // Configuration Based Compiler Options
            argsList.Add(ConfigurationCompilerOptionsMap[config.BuildType]);

            // Output
            var objOut = DetermineOutputFile(config);
            argsList.Add($"/Fo\"{objOut}\"");

            // Input File
            var inCppFile = DetermineInFile(config);
            argsList.Add(inCppFile);

            this.CompilerArgStr = string.Join(" ", argsList);
        }
开发者ID:niemyjski,项目名称:cli,代码行数:27,代码来源:WindowsCppCompileStep.cs



注:本文中的Microsoft.DotNet.Tools.Compiler.Native.NativeCompileSettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Utilities.BuildCommand类代码示例发布时间:2022-05-26
下一篇:
C# ProjectModel.ProjectContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap