File tree Expand file tree Collapse file tree 4 files changed +13
-1
lines changed
FFmpeg.AutoGen.CppSharpUnsafeGenerator Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,10 @@ public class CliOptions
5959 HelpText = "Print details during execution." ) ]
6060 public bool Verbose { get ; set ; }
6161
62+ [ Option ( "fileHeader" ,
63+ HelpText = "Optional string to use as header for generated files." ) ]
64+ public string FileHeader { get ; set ; }
65+
6266 [ Option ( "noCustomStringMarshal" ,
6367 Default = false ,
6468 HelpText = "Don't use custom string marshallers; all strings are marshalled as UnmanagedType.LPUTF8Str regardless of .NET target framework." ) ]
Original file line number Diff line number Diff line change @@ -15,4 +15,5 @@ internal sealed record GenerationContext
1515 public Dictionary < string , InlineFunctionDefinition > ExistingInlineFunctionMap { get ; init ; } = new ( ) ;
1616 public string SolutionDir { get ; init ; } = string . Empty ;
1717 public string OutputDir { get ; init ; } = string . Empty ;
18+ public string FileHeader { get ; init ; } = string . Empty ;
1819}
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ void IDisposable.Dispose()
5252
5353 public virtual void Generate ( )
5454 {
55+ if ( ! string . IsNullOrEmpty ( Context . FileHeader ) )
56+ {
57+ WriteLine ( Context . FileHeader ) ;
58+ WriteLine ( ) ;
59+ }
60+
5561 var usings = Usings ( ) . ToList ( ) ;
5662 usings . ForEach ( ns => WriteLine ( $ "using { ns } ;") ) ;
5763 if ( usings . Count > 0 ) WriteLine ( ) ;
Original file line number Diff line number Diff line change @@ -67,7 +67,8 @@ internal static void Main(string[] args)
6767 . ToDictionary ( x => x . LibraryName , x => x . LibraryVersion ) ,
6868 Definitions = processingContext . Definitions . ToArray ( ) ,
6969 ExistingInlineFunctionMap = inlineFunctions . ToDictionary ( f => f . Name ) ,
70- SolutionDir = options . SolutionDir
70+ SolutionDir = options . SolutionDir ,
71+ FileHeader = options . FileHeader ,
7172 } ;
7273
7374 GenerateLegacyFFmpegAutoGen ( generationContext ) ;
You can’t perform that action at this time.
0 commit comments