Browse Source

Add friendly option to enable exceptions

pg
josetr 3 years ago
parent
commit
63d3f7ade8
  1. 2
      src/CLI/Generator.cs
  2. 4
      src/Parser/ParserOptions.cs

2
src/CLI/Generator.cs

@ -150,7 +150,7 @@ namespace CppSharp
} }
if (options.EnableExceptions) if (options.EnableExceptions)
parserOptions.AddArguments("-fcxx-exceptions"); parserOptions.EnableExceptions = true;
driverOptions.GenerateDebugOutput = options.Debug; driverOptions.GenerateDebugOutput = options.Debug;
driverOptions.CompileCode = options.Compile; driverOptions.CompileCode = options.Compile;

4
src/Parser/ParserOptions.cs

@ -86,6 +86,7 @@ namespace CppSharp.Parser
TargetTriple.Contains("windows") || TargetTriple.Contains("msvc"); TargetTriple.Contains("windows") || TargetTriple.Contains("msvc");
public bool EnableRTTI { get; set; } public bool EnableRTTI { get; set; }
public bool EnableExceptions { get; set; }
public LanguageVersion? LanguageVersion { get; set; } public LanguageVersion? LanguageVersion { get; set; }
public void BuildForSourceFile( public void BuildForSourceFile(
@ -367,6 +368,9 @@ namespace CppSharp.Parser
if (!EnableRTTI) if (!EnableRTTI)
AddArguments("-fno-rtti"); AddArguments("-fno-rtti");
if (EnableExceptions)
AddArguments("-fcxx-exceptions");
} }
public string BuiltinsDir public string BuiltinsDir

Loading…
Cancel
Save