Beispiel #1
0
        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.Add(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.CompilerArgStr = string.Join(" ", argsList);
        }
Beispiel #2
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List <string>();

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

            // Add Includes
            var win7CppSdkPath = Path.Combine(config.AppDepSDKPath, "CPPSdk\\win7");

            argsList.Add("/I");
            argsList.Add($"\"{win7CppSdkPath}\"");

            var cppSdkPath = Path.Combine(config.AppDepSDKPath, "CPPSdk");

            argsList.Add("/I");
            argsList.Add($"\"{cppSdkPath}\"");

            // 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);
        }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        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;
        }
Beispiel #5
0
        public string DetermineOutputFile(NativeCompileSettings config)
        {
            var intermediateDirectory = config.OutputDirectory;

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

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

            return(outfile);
        }
Beispiel #6
0
        private string DetermineInFile(NativeCompileSettings config)
        {
            var intermediateDirectory = config.IntermediateDirectory;

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

            var infile = Path.Combine(intermediateDirectory, filename + InputExtension);

            return(infile);
        }
Beispiel #7
0
        public string DetermineOutputFile(NativeCompileSettings config)
        {
            var intermediateDirectory = config.IntermediateDirectory;

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

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

            return outfile;
        }
Beispiel #8
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List <string>();

            // Flags
            argsList.Add(cflags);

            // TODO: Enable this when https://github.com/dotnet/cli/pull/469 goes through.
            // var ilcSdkIncPath = Path.Combine(config.IlcSdkPath, "inc");
            var ilcSdkIncPath = config.IlcSdkPath;

            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
            foreach (var lib in IlcSdkLibs)
            {
                var libPath = Path.Combine(config.IlcSdkPath, 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);
        }
Beispiel #9
0
        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;
        }
Beispiel #10
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List <string>();

            // Flags
            argsList.Add(cflags);

            // Add Includes
            argsList.Add("-I");
            argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10"));

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

            // Input File
            var inCppFile = DetermineInFile(config);

            argsList.Add(inCppFile);

            // Add Stubs
            argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10/osxstubs.cpp"));

            // Lib flags
            argsList.Add(libFlags);

            // Libs
            foreach (var lib in libs)
            {
                var libPath = Path.Combine(config.IlcPath, 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);
        }
Beispiel #11
0
        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);
        }
Beispiel #12
0
		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;
		}
Beispiel #13
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List <string>();

            // Flags
            argsList.AddRange(_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 libPath in _ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)))
            {
                // Forward the library to linked to the linker
                argsList.Add(libPath);
            }

            // AppDep Libs
            var baseAppDeplibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10/x64");

            foreach (var appDeplibPath in _appdeplibs.Select(lib => Path.Combine(baseAppDeplibPath, lib)))
            {
                argsList.Add(appDeplibPath);
            }

            // Output
            var libOut = DetermineOutputFile(config);

            argsList.Add($"-o");
            argsList.Add($"{libOut}");

            CompilerArgs = argsList;
        }
Beispiel #14
0
        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);
        }
Beispiel #15
0
        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);

            // 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/x64");

            foreach (var lib in appdeplibs)
            {
                var appDeplibPath = Path.Combine(baseAppDeplibPath, lib);
                argsList.Add(appDeplibPath);
            }

            argsList.Add(cLibsFlags);

            // Output
            var libOut = DetermineOutputFile(config);

            argsList.Add($"-o \"{libOut}\"");

            this.CompilerArgStr = string.Join(" ", argsList);
        }
Beispiel #16
0
        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;
        }
Beispiel #17
0
        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.CoreLib Reference
            String[] coreLibs    = new String[] { "System.Private.CoreLib.dll", "System.Private.Corelib.dll" };
            var      coreLibPath = Path.Combine(config.IlcPath, Array.Find(coreLibs, lib => File.Exists(Path.Combine(config.IlcPath, lib))));

            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);
        }
Beispiel #18
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List <string>();

            // Configuration Based Linker Options
            argsList.Add(ConfigurationLinkerOptionsMap[config.BuildType]);

            //Output
            var outFile = DetermineOutputFile(config);

            argsList.Add($"/out:\"{outFile}\"");

            // Constant Libs
            argsList.Add(string.Join(" ", ConstantLinkLibs));

            // 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}\"");
            }

            // Configuration Based Libs
            var configLibs = ConfigurationLinkLibMap[config.BuildType];

            foreach (var lib in configLibs)
            {
                argsList.Add($"\"{lib}\"");
            }

            // 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.ArgStr = string.Join(" ", argsList);
        }
Beispiel #19
0
		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");
            }
		}
Beispiel #20
0
 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");
     }
 }
