Skip to content
Closed
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
Add option to enable Linux cross builds for jit-format.
Currently, when jit-format attempts to build a fresh version of
compile-commands.json on Linux, it will always attempt a cross
build, regardless of whether this is accurate for the host system.

This patch adds an option to enable cross builds when on Linux,
rather than defaulting to always building with -cross.
  • Loading branch information
Lawrence Tang authored and Lawrence Tang committed Aug 17, 2023
commit 2062ec23529e0ac7d11ef56bb02cda362dfc0301
6 changes: 4 additions & 2 deletions src/jit-format/jit-format.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Config
private string _srcDirectory = null;
private bool _untidy = false;
private bool _noformat = false;
private bool _linuxCross = false;
private bool _fix = false;
private bool _verbose = false;
private bool _ignoreErrors = false;
Expand All @@ -63,13 +64,14 @@ public Config(string[] args)
syntax.DefineOption("v|verbose", ref _verbose, "Enable verbose output.");
syntax.DefineOption("untidy", ref _untidy, "Do not run clang-tidy");
syntax.DefineOption("noformat", ref _noformat, "Do not run clang-format");
syntax.DefineOption("l|linux-cross", ref _linuxCross, "If on Linux, run the configure build as a cross build.");
syntax.DefineOption("f|fix", ref _fix, "Fix formatting errors discovered by clang-format and clang-tidy.");
syntax.DefineOption("i|ignore-errors", ref _ignoreErrors, "Ignore clang-tidy errors");
syntax.DefineOptionList("projects", ref _projects, "List of build projects clang-tidy should consider (e.g. dll, standalone, protojit, etc.). Default: dll");

syntax.DefineParameterList("filenames", ref _filenames, "Optional list of files that should be formatted.");
});

// Run validation code on parsed input to ensure we have a sensible scenario.

validate();
Expand Down Expand Up @@ -301,7 +303,7 @@ private void validate()
{
Console.WriteLine("Can't find compile_commands.json file. Running configure.");
List<string> commandArgs = new() { _arch, _build, "configureonly", "-cmakeargs", "-DCMAKE_EXPORT_COMPILE_COMMANDS=1" };
if (_os.ToLower() == "linux")
if (_os.ToLower() == "linux" && _linuxCross)
{
commandArgs.Add("-cross");
}
Expand Down