# Compiler

Summary

Specifies compiler and related files for network distribution.

Compiler( 'name' ) // (optional) Alias { .Executable // Primary compiler executable .ExtraFiles // (optional) Additional files (usually dlls) required by the compiler. // Additional Options .VS2012EnumBugFix // (optional) Enable work-around for bug in VS2012 compiler (default: false) }
Details

FASTBuild needs to know the location of your compiler executable. The filename of the executable is used to make determinations at runtime about how FASTBuild interacts with the compiler.

For distributed compilation, FASTBuild additionally needs to know the list of additional files that need to be synchronized to the remote machine.

A compiler can be declared as follows:

Compiler( 'Compiler-Clang-Windows' ) { .Executable = '$ClangForWindowsBasePath$\clang++.exe' }
A declared compiler can then be referenced by an ObjectList or Library:
Library( 'libA' ) { .Compiler = 'Compiler-Clang-Windows' // Other options as normal...
Basic Options

.Executable - String - (Required)

The primary compiler executable that will be invoked by FASTBuild when this Compiler() is used.

.ExtraFiles - String/ArrayOfStrings - (Optional)

For distributed compilation, the specified files will also be synchronized to the remote machine. The relative location of the source files controls how they will be mirrored on the remote machine. Files in 'ExtraFiles' in the same directory or in sub-directories under the primary 'Executable' will be placed in the same relative location on the remote machine. 'ExtraFiles' in other folders will be placed at the same level as the executable.

// Path behaviour example Compiler( 'Test' ) { .Executable = 'C:\compiler\compiler.exe' // dest: compiler.exe .ExtraFiles = { 'C:\compiler\subdir\helper.dll' // dest: subdir/helper.exe 'C:\cruntime\mvscrt.dll' // dest: msvcrt.dll }
Additional Options

.VS2012EnumBugFix - Bool - (Optional)

NOTE: This option incurs a minor build time cost that impacts compile times.

A bug exists in the Visual Studio 2012 compiler whereby enums in preprocessed code are sometimes incorrectly processed when they lie on specific buffer alignment boundaries. This bug is fixed in Visual Studio 2013 and later.

If a manual work around (described below) is impractical or undesireable, the .VS2012EnumBugFix option can be enabled to work around the problem at build time.

When the bug occurs, the following code:

enum dateorder { no_order, dmy, mdy, ymd, ydm };
May be incorrectly pre-processed as:
enummdateorder { no_order, dmy, mdy, ymd, ydm };
This results in very unintuitive compile errors.

This bug can be avoided by inserting additional whitespace into the enum declaration as follows:

enum dateorder { no_order, dmy, mdy, ymd, ydm };
This work-around may be impractical if a large number of enums are affected, or if the enum(s) originate in system headers or external code. In those cases the .VS2012EnumBugFix option can be enabled to insert the additional whitespace at build-time.
Examples
Clang
// Clang for Windows Compiler( 'Compiler-x86Clang' ) { .Executable = '$ClangForWindowsBasePath$\clang++.exe' }
MSVC - 2013
// VisualStudio 2013 x86 Compiler Compiler( 'Compiler-x86' ) { .Executable = '$VSBasePath$\VC\bin\cl.exe' .ExtraFiles = { '$VSBasePath$\VC\bin\c1.dll' '$VSBasePath$\VC\bin\c1ast.dll', '$VSBasePath$\VC\bin\c1xx.dll', '$VSBasePath$\VC\bin\c1xxast.dll', '$VSBasePath$\VC\bin\c2.dll', '$VSBasePath$\VC\bin\msobj120.dll' '$VSBasePath$\VC\bin\mspdb120.dll' '$VSBasePath$\VC\bin\mspdbcore.dll' '$VSBasePath$\VC\bin\mspft120.dll' '$VSBasePath$\VC\bin\1033\clui.dll' '$VSBasePath$\VC\redist\x86\Microsoft.VC120.CRT\msvcp120.dll' '$VSBasePath$\VC\redist\x86\Microsoft.VC120.CRT\msvcr120.dll' '$VSBasePath$\VC\redist\x86\Microsoft.VC120.CRT\vccorlib120.dll' } }
MSVC - 2010
// VisualStudio 2010 x86 Compiler Compiler( "Compiler-x86" ) { .Executable = '$VSBasePath$\VC\bin\cl.exe' .ExtraFiles = { '$VSBasePath$\VC\bin\c1.dll' '$VSBasePath$\VC\bin\c1xx.dll' '$VSBasePath$\VC\bin\c2.dll' '$VSBasePath$\Common7\IDE\mspdb100.dll' '$VSBasePath$\Common7\IDE\msobj100.dll' '$VSBasePath$\Common7\IDE\mspdbsrv.exe' '$VSBasePath$\Common7\IDE\mspdbcore.dll' '$VSBasePath$\VC\bin\1033\clui.dll' '$VSBasePath$\VC\redist\x86\Microsoft.VC100.CRT\msvcp100.dll' '$VSBasePath$\VC\redist\x86\Microsoft.VC100.CRT\msvcr100.dll' } }
Intel
// Intel 2015 Update 4 x64 Compiler Compiler( 'Compiler-x64Intel' ) { .Executable = '$IntelBasePath$\bin\intel64\icl.exe' .ExtraFiles = { // DLLs required by icl.exe '$IntelBasePath$\bin\intel64\FNP_Act_Installer.dll' '$IntelBasePath$\bin\intel64\IntelRemoteMon.dll' // EXEs used by icl.exe '$IntelBasePath$\bin\intel64\mcpcom.exe' // License file 'C:\Program Files (x86)\Common Files\Intel\Licenses\XXXXXXXXXX.lic' // NOTE: Your license file // Intel compiler depends on the Microsoft compiler '$VSBasePath$\VC\bin\amd64\cl.exe' '$VSBasePath$\VC\bin\amd64\c1.dll' '$VSBasePath$\VC\bin\amd64\c1ast.dll', '$VSBasePath$\VC\bin\amd64\c1xx.dll', '$VSBasePath$\VC\bin\amd64\c1xxast.dll', '$VSBasePath$\VC\bin\amd64\c2.dll', '$VSBasePath$\VC\bin\amd64\msobj120.dll' '$VSBasePath$\VC\bin\amd64\mspdb120.dll' '$VSBasePath$\VC\bin\amd64\mspdbsrv.exe' '$VSBasePath$\VC\bin\amd64\mspdbcore.dll' '$VSBasePath$\VC\bin\amd64\mspft120.dll' '$VSBasePath$\VC\bin\amd64\1033\clui.dll' '$VSBasePath$\VC\redist\x64\Microsoft.VC120.CRT\msvcp120.dll' '$VSBasePath$\VC\redist\x64\Microsoft.VC120.CRT\msvcr120.dll' '$VSBasePath$\VC\redist\x64\Microsoft.VC120.CRT\vccorlib120.dll' } }