Beispiel #21
0
		public bool CompileToNative(NativeCompileSettings config)
		{	
			int result = invoker.Invoke();
            if(result != 0)
            {
                return false;
            }

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

            return true;
		}
Beispiel #22
0
        public bool CompileToNative(NativeCompileSettings config)
        {
            int result = invoker.Invoke();

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

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

            return(true);
        }
Beispiel #23
0
        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);
        }
Beispiel #24
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List <string>();

            // Flags
            argsList.AddRange(_cflags);

            // Pass the optional native compiler flags if specified
            if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
            {
                argsList.Add(config.CppCompilerFlags);
            }

            // Input File
            var inLibFile = DetermineInFile(config);

            argsList.Add(inLibFile);

            // ILC SDK Libs
            var ilcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");

            argsList.AddRange(_ilcSdkLibs.Select(lib => Path.Combine(ilcSdkLibPath, lib)));

            // Optional linker script
            var linkerScriptFile = Path.Combine(ilcSdkLibPath, "linkerscript");

            if (File.Exists(linkerScriptFile))
            {
                argsList.Add(linkerScriptFile);
            }

            // AppDep Libs
            var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10", config.Architecture.ToString());

            argsList.AddRange(appdeplibs.Select(lib => Path.Combine(baseAppDepLibPath, lib)));

            // Output
            var libOut = DetermineOutputFile(config);

            argsList.Add($"-o");
            argsList.Add($"{libOut}");

            this.CompilerArgs = argsList;
        }
Beispiel #25
0
        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);
        }
Beispiel #26
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List <string>();

            // Flags
            argsList.Add(cflags);

            // Pass the optional native compiler flags if specified
            if (!string.IsNullOrWhiteSpace(config.CppCompilerFlags))
            {
                argsList.Add(config.CppCompilerFlags);
            }

            // Input File
            var inLibFile = DetermineInFile(config);

            argsList.Add("-Xlinker " + inLibFile);

            // ILC SDK Libs
            var IlcSdkLibPath = Path.Combine(config.IlcSdkPath, "sdk");

            foreach (var lib in IlcSdkLibs)
            {
                var libPath = Path.Combine(IlcSdkLibPath, lib);
                argsList.Add("-Xlinker " + libPath);
            }

            // AppDep Libs
            var baseAppDepLibPath = Path.Combine(config.AppDepSDKPath, "CPPSdk/osx.10.10", config.Architecture.ToString());

            foreach (var lib in appdeplibs)
            {
                var appDepLibPath = Path.Combine(baseAppDepLibPath, lib);
                argsList.Add("-Xlinker " + appDepLibPath);
            }

            // Output
            var libOut = DetermineOutputFile(config);

            argsList.Add($"-o \"{libOut}\"");

            this.CompilerArgStr = string.Join(" ", argsList);
        }
Beispiel #27
0
        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;
        }
Beispiel #28
0
        private static int CompileMcgGeneratedCode(NativeCompileSettings config)
        {
            List <string> cscArgs    = new List <string>();
            string        mcgOutPath = Path.Combine(Path.GetDirectoryName(config.InputManagedAssemblyPath), "Interop");

            cscArgs.AddRange(Directory.EnumerateFiles(mcgOutPath, "*.cs"));

            var ilSdkPath = Path.Combine(config.IlcSdkPath, "sdk");

            cscArgs.AddRange(Directory.EnumerateFiles(ilSdkPath, "*.dll").Select(r => $"--reference:{r}"));

            cscArgs.AddRange(Directory.EnumerateFiles(config.AppDepSDKPath, "*.dll").Select(r => $"--reference:{r}"));

            cscArgs.Add("--reference");
            cscArgs.Add(config.InputManagedAssemblyPath);


            var interopAssemblyPath = Path.Combine(mcgOutPath, Path.GetFileNameWithoutExtension(config.InputManagedAssemblyPath));

            interopAssemblyPath += McgInteropAssemblySuffix;

            cscArgs.Add("--out");
            cscArgs.Add(interopAssemblyPath);

            cscArgs.Add("--temp-output");
            cscArgs.Add(config.IntermediateDirectory);

            cscArgs.Add("--define");
            cscArgs.Add("DEBUG");

            cscArgs.Add("--emit-entry-point");
            cscArgs.Add("False");

            cscArgs.Add("--file-version");
            cscArgs.Add("1.0.0.0");

            cscArgs.Add("--version");
            cscArgs.Add("1.0.0.0");

            config.AddReference(interopAssemblyPath);
            return(Microsoft.DotNet.Tools.Compiler.Csc.CompileCscCommand.Run(cscArgs.ToArray()));
        }
Beispiel #29
0
        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;
        }
