当前位置: 首页>>代码示例>>C#>>正文


C# Native.NativeCompileSettings类代码示例

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


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


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