Skip to content

Commit

Permalink
Fix path combine and improve error reporting for ParserGen.
Browse files Browse the repository at this point in the history
  • Loading branch information
tritao committed Oct 27, 2024
1 parent 29653a0 commit 83eabbc
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/CppParser/ParserGen/ParserGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,32 @@ public static void Main(string[] args)
ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "x86_64-pc-win32-msvc"));
Console.WriteLine();
}
else
{
Console.WriteLine("Skipping generation for Windows due to missing headers, only supported on Windows platform.");
}

var osxHeadersPath = Path.Combine(GetSourceDirectory("build"), @"headers\osx");
var osxHeadersPath = Path.Combine(GetSourceDirectory("build"), @"headers", "osx");
if (Directory.Exists(osxHeadersPath) || Platform.IsMacOS)
{
Console.WriteLine("Generating the C# parser bindings for OSX x86...");
Console.WriteLine("Generating the C# parser bindings for macOS x86...");
ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "i686-apple-darwin12.4.0"));
Console.WriteLine();

Console.WriteLine("Generating the C# parser bindings for OSX x64...");
Console.WriteLine("Generating the C# parser bindings for macOS x64...");
ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "x86_64-apple-darwin12.4.0"));
Console.WriteLine();

Console.WriteLine("Generating the C# parser bindings for OSX ARM64...");
Console.WriteLine("Generating the C# parser bindings for macOS ARM64...");
ConsoleDriver.Run(new ParserGen(GeneratorKind.CSharp, "arm64-apple-darwin12.4.0"));
Console.WriteLine();
}
else
{
Console.WriteLine("Skipping generation for macOS due to missing headers.");
}

var linuxHeadersPath = Path.Combine(GetSourceDirectory("build"), @"headers\x86_64-linux-gnu");
var linuxHeadersPath = Path.Combine(GetSourceDirectory("build"), @"headers", "x86_64-linux-gnu");
if (Directory.Exists(linuxHeadersPath) || Platform.IsLinux)
{
Console.WriteLine("Generating the C# parser bindings for Linux...");
Expand All @@ -204,6 +212,10 @@ public static void Main(string[] args)
isGnuCpp11Abi: true));
Console.WriteLine();
}
else
{
Console.WriteLine("Skipping generation for Linux due to missing headers.");
}
}
}
}

0 comments on commit 83eabbc

Please sign in to comment.