Beispiel #30
0
        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;
        }
Beispiel #31
0
        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;
        }
Beispiel #32
0
        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;
        }
Beispiel #33
0
        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);
        }
Beispiel #34
0
        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;
        }
        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);
        }
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List <string>();

            // Flags
            argsList.Add(cflags);

            // Input File
            var inLibFile = DetermineInFile(config);

            argsList.Add(inLibFile);

            // Libs
            foreach (var lib in libs)
            {
                var libPath = Path.Combine(config.IlcPath, 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}\"");

            // Add Stubs
            argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04/lxstubs.cpp"));

            this.CompilerArgStr = string.Join(" ", argsList);
        }
Beispiel #37
0
		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;
		}
Beispiel #38
0
        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);
        }
Beispiel #39
0
        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;
        }
Beispiel #40
0
 public WindowsCppCompileStep(NativeCompileSettings config)
 {
     this.config = config;
     InitializeArgs(config);
 }
Beispiel #41
0
 public LinuxRyuJitCompileStep(NativeCompileSettings config)
 {
     InitializeArgs(config);
 }
Beispiel #42
0
 public LinuxRyuJitCompileStep(NativeCompileSettings config)
 {
     InitializeArgs(config);
 }
Beispiel #43
0
		public string DetermineOutputFile(NativeCompileSettings config)
		{
			return config.DetermineFinalOutputPath();
		}
Beispiel #44
0
 public string DetermineOutputFile(NativeCompileSettings config)
 {
     throw new NotImplementedException("Mac linker Not supported yet.");
 }
Beispiel #45
0
 public MacCppCompileStep(NativeCompileSettings config)
 {
     InitializeArgs(config);
 }
Beispiel #46
0
 public ILCompilerInvoker(NativeCompileSettings config)
 {
     this.config = config;
     InitializeArgs(config);
 }
 public ILCompilerInvoker(NativeCompileSettings config)
 {
     this.config = config;
     InitializeArgs(config);
 }
Beispiel #48
0
        private static string GetDefaultOutputDir(NativeCompileSettings config)
        {
            var dir = Path.Combine(Constants.BinDirectoryName, config.Architecture.ToString(), config.BuildType.ToString(), "native");

            return Path.GetFullPath(dir);
        }
Beispiel #49
0
        private static NativeCompileSettings ParseAndValidateArgs(ArgValues args)
        {
            var config = new NativeCompileSettings();

            // Managed Input
            if (string.IsNullOrEmpty(args.InputManagedAssemblyPath) || !File.Exists(args.InputManagedAssemblyPath))
            {
                //TODO make this message good
                throw new Exception("Invalid Managed Assembly Argument.");
            }

            config.InputManagedAssemblyPath = Path.GetFullPath(args.InputManagedAssemblyPath);

            // Architecture
            if(string.IsNullOrEmpty(args.Architecture))
            {
                config.Architecture = RuntimeExtensions.GetCurrentArchitecture();

                // CoreRT does not support x86 yet
                if (config.Architecture != ArchitectureMode.x64)
                {
                    throw new Exception("Native Compilation currently only supported for x64.");
                }
            }
            else
            {
                try
                {
                    config.Architecture = EnumExtensions.Parse<ArchitectureMode>(args.Architecture.ToLower());
                }
                catch (Exception e)
                {
                    throw new Exception("Invalid Architecture Option.");
                }
            }

            // BuildConfiguration
            if(string.IsNullOrEmpty(args.BuildConfiguration))
            {
                config.BuildType = GetDefaultBuildType();
            }
            else
            {
                try
                {
                    config.BuildType = EnumExtensions.Parse<BuildConfiguration>(args.BuildConfiguration.ToLower());
                }
                catch (Exception e)
                {
                    throw new Exception("Invalid Configuration Option.");
                }
            }

            // Output
            if(string.IsNullOrEmpty(args.OutputDirectory))
            {
                config.OutputDirectory = GetDefaultOutputDir(config);
            }
            else
            {
                config.OutputDirectory = args.OutputDirectory;
            }

            // Intermediate
            if(string.IsNullOrEmpty(args.IntermediateDirectory))
            {
                config.IntermediateDirectory = GetDefaultIntermediateDir(config);
            }
            else
            {
                config.IntermediateDirectory = args.IntermediateDirectory;
            }

            // Mode
            if (string.IsNullOrEmpty(args.NativeMode))
            {
                config.NativeMode = GetDefaultNativeMode();
            }
            else
            {
                try
                {
                    config.NativeMode = EnumExtensions.Parse<NativeIntermediateMode>(args.NativeMode.ToLower());
                }
                catch (Exception e)
                {
                    throw new Exception("Invalid Mode Option.");
                }
            }

            // AppDeps (TEMP)
            if(!string.IsNullOrEmpty(args.AppDepSDKPath))
            {
                if (!Directory.Exists(args.AppDepSDKPath))
                {
                    throw new Exception("AppDepSDK Directory does not exist.");
                }

                config.AppDepSDKPath = args.AppDepSDKPath;

                var reference = Path.Combine(config.AppDepSDKPath, "*.dll");
                config.ReferencePaths.Add(reference);
            }
            else
            {
                config.AppDepSDKPath = GetDefaultAppDepSDKPath();

                var reference = Path.Combine(config.AppDepSDKPath, "*.dll");
                config.ReferencePaths.Add(reference);
            }

            // IlcPath
            if (!string.IsNullOrEmpty(args.IlcPath))
            {
                if (!Directory.Exists(args.IlcPath))
                {
                    throw new Exception("ILC Directory does not exist.");
                }

                config.IlcPath = args.IlcPath;
            }
            else
            {
                config.IlcPath = GetDefaultIlcPath();
            }

            // logpath
            if (!string.IsNullOrEmpty(args.LogPath))
            {
                config.LogPath = Path.GetFullPath(args.LogPath);
            }

            // CodeGenPath
            if (!string.IsNullOrEmpty(args.IlcArgs))
            {
                config.IlcArgs = Path.GetFullPath(args.IlcArgs);
            }

            // Reference Paths
            foreach (var reference in args.ReferencePaths)
            {
                config.ReferencePaths.Add(Path.GetFullPath(reference));
            }

            // Link Libs
            foreach (var lib in args.LinkLibPaths)
            {
                config.LinkLibPaths.Add(lib);
            }

            // OS
            config.OS = RuntimeInformationExtensions.GetCurrentOS();

            return config;
        }
