Skip to content

Commit 017e119

Browse files
committed
Added RTTI flag to the CLI tool.
1 parent 1b444fc commit 017e119

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/CLI/CLI.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ static bool ParseCommandLineArgs(string[] args, List<string> errorMessages, ref
3030
optionSet.Add("p=|platform=", "the {PLATFORM} that the generated code will target: 'win', 'osx' or 'linux'", p => { GetDestinationPlatform(p, errorMessages); } );
3131
optionSet.Add("a=|arch=", "the {ARCHITECTURE} that the generated code will target: 'x86' or 'x64'", a => { GetDestinationArchitecture(a, errorMessages); } );
3232

33-
optionSet.Add("exceptions", "enables support for C++ exceptions in the parser", v => { options.Arguments.Add("-fcxx-exceptions"); });
33+
optionSet.Add("exceptions", "enables support for C++ exceptions in the parser", v => { options.EnableExceptions = true; });
34+
optionSet.Add("rtti", "enables support for C++ RTTI in the parser", v => { options.EnableRTTI = true; });
3435

3536
optionSet.Add("c++11", "enables GCC C++ 11 compilation (valid only for Linux platform)", cpp11 => { options.Cpp11ABI = (cpp11 != null); } );
3637
optionSet.Add("cs|checksymbols", "enable the symbol check for the generated code", cs => { options.CheckSymbols = (cs != null); } );

src/CLI/Generator.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,16 @@ public void Setup(Driver driver)
185185
parserOptions.AddDefines(d.Key + "=" + d.Value);
186186
}
187187

188+
parserOptions.UnityBuild = options.UnityBuild;
189+
parserOptions.EnableRTTI = options.EnableRTTI;
190+
191+
if (options.EnableExceptions)
192+
parserOptions.AddArguments("-fcxx-exceptions");
193+
188194
driverOptions.GenerateDebugOutput = options.Debug;
189195
driverOptions.CompileCode = options.Compile;
190196
driverOptions.OutputDir = options.OutputDir;
191197
driverOptions.CheckSymbols = options.CheckSymbols;
192-
parserOptions.UnityBuild = options.UnityBuild;
193198
driverOptions.Verbose = options.Verbose;
194199
}
195200

src/CLI/Options.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ class Options
3636
public TargetArchitecture Architecture { get; set; } = TargetArchitecture.x86;
3737

3838
public GeneratorKind Kind { get; set; } = GeneratorKind.CSharp;
39-
39+
4040
public bool CheckSymbols { get; set; }
4141

4242
public bool UnityBuild { get; set; }
4343

4444
public bool Cpp11ABI { get; set; }
4545

46+
public bool EnableExceptions { get; set; }
47+
48+
public bool EnableRTTI { get; set; }
49+
4650
public bool Compile { get; set; }
4751

4852
public bool Debug { get; set; }

0 commit comments

Comments
 (0)