Browse Source

Reworked the tests base class.

pull/43/head
triton 12 years ago
parent
commit
b80a395998
  1. 24
      src/Generator/Utils/TestsUtils.cs

24
src/Generator/Utils/TestsUtils.cs

@ -1,4 +1,5 @@
using System.IO; using System;
using System.IO;
using CppSharp.AST; using CppSharp.AST;
using CppSharp.Generators; using CppSharp.Generators;
@ -21,21 +22,32 @@ namespace CppSharp.Utils
options.LibraryName = name; options.LibraryName = name;
options.GeneratorKind = kind; options.GeneratorKind = kind;
options.OutputDir = "../gen/" + name; options.OutputDir = "../gen/" + name;
options.GenerateLibraryNamespace = true;
options.SharedLibraryName = name + ".Native"; options.SharedLibraryName = name + ".Native";
options.GenerateLibraryNamespace = true;
options.CheckSymbols = false;
options.Quiet = true;
options.IgnoreParseWarnings = true;
Console.WriteLine("Generating bindings for {0} in {1} mode",
options.LibraryName, options.GeneratorKind.ToString());
// Workaround for CLR which does not check for .dll if the // Workaround for CLR which does not check for .dll if the
// name already has a dot. // name already has a dot.
if (System.Type.GetType("Mono.Runtime") == null) if (System.Type.GetType("Mono.Runtime") == null)
options.SharedLibraryName += ".dll"; options.SharedLibraryName += ".dll";
options.CheckSymbols = false; var path = Path.GetFullPath("../../../tests/" + name);
var path = "../../../tests/" + name;
options.IncludeDirs.Add(path); options.IncludeDirs.Add(path);
if (!Directory.Exists(path))
{
Console.WriteLine("Path to tests does not exist: {0}", path);
return;
}
Console.WriteLine("Looking for tests in: {0}", path);
var files = Directory.EnumerateFiles(path, "*.h"); var files = Directory.EnumerateFiles(path, "*.h");
foreach(var file in files) foreach (var file in files)
options.Headers.Add(Path.GetFileName(file)); options.Headers.Add(Path.GetFileName(file));
} }

Loading…
Cancel
Save