Fastbuild basic stuff
This commit is contained in:
245
fbuild.bff
Normal file
245
fbuild.bff
Normal file
@@ -0,0 +1,245 @@
|
||||
#include "External/SDK/VisualStudio/VisualStudio.bff"
|
||||
#include "External/SDK/Clang/Clang.bff"
|
||||
#include "External/SDK/Windows/Windows.bff"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Settings
|
||||
//------------------------------------------------------------------------------
|
||||
Settings
|
||||
{
|
||||
#if __WINDOWS__
|
||||
#import TMP
|
||||
.Environment = { "PATH=$VS_PATH$;$WINDOWS_SDK_2019_PATH$",
|
||||
"TMP=$TMP$",
|
||||
"SystemRoot=C:\Windows" }
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Config Defines
|
||||
//------------------------------------------------------------------------------
|
||||
.Debug_Config =
|
||||
[
|
||||
.CompilerOptions = ' -DDEBUG -DPROFILING_ENABLED'
|
||||
.CompilerOptionsC = .CompilerOptions
|
||||
|
||||
.BuildConfigName = 'Debug'
|
||||
|
||||
#if !BUILDING_FROM_TESTS
|
||||
// Build writable files (Perforce "Open for edit") outside of Unity
|
||||
// to improve iteration times.
|
||||
// - Only in Debug as this impacts performance (inlining)
|
||||
// - Only when not building from tests (FASTBuild building itself)
|
||||
.UnityInputIsolateWritableFiles = true
|
||||
// Also not when building on CI (which builds from git).
|
||||
#if CI_BUILD
|
||||
.UnityInputIsolateWritableFiles = false
|
||||
#endif
|
||||
#endif
|
||||
]
|
||||
.Profile_Config =
|
||||
[
|
||||
.CompilerOptions = ' -DRELEASE -DPROFILING_ENABLED'
|
||||
.CompilerOptionsC = .CompilerOptions
|
||||
|
||||
.BuildConfigName = 'Profile'
|
||||
]
|
||||
.Release_Config =
|
||||
[
|
||||
.CompilerOptions = ' -DRELEASE'
|
||||
.CompilerOptionsC = .CompilerOptions
|
||||
.CompilerOptionsDeoptimized = .CompilerOptions
|
||||
|
||||
.BuildConfigName = 'Release'
|
||||
]
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Optimizations (MSVC)
|
||||
//------------------------------------------------------------------------------
|
||||
#if __WINDOWS__
|
||||
.Debug_Optimizations_MSVC =
|
||||
[
|
||||
.CompilerOptions = ' /MTd /Od /RTC1 /GS /Oy-'
|
||||
.CompilerOptionsC = .CompilerOptions
|
||||
]
|
||||
.Profile_Optimizations_MSVC =
|
||||
[
|
||||
.CompilerOptions = ' /MT /Ox /Oy /Oi /GS- /GF /Gy /Gw /Zo'
|
||||
.CompilerOptionsC = .CompilerOptions
|
||||
.LinkerOptions = ' /OPT:REF,ICF'
|
||||
]
|
||||
.Release_Optimizations_MSVC =
|
||||
[
|
||||
Using( .Profile_Optimizations_MSVC )
|
||||
.CompilerOptionsDeoptimized = .CompilerOptions
|
||||
- ' /Ox'
|
||||
+ ' /Od'
|
||||
]
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Optimizations (Clang/GCC)
|
||||
//------------------------------------------------------------------------------
|
||||
.Debug_Optimizations =
|
||||
[
|
||||
#if __WINDOWS__ // Using clang-cl.exe on Windows
|
||||
.CompilerOptions = ' /Od'
|
||||
#else
|
||||
.CompilerOptions = ' -O0'
|
||||
#endif
|
||||
.CompilerOptionsC = .CompilerOptions
|
||||
]
|
||||
.Profile_Optimizations =
|
||||
[
|
||||
.CompilerOptions = ' -O2'
|
||||
.CompilerOptionsC = .CompilerOptions
|
||||
]
|
||||
.Release_Optimizations =
|
||||
[
|
||||
Using( .Profile_Optimizations )
|
||||
.CompilerOptionsDeoptimized = .CompilerOptions
|
||||
- ' -O2'
|
||||
+ ' -O0'
|
||||
]
|
||||
|
||||
// X64
|
||||
//------------------------------------------------------------------------------
|
||||
#if __WINDOWS__
|
||||
.X64BaseConfig = .ToolChain_VS_Windows_X64
|
||||
+ .Windows10_SDK_X64
|
||||
.X64DebugConfig = .X64BaseConfig
|
||||
+ .Debug_Config
|
||||
+ .Debug_Optimizations_MSVC
|
||||
.X64ReleaseConfig = .X64BaseConfig
|
||||
+ .Release_Config
|
||||
+ .Release_Optimizations_MSVC
|
||||
.X64ProfileConfig = .X64BaseConfig
|
||||
+ .Profile_Config
|
||||
+ .Profile_Optimizations_MSVC
|
||||
#endif
|
||||
|
||||
// X64 Clang
|
||||
//------------------------------------------------------------------------------
|
||||
#if __WINDOWS__
|
||||
.X64ClangBaseConfig = .ToolChain_Clang_Windows
|
||||
+ .Windows10_SDK_X64_ClangCl
|
||||
.X64ClangDebugConfig = .X64ClangBaseConfig
|
||||
+ .Debug_Config
|
||||
+ .Debug_Optimizations
|
||||
.X64ClangReleaseConfig = .X64ClangBaseConfig
|
||||
+ .Release_Config
|
||||
+ .Release_Optimizations
|
||||
.X64ClangProfileConfig = .X64ClangBaseConfig
|
||||
+ .Profile_Config
|
||||
+ .Profile_Optimizations
|
||||
#endif
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
.OutputBase = 'Intermediate'
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// VisualStudio Project Generation
|
||||
//------------------------------------------------------------------------------
|
||||
#if __WINDOWS__
|
||||
.ProjectCommon =
|
||||
[
|
||||
.ProjectBuildCommand = 'cd ^$(SolutionDir)\..\..\Code\ & fbuild -vs -dist -monitor -cache ^$(ProjectName)-^$(Configuration)'
|
||||
.ProjectRebuildCommand = 'cd ^$(SolutionDir)\..\..\Code\ & fbuild -vs -dist -monitor -cache -clean ^$(ProjectName)-^$(Configuration)'
|
||||
.OutputDirectory = '^$(SolutionDir)\Temp'
|
||||
.IntermediateDirectory = '^$(SolutionDir)\Temp'
|
||||
.BuildLogFile = '^$(SolutionDir)\Temp\^$(ProjectName)-^$(Configuration).log'
|
||||
.Platform = 'x64'
|
||||
.PlatformToolset = '$VS_PlatformToolset$'
|
||||
]
|
||||
|
||||
.Project_x64_Debug = [ Using( .ProjectCommon ) .SolutionPlatform = 'x64' .SolutionConfig = 'Debug' .Config = '$SolutionPlatform$-$SolutionConfig$' ]
|
||||
.Project_x64_Profile = [ Using( .ProjectCommon ) .SolutionPlatform = 'x64' .SolutionConfig = 'Profile' .Config = '$SolutionPlatform$-$SolutionConfig$' ]
|
||||
.Project_x64_Release = [ Using( .ProjectCommon ) .SolutionPlatform = 'x64' .SolutionConfig = 'Release' .Config = '$SolutionPlatform$-$SolutionConfig$' ]
|
||||
.Project_x64Clang_Debug = [ Using( .ProjectCommon ) .SolutionPlatform = 'x64Clang' .SolutionConfig = 'Debug' .Config = '$SolutionPlatform$-$SolutionConfig$' ]
|
||||
.Project_x64Clang_Profile = [ Using( .ProjectCommon ) .SolutionPlatform = 'x64Clang' .SolutionConfig = 'Profile' .Config = '$SolutionPlatform$-$SolutionConfig$' ]
|
||||
.Project_x64Clang_Release = [ Using( .ProjectCommon ) .SolutionPlatform = 'x64Clang' .SolutionConfig = 'Release' .Config = '$SolutionPlatform$-$SolutionConfig$' ]
|
||||
#endif
|
||||
|
||||
// Configurations
|
||||
//------------------------------------------------------------------------------
|
||||
#if __WINDOWS__
|
||||
.BuildConfigs = { .X64DebugConfig, .X64ProfileConfig, .X64ReleaseConfig
|
||||
.X64ClangDebugConfig, .X64ClangProfileConfig, .X64ClangReleaseConfig }
|
||||
#endif
|
||||
|
||||
.Targets_x64_Debug = {}
|
||||
.Targets_x64_Profile = {}
|
||||
.Targets_x64_Release = {}
|
||||
.Targets_x64Clang_Debug = {}
|
||||
.Targets_x64Clang_Profile = {}
|
||||
.Targets_x64Clang_Release = {}
|
||||
|
||||
// Include all projects to build
|
||||
#include "Juliet/Juliet.bff"
|
||||
|
||||
// Aliases : All-$Platform$-$Config$
|
||||
//------------------------------------------------------------------------------
|
||||
ForEach( .BuildConfig in .BuildConfigs )
|
||||
{
|
||||
Using( .BuildConfig )
|
||||
|
||||
Alias( 'All-$Platform$-$BuildConfigName$' ) { .Targets = .'Targets_$Platform$_$BuildConfigName$' }
|
||||
}
|
||||
|
||||
// Exes
|
||||
//------------------------------------------------------------------------------
|
||||
Alias( 'Exes' )
|
||||
{
|
||||
.Targets = { 'FBuildWorker-Debug', 'FBuildWorker-Profile', 'FBuildWorker-Release'
|
||||
'FBuild-Debug', 'FBuild-Profile', 'FBuild-Release' }
|
||||
}
|
||||
|
||||
// Aliases : All-$Platform$
|
||||
//------------------------------------------------------------------------------
|
||||
.Platforms =
|
||||
{
|
||||
'x64',
|
||||
'x64Clang',
|
||||
}
|
||||
.PlatformConfigs_x64 = { 'Debug', 'Profile', 'Release' }
|
||||
.PlatformConfigs_x64Clang = { 'Debug', 'Profile', 'Release' }
|
||||
|
||||
ForEach( .Platform in .Platforms )
|
||||
{
|
||||
Alias( 'All-$Platform$' )
|
||||
{
|
||||
.Targets = {}
|
||||
ForEach( .Config in .'PlatformConfigs_$Platform$' )
|
||||
{
|
||||
// TODO:B Exclude windows configs that don't work yet
|
||||
// x64Clang Analyze config - not working yet
|
||||
// x64Clang ASan config - not working yet
|
||||
// x64Clang TSan config - not working yet (not supported by Clang on Windows)
|
||||
// x64 ASan config - not working yet
|
||||
// x64 TSan config - not working yet (not supported by MSVC on Windows)
|
||||
If( !( ( .Platform == 'x64Clang' ) && ( .Config == 'Analyze' ) ) &&
|
||||
!( ( .Platform == 'x64Clang' ) && ( .Config == 'ASan' ) ) &&
|
||||
!( ( .Platform == 'x64Clang' ) && ( .Config == 'TSan' ) ) &&
|
||||
!( ( .Platform == 'x64' ) && ( .Config == 'ASan' ) ) &&
|
||||
!( ( .Platform == 'x64' ) && ( .Config == 'TSan' ) ) )
|
||||
{
|
||||
^Targets + { 'All-$Platform$-$Config$' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Aliases : All
|
||||
//------------------------------------------------------------------------------
|
||||
#if __WINDOWS__
|
||||
Alias( 'All' )
|
||||
{
|
||||
.Targets = { 'All-x64Clang',
|
||||
'All-x64',
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user