Browse Source

Fixed the collection of additional symbols to ignore warnings.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1011/head
Dimitar Dobrev 8 years ago
parent
commit
5313dea5c4
  1. 12
      src/Generator/Passes/GenerateSymbolsPass.cs
  2. 7
      src/Generator/Utils/ProcessHelper.cs

12
src/Generator/Passes/GenerateSymbolsPass.cs

@ -157,15 +157,12 @@ namespace CppSharp.Passes
int error; int error;
string errorMessage; string errorMessage;
ProcessHelper.Run(compiler, arguments, out error, out errorMessage); ProcessHelper.Run(compiler, arguments, out error, out errorMessage);
if (string.IsNullOrEmpty(errorMessage)) CollectSymbols(outputDir, symbols, errorMessage);
CollectSymbols(outputDir, symbols);
else
Diagnostics.Error(errorMessage);
RemainingCompilationTasks--; RemainingCompilationTasks--;
}).Start(); }).Start();
} }
private void CollectSymbols(string outputDir, string symbols) private void CollectSymbols(string outputDir, string symbols, string errorMessage)
{ {
using (var parserOptions = new ParserOptions()) using (var parserOptions = new ParserOptions())
{ {
@ -173,6 +170,11 @@ namespace CppSharp.Passes
var output = Path.GetFileName($@"{(Platform.IsWindows ? var output = Path.GetFileName($@"{(Platform.IsWindows ?
string.Empty : "lib")}{symbols}.{ string.Empty : "lib")}{symbols}.{
(Platform.IsMacOS ? "dylib" : Platform.IsWindows ? "dll" : "so")}"); (Platform.IsMacOS ? "dylib" : Platform.IsWindows ? "dll" : "so")}");
if (!File.Exists(Path.Combine(outputDir, output)))
{
Diagnostics.Error(errorMessage);
return;
}
parserOptions.LibraryFile = output; parserOptions.LibraryFile = output;
using (var parserResult = Parser.ClangParser.ParseLibrary(parserOptions)) using (var parserResult = Parser.ClangParser.ParseLibrary(parserOptions))
{ {

7
src/Generator/Utils/ProcessHelper.cs

@ -1,14 +1,13 @@
using System; using System.Diagnostics;
using System.Diagnostics;
using System.Text; using System.Text;
namespace CppSharp.Utils namespace CppSharp.Utils
{ {
public class ProcessHelper public static class ProcessHelper
{ {
public static string Run(string path, string args, out int error, out string errorMessage) public static string Run(string path, string args, out int error, out string errorMessage)
{ {
using (Process process = new Process()) using (var process = new Process())
{ {
process.StartInfo.FileName = path; process.StartInfo.FileName = path;
process.StartInfo.Arguments = args; process.StartInfo.Arguments = args;

Loading…
Cancel
Save