Browse Source

Rewrite Clang resource directory lookup logic in test driver.

Due to this code we ended up multiple Clang resource directories in the path which is a problem because Clang's stdint.h uses an include_next<> logic and it was getting messed up with the multiple headers in the lookup path.
pull/536/merge
João Matos 10 years ago
parent
commit
f799e0fb82
  1. 20
      src/Generator.Tests/GeneratorTest.cs

20
src/Generator.Tests/GeneratorTest.cs

@ -45,12 +45,22 @@ namespace CppSharp.Utils @@ -45,12 +45,22 @@ namespace CppSharp.Utils
var path = Path.GetFullPath(GetTestsDirectory(name));
options.addIncludeDirs(path);
var headersPaths = new System.Collections.Generic.List<string> {
Path.GetFullPath(Path.Combine(path, "../../deps/llvm/tools/clang/lib/Headers"))
};
var foundClangResourceDir = false;
for (uint i = 0; i < options.SystemIncludeDirsCount; ++i)
{
var dir = options.getSystemIncludeDirs(i);
if (dir.Contains(@"lib/clang/"))
{
foundClangResourceDir = true;
break;
}
}
foreach (var header in headersPaths)
options.addSystemIncludeDirs(header);
if (!foundClangResourceDir)
{
var dir = Path.GetFullPath(Path.Combine(path, "../../deps/llvm/tools/clang/lib/Headers"));
options.addSystemIncludeDirs(dir);
}
driver.Diagnostics.Message("Looking for tests in: {0}", path);
var files = Directory.EnumerateFiles(path, "*.h");

Loading…
Cancel
Save