|
4 | 4 | using CppSharp.Passes; |
5 | 5 | using System; |
6 | 6 | using System.Collections.Generic; |
| 7 | +using System.Diagnostics; |
7 | 8 | using System.IO; |
8 | 9 | using System.Linq; |
9 | 10 | using System.Text; |
| 11 | +using System.Text.RegularExpressions; |
10 | 12 | using CppAbi = CppSharp.Parser.AST.CppAbi; |
11 | 13 |
|
12 | 14 | namespace CppSharp |
@@ -193,34 +195,7 @@ public void Setup(Driver driver) |
193 | 195 |
|
194 | 196 | private void SetupLinuxOptions(ParserOptions parserOptions) |
195 | 197 | { |
196 | | - parserOptions.MicrosoftMode = false; |
197 | | - parserOptions.NoBuiltinIncludes = true; |
198 | | - |
199 | | - var headersPath = string.Empty; |
200 | | - |
201 | | - // Search for the available GCC versions on the provided headers. |
202 | | - var versions = Directory.EnumerateDirectories(Path.Combine(headersPath, "usr/include/c++")); |
203 | | - |
204 | | - if (versions.Count() == 0) |
205 | | - throw new Exception("No valid GCC version found on system include paths"); |
206 | | - |
207 | | - string gccVersionPath = versions.First(); |
208 | | - string gccVersion = gccVersionPath.Substring(gccVersionPath.LastIndexOf(Path.DirectorySeparatorChar) + 1); |
209 | | - |
210 | | - string[] systemIncludeDirs = { |
211 | | - Path.Combine("usr", "include", "c++", gccVersion), |
212 | | - Path.Combine("usr", "include", "x86_64-linux-gnu", "c++", gccVersion), |
213 | | - Path.Combine("usr", "include", "c++", gccVersion, "backward"), |
214 | | - Path.Combine("usr", "lib", "gcc", "x86_64-linux-gnu", gccVersion, "include"), |
215 | | - Path.Combine("usr", "lib", "gcc", "x86_64-pc-linux-gnu", gccVersion, "include"), |
216 | | - Path.Combine("usr", "include", "x86_64-linux-gnu"), |
217 | | - Path.Combine("usr", "include", "x86_64-pc-linux-gnu"), |
218 | | - Path.Combine("usr", "include") |
219 | | - }; |
220 | | - |
221 | | - foreach (var dir in systemIncludeDirs) |
222 | | - parserOptions.AddSystemIncludeDirs(Path.Combine(headersPath, dir)); |
223 | | - |
| 198 | + parserOptions.SetupLinux(); |
224 | 199 | parserOptions.AddDefines("_GLIBCXX_USE_CXX11_ABI=" + (options.Cpp11ABI ? "1" : "0")); |
225 | 200 | } |
226 | 201 |
|
|
0 commit comments