diff --git a/src/CLI/CLI.cs b/src/CLI/CLI.cs index 1d3a0301..16c0945e 100644 --- a/src/CLI/CLI.cs +++ b/src/CLI/CLI.cs @@ -32,6 +32,7 @@ namespace CppSharp optionSet.Add("g=|gen=|generator=", "the {TYPE} of generated code: 'csharp' or 'cli' ('cli' supported only for Windows)", g => { GetGeneratorKind(g, errorMessages); } ); optionSet.Add("p=|platform=", "the {PLATFORM} that the generated code will target: 'win', 'osx' or 'linux'", p => { GetDestinationPlatform(p, errorMessages); } ); optionSet.Add("a=|arch=", "the {ARCHITECTURE} that the generated code will target: 'x86' or 'x64'", a => { GetDestinationArchitecture(a, errorMessages); } ); + optionSet.Add("prefix=", "sets a string prefix to the names of generated files", a => { options.Prefix = a; }); optionSet.Add("exceptions", "enables support for C++ exceptions in the parser", v => { options.EnableExceptions = true; }); optionSet.Add("rtti", "enables support for C++ RTTI in the parser", v => { options.EnableRTTI = true; }); diff --git a/src/CLI/Generator.cs b/src/CLI/Generator.cs index 9e700808..47c1ceb9 100644 --- a/src/CLI/Generator.cs +++ b/src/CLI/Generator.cs @@ -187,6 +187,10 @@ namespace CppSharp driverOptions.OutputDir = options.OutputDir; driverOptions.CheckSymbols = options.CheckSymbols; driverOptions.Verbose = options.Verbose; + + if (!string.IsNullOrEmpty(options.Prefix)) + driverOptions.GenerateName = name => + options.Prefix + name.FileNameWithoutExtension; } private void SetupLinuxOptions(ParserOptions parserOptions) diff --git a/src/CLI/Options.cs b/src/CLI/Options.cs index f9669e47..0caa2b6b 100644 --- a/src/CLI/Options.cs +++ b/src/CLI/Options.cs @@ -30,6 +30,8 @@ namespace CppSharp public string OutputFileName { get; set; } public string InputLibraryName { get; set; } + + public string Prefix { get; set; } public TargetPlatform? Platform { get; set; }