Add CustomArgs to compile and link environment in build tool for customization

This commit is contained in:
Wojtek Figat
2023-05-26 13:43:20 +02:00
parent 90d633fb2d
commit 9572073eda
5 changed files with 18 additions and 0 deletions

View File

@@ -157,6 +157,11 @@ namespace Flax.Build.NativeCpp
/// </summary>
public readonly List<string> IncludePaths = new List<string>();
/// <summary>
/// The collection of custom arguments to pass to the compilator.
/// </summary>
public readonly HashSet<string> CustomArgs = new HashSet<string>();
/// <inheritdoc />
public object Clone()
{
@@ -183,6 +188,7 @@ namespace Flax.Build.NativeCpp
};
clone.PreprocessorDefinitions.AddRange(PreprocessorDefinitions);
clone.IncludePaths.AddRange(IncludePaths);
clone.CustomArgs.AddRange(CustomArgs);
return clone;
}
}

View File

@@ -106,6 +106,11 @@ namespace Flax.Build.NativeCpp
/// </summary>
public readonly List<string> LibraryPaths = new List<string>();
/// <summary>
/// The collection of custom arguments to pass to the linker.
/// </summary>
public readonly HashSet<string> CustomArgs = new HashSet<string>();
/// <inheritdoc />
public object Clone()
{
@@ -127,6 +132,7 @@ namespace Flax.Build.NativeCpp
clone.DocumentationFiles.AddRange(DocumentationFiles);
clone.InputLibraries.AddRange(InputLibraries);
clone.LibraryPaths.AddRange(LibraryPaths);
clone.CustomArgs.AddRange(CustomArgs);
return clone;
}
}

View File

@@ -125,6 +125,7 @@ namespace Flax.Build.Platforms
// Setup arguments shared by all source files
var commonArgs = new List<string>();
commonArgs.AddRange(options.CompileEnv.CustomArgs);
{
commonArgs.Add("-c");
commonArgs.Add("-fmessage-length=0");
@@ -252,6 +253,7 @@ namespace Flax.Build.Platforms
// Setup arguments
var args = new List<string>();
args.AddRange(options.LinkEnv.CustomArgs);
{
args.Add(string.Format("-o \"{0}\"", outputFilePath));
AddArgsCommon(options, args);

View File

@@ -315,6 +315,7 @@ namespace Flax.Build.Platforms
// Setup arguments shared by all source files
var commonArgs = new List<string>();
commonArgs.AddRange(options.CompileEnv.CustomArgs);
SetupCompileCppFilesArgs(graph, options, commonArgs, outputPath);
{
commonArgs.Add("-c");
@@ -501,6 +502,7 @@ namespace Flax.Build.Platforms
// Setup arguments
var args = new List<string>();
args.AddRange(options.LinkEnv.CustomArgs);
{
args.Add(string.Format("-o \"{0}\"", outputFilePath));

View File

@@ -428,6 +428,7 @@ namespace Flax.Build.Platforms
// Setup arguments shared by all source files
var commonArgs = new List<string>();
commonArgs.AddRange(options.CompileEnv.CustomArgs);
SetupCompileCppFilesArgs(graph, options, commonArgs);
{
// Suppress Startup Banner
@@ -669,6 +670,7 @@ namespace Flax.Build.Platforms
// Setup arguments
var args = new List<string>();
args.AddRange(options.LinkEnv.CustomArgs);
SetupLinkFilesArgs(graph, options, args);
{
// Suppress startup banner