# Command Line Options

## FBuild.exe

Option | Summary
--- | ---
-cache[read|write] | Use the build cache.
-clean | Force a clean build.
-config [path] | Explicity specify the config file to use.
-dist | Enable distributed compilation.
-fixuperrorpaths | Reformat GCC/SNC/Clang error messages in Visual Studio format.
-help | Show usage help.
-jX | Explicitly set worker thread count.
-nooutputbuffering | Don't buffer output written to stdout.
-noprogress | Don't show the progress bar while building.
-report | Output a report at build termination.
-showcmds | Show command lines used to launch external processes.
-summary | Show a summary at the end of the build.
-verbose | Show detailed diagnostic information for debugging.
-version | Print version and exit.
-vs | VisualStudio mode.
-wait | Wait for a previous build to complete before starting.
-wrapper | Wrapper mode for Visual Studio.

## FBuildWorker.exe

Option | Summary
--- | ---
-cpus=[n|-n|n%] | Control worker CPUs allocation.
-mode=[disabled|idle|dedicated] | Control worker availability.
-nosubprocess | Don't spawn as a sub-process.

## FBuild.exe Detailed

-cache[read|write]

Enable usage of the build cache. The cache options need to be configured in the build configuration file.

The cache can be enabled as read only or write only with '-cacheread' or '-cachewrite'. This can be useful for automated build systems, where you might like one machine to populate the cache for read-only use by other users.

Use of '-cache' is equivalent to '-cachread' and '-cachewrite' together.

-clean

Force a clean build. The build configuration file is re-parsed and all exsiting dependency information is discarded. A build is performed as if building for the first time with no built files present.

-config [path]

Explicity specify the config file to use. By default, FASTBuild looks for "fbuild.bff" in the current directory. This options allows a file to be explicitly specified instead.

-dist

Enable distributed compilation. Requires some build configuration.

-fixuperrorpaths

Enables re-formatting of warnings, errors and notes for GCC/SNC & Clang to Visual Studio format. Additionally, relative paths are expanded to full paths. This allows these errors to be double-clickable inside Visual Studio.

Enabled automatically when '-vs' is used.

-help

Prints command line usage information, as per the summary at the top of this page.

-jX

Overrides the number of tasks which can be built in parallel, which by default is controlled by the standard NUMBER_OF_PROCESSORS windows environment variable.

A value of 0 for X indicates that no additional threads should be spawned, and build graph processing and compilation should occur on the same thread. This can be useful for buid process debugging, especially when combined with the '-verbose' option.

Positive values can be used to exactly set the number of tasks which can be performed in parallel. This can be used to limit CPU usage on a machine that needs to perform other work while compilation is in progress. Values greater than the number of physical processors are accepted, but will almost certainly result in degraded performance.

Generally, this option should be omitted for optimal compilation performance, but it's possible that on some systems, tweaking this might yield improved performance.

-nooutputbuffering

Don't buffer output written to stdout.

This should be used when targetting compilation from within Visual Studio or another IDE. (or use -vs)

-noprogress

Suppresses the progress bar that is normally shown while compiling.

This should be used when targetting compilation from within Visual Studio or another IDE. (or use -vs)

-report

Ouput a detailed report at the end of the build. The report is written to report.html in the current directory.

The build report contains details of:

- The build environment (version, cmd line used etc.)
- All items built.
- Cache utilization.
- Include file usage.

NOTE: This option will lengthen the total build time, depending on the complexity of the build.

-showcmds

Displays the full command lines passed to external tools as they are invoked.

This option is useful for debugging build configurations, where the -verbose mode is too spammy.

NOTE: This option may have an impact on build performance.

-summary

Displays a summary upon build completion.

-verbose

Show detailed diagnostic information for debugging.

This can be used to provide more information when debugging a build configuration problem. It will display detailed information as the build configuration is parsed, as well as detailed information during the build, including full command line arguments passed to external executables.

It is usually useful to combine this flag with -j0 to serialize the build process and output (avoiding the output of different threads being mixed together).

-version

Prints executable version information and exits. No configuration parsing or building is performed.

-vs

VisualStudio mode. Same as '-nooutputbuffering', '-noprogress', '-fixuperrorpaths' and '-wrapper'.

-wait

Wait for a previous build to complete before starting.

Only one instance of FASTBuild can run at a time. Normally, if you wish to build multiple targets, you specify them together on the command line. This allows for paralellization across both targets.

If a second process is launched with -wait command line arg, instead of failing, it will start after the first process completes. This will be slower than if both targets were invoked together on the original command line.

-wrapper

Spawns FASTBuild via an intermediate sub-process to be able to cleanly terminate a build from Visual Studio.

When cancelling a build in Visual Studio, the FASTBuild process will be killed, with no opportunity to save the build database, resulting in lost compilation work. Specifying this option spawns an orpaphaned child process to do the actual work. When the parent process is terminated by Visual Studio, the child process detects this and cleanly shuts down.

Is a subsequent "wrapper mode" build is initiated before the first terminates, FASTBuild will wait for this first process to complete.

## FBuildWorker.exe Detailed

-cpus=[n|-n|n%]

Control worker CPUs allocation.

The number of workers available is normally controlled through the UI of the FBuildWorker.exe. The "-cpus" command line option will override this as follows:

Syntax | Description
--- | ---
-cpus=n | Value n will be used.
-cpus=-n | Value of NUMBER_OF_PROCESSORS-n will be used.
-cpus=n% | Specify number of CPUs as a percentage of NUMBER_OF_PROCESSORS.

In all cases, the number used will be clamped between 1 and the NUMBER_OF_PROCESSORS environment variable.

NOTE: The newly overridden options will be saved and used on subsequent restarts of the worker.

-mode=[disabled|idle|dedicated]

Control worker availability.

The FBuildWorker.exe mode is normally controlled through the UI. The "-mode" command line option will override this as follows:

Syntax | Description
--- | ---
-mode=disabled | Worker will accept no tasks.
-mode=idle | Worker will accept tasks when PC is considerd idle.
-mode=dedicated | Worker will accept tasks regardless of PC state.

NOTE: The newly overridden options will be saved and used on subsequent restarts of the worker.

-nosubprocess

Don't spawn a sub-process copy of the worker.

By default, when the FBuildWorker is launched, it makes a copy of itself (FBuildWorker.exe.copy), launches the copy and terminates. The duplicate process monitors the original executable file for changes, and re-launches itself if the file is updated. In this way, the FBuildWorker.exe can be kept under revision control, and when synchronized to a new version, will automatically re-start.

The "-nosubprocess" option supresses this behaviour.