void SetupTargetTriple() { var tripleBuilder = new StringBuilder(); if (options.Architecture == TargetArchitecture.x64) tripleBuilder.Append("x86_64-"); else if(options.Architecture == TargetArchitecture.x86) tripleBuilder.Append("i686-"); if (options.Platform == TargetPlatform.Windows) { tripleBuilder.Append("pc-win32-msvc"); abi = CppAbi.Microsoft; } else if (options.Platform == TargetPlatform.MacOS) { tripleBuilder.Append("apple-darwin12.4.0"); abi = CppAbi.Itanium; } else if (options.Platform == TargetPlatform.Linux) { tripleBuilder.Append("linux-gnu"); abi = CppAbi.Itanium; if(options.Cpp11ABI) tripleBuilder.Append("-cxx11abi"); } triple = tripleBuilder.ToString(); }
public ParserGen(GeneratorKind kind, string triple, CppAbi abi, bool isGnuCpp11Abi = false) { Kind = kind; Triple = triple; Abi = abi; IsGnuCpp11Abi = isGnuCpp11Abi; }
public ParserGen(GeneratorKind kind, string triple, CppAbi abi) { Kind = kind; Triple = triple; Abi = abi; }
public bool ValidateOptions(List <string> messages) { if (Platform.IsWindows && options.Platform != TargetPlatform.Windows) { messages.Add("Cannot create bindings for a platform other that Windows from a Windows running machine"); return(false); } else if (Platform.IsMacOS && options.Platform != TargetPlatform.MacOS) { messages.Add("Cannot create bindings for a platform other that MacOS from a MacOS running machine"); return(false); } else if (Platform.IsLinux && options.Platform != TargetPlatform.Linux) { messages.Add("Cannot create bindings for a platform other that Linux from a Linux running machine"); return(false); } if (options.Platform != TargetPlatform.Windows && options.Kind != GeneratorKind.CSharp) { messages.Add("Cannot create bindings for languages other than C# from a non Windows machine"); return(false); } if (options.Platform == TargetPlatform.Linux && options.Architecture != TargetArchitecture.x64) { messages.Add("Cannot create bindings for architectures other than x64 for Linux machines"); return(false); } if (options.HeaderFiles.Count == 0) { messages.Add("No source header file has been given to generate bindings from"); return(false); } if (string.IsNullOrEmpty(options.OutputNamespace)) { messages.Add("Output namespace is empty"); return(false); } if (string.IsNullOrEmpty(options.OutputFileName)) { messages.Add("Output not specified"); return(false); } if (string.IsNullOrEmpty(options.InputLibraryName) && !options.CheckSymbols) { messages.Add("Input library name not specified and check symbols not enabled. Either set the input library name or the check symbols flag"); return(false); } if (string.IsNullOrEmpty(options.InputLibraryName) && options.CheckSymbols && options.Libraries.Count == 0) { messages.Add("Input library name not specified and check symbols is enabled but no libraries were given. Either set the input library name or add at least one library"); return(false); } StringBuilder tripleBuilder = new StringBuilder(); if (options.Architecture == TargetArchitecture.x64) { tripleBuilder.Append("x86_64-"); } else if (options.Architecture == TargetArchitecture.x86) { tripleBuilder.Append("i686-"); } if (options.Platform == TargetPlatform.Windows) { tripleBuilder.Append("pc-win32-msvc"); abi = CppAbi.Microsoft; } else if (options.Platform == TargetPlatform.MacOS) { tripleBuilder.Append("apple-darwin12.4.0"); abi = CppAbi.Itanium; } else if (options.Platform == TargetPlatform.Linux) { tripleBuilder.Append("linux-gnu"); abi = CppAbi.Itanium; if (options.Cpp11ABI) { tripleBuilder.Append("-cxx11abi"); } } triple = tripleBuilder.ToString(); return(true); }