Beispiel #50
0
 public string DetermineOutputFile(NativeCompileSettings config)
 {
     return(config.DetermineFinalOutputPath());
 }
Beispiel #51
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            // Flags
            argsList.Add(cflags);

            // Add Includes
            argsList.Add("-I");
            argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04"));

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

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

            // Add Stubs
            argsList.Add(Path.Combine(config.AppDepSDKPath, "CPPSdk/ubuntu.14.04/lxstubs.cpp"));

            // Libs
            foreach (var lib in libs)
            {
                var libPath = Path.Combine(config.IlcPath, lib);
                argsList.Add(libPath);
            }

            // AppDep Libs
            foreach (var lib in appdeplibs)
            {
                var libPath = Path.Combine(config.AppDepSDKPath, lib);
                argsList.Add(libPath);
            }

            argsList.Add(cLibsFlags);

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

            this.CompilerArgStr = string.Join(" ", argsList);
        }
Beispiel #52
0
 public MacCppCompileStep(NativeCompileSettings config)
 {
     throw new NotImplementedException("Mac Cpp Not Supported Yet");
 }
Beispiel #53
0
		public static IntermediateCompiler Create(NativeCompileSettings config)
		{
            var platformStepList = CreatePlatformNativeSteps(config);
			
			return new IntermediateCompiler(platformStepList);
		}
Beispiel #54
0
 public MacRyuJitCompileStep(NativeCompileSettings config)
 {
     this.config = config;
     InitializeArgs(config);
 }
Beispiel #55
0
 public WindowsCppCompileStep(NativeCompileSettings config)
 {
     this.config = config;
     InitializeArgs(config);
 }
Beispiel #56
0
        public static IntermediateCompiler Create(NativeCompileSettings config)
        {
            var platformStepList = CreatePlatformNativeSteps(config);

            return(new IntermediateCompiler(platformStepList));
        }
Beispiel #57
0
        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);
        }
Beispiel #58
0
 public MacCppCompileStep(NativeCompileSettings config)
 {
     InitializeArgs(config);
 }
Beispiel #59
0
 public string DetermineOutputFile(NativeCompileSettings config)
 {
     throw new NotImplementedException("Mac cpp Not supported yet.");
 }
Beispiel #60
0
        private void InitializeArgs(NativeCompileSettings config)
        {
            var argsList = new List<string>();

            // Configuration Based Linker Options
            argsList.Add(ConfigurationLinkerOptionsMap[config.BuildType]);

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

            // Constant Libs
            argsList.Add(string.Join(" ", ConstantLinkLibs));

            // SDK Libs
            var SDKLibs = ModeLibMap[config.NativeMode];
            foreach (var lib in SDKLibs)
            {
                argsList.Add(Path.Combine(config.IlcPath, lib));
            }

            // 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.ArgStr = string.Join(" ", argsList);
        }