Browse Source

Use libc++ on osx

pull/426/head
Stephan Sundermann 10 years ago
parent
commit
9b3313d424
  1. 26
      src/Generator.Tests/GeneratorTest.cs

26
src/Generator.Tests/GeneratorTest.cs

@ -49,6 +49,10 @@ namespace CppSharp.Utils @@ -49,6 +49,10 @@ namespace CppSharp.Utils
Path.GetFullPath(Path.Combine(path, "../../deps/llvm/tools/clang/lib/Headers"))
};
if (IsMacOS) {
options.addArguments ("-stdlib=libc++");
}
foreach (var header in headersPaths)
options.addSystemIncludeDirs(header);
@ -105,6 +109,28 @@ namespace CppSharp.Utils @@ -105,6 +109,28 @@ namespace CppSharp.Utils
throw new Exception("Could not find tests output directory");
}
[DllImport ("libc")]
static extern int uname (IntPtr buf);
public static bool IsMacOS {
get {
if (Environment.OSVersion.Platform != PlatformID.Unix)
return false;
IntPtr buf = Marshal.AllocHGlobal (8192);
if (uname (buf) == 0) {
string os = Marshal.PtrToStringAnsi (buf);
switch (os) {
case "Darwin":
return true;
}
}
Marshal.FreeHGlobal (buf);
return false;
}
}
#endregion
}

Loading…
Cancel
Save