From f7cfa6f692f87723f8780ffcea97d6ea491eafe4 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Mon, 21 Oct 2024 21:40:19 +0100 Subject: [PATCH] Fix path combine and improve error reporting for `ParserGen`. --- src/CppParser/ParserGen/ParserGen.cs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/CppParser/ParserGen/ParserGen.cs b/src/CppParser/ParserGen/ParserGen.cs index 48b0ab4af..d886cb2f8 100644 --- a/src/CppParser/ParserGen/ParserGen.cs +++ b/src/CppParser/ParserGen/ParserGen.cs @@ -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..."); @@ -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."); + } } } }