|
3 | 3 | using System.IO;
|
4 | 4 | using System.Linq;
|
5 | 5 | using CppSharp.Generators;
|
| 6 | +using CppSharp.Passes; |
6 | 7 | using Mono.Options;
|
7 | 8 |
|
8 | 9 | namespace CppSharp
|
@@ -34,6 +35,7 @@ static bool ParseCommandLineArgs(string[] args, List<string> errorMessages, ref
|
34 | 35 | optionSet.Add("p=|platform=", "the {PLATFORM} that the generated code will target: 'win', 'osx' or 'linux' or 'emscripten'", p => { GetDestinationPlatform(p, errorMessages); });
|
35 | 36 | optionSet.Add("a=|arch=", "the {ARCHITECTURE} that the generated code will target: 'x86' or 'x64' or 'wasm32' or 'wasm64'", a => { GetDestinationArchitecture(a, errorMessages); });
|
36 | 37 | optionSet.Add("prefix=", "sets a string prefix to the names of generated files", a => { options.Prefix = a; });
|
| 38 | + optionSet.Add("property=", "the property detection mode to use: 'all', 'none' or 'keywords' or 'heuristics'", p => { GetPropertyMode(p, errorMessages); }); |
37 | 39 |
|
38 | 40 | optionSet.Add("exceptions", "enables support for C++ exceptions in the parser", v => { options.EnableExceptions = true; });
|
39 | 41 | optionSet.Add("rtti", "enables support for C++ RTTI in the parser", v => { options.EnableRTTI = true; });
|
@@ -269,6 +271,27 @@ public static void GetDestinationArchitecture(string architecture, List<string>
|
269 | 271 | Defaulting to {options.Architecture}");
|
270 | 272 | }
|
271 | 273 |
|
| 274 | + static void GetPropertyMode(string mode, List<string> errorMessages) |
| 275 | + { |
| 276 | + switch (mode.ToLower()) |
| 277 | + { |
| 278 | + case "all": |
| 279 | + options.PropertyMode = PropertyDetectionMode.All; |
| 280 | + return; |
| 281 | + case "none": |
| 282 | + options.PropertyMode = PropertyDetectionMode.None; |
| 283 | + return; |
| 284 | + case "dictionary": |
| 285 | + options.PropertyMode = PropertyDetectionMode.Dictionary; |
| 286 | + return; |
| 287 | + case "keywords": |
| 288 | + options.PropertyMode = PropertyDetectionMode.Keywords; |
| 289 | + return; |
| 290 | + } |
| 291 | + |
| 292 | + errorMessages.Add($"Unknown property detection mode: {mode}. Defaulting to {options.PropertyMode}"); |
| 293 | + } |
| 294 | + |
272 | 295 | static void PrintErrorMessages(List<string> errorMessages)
|
273 | 296 | {
|
274 | 297 | foreach (string m in errorMessages)
|
|
0 commit comments