Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions FFmpeg.AutoGen.CppSharpUnsafeGenerator/CliOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public class CliOptions
HelpText = "Print details during execution.")]
public bool Verbose { get; set; }

[Option("fileHeader",
HelpText = "Optional string to use as header for generated files.")]
public string FileHeader { get; set; }

[Option("noCustomStringMarshal",
Default = false,
HelpText = "Don't use custom string marshallers; all strings are marshalled as UnmanagedType.LPUTF8Str regardless of .NET target framework.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ internal sealed record GenerationContext
public Dictionary<string, InlineFunctionDefinition> ExistingInlineFunctionMap { get; init; } = new();
public string SolutionDir { get; init; } = string.Empty;
public string OutputDir { get; init; } = string.Empty;
public string FileHeader { get; init; } = string.Empty;
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ void IDisposable.Dispose()

public virtual void Generate()
{
if (!string.IsNullOrEmpty(Context.FileHeader))
{
WriteLine(Context.FileHeader);
WriteLine();
}

var usings = Usings().ToList();
usings.ForEach(ns => WriteLine($"using {ns};"));
if (usings.Count > 0) WriteLine();
Expand Down
3 changes: 2 additions & 1 deletion FFmpeg.AutoGen.CppSharpUnsafeGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ internal static void Main(string[] args)
.ToDictionary(x => x.LibraryName, x => x.LibraryVersion),
Definitions = processingContext.Definitions.ToArray(),
ExistingInlineFunctionMap = inlineFunctions.ToDictionary(f => f.Name),
SolutionDir = options.SolutionDir
SolutionDir = options.SolutionDir,
FileHeader = options.FileHeader,
};

GenerateLegacyFFmpegAutoGen(generationContext);
Expand Down
Loading