JD2022-TU1/main/extern/FastBuild/Code/fbuild.bff

458 lines
16 KiB
Text

; FBuild
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
; Windows Platform
;-------------------------------------------------------------------------------
.VSBasePath = '../External/SDK/VS13.4'
.WindowsSDKBasePath = '../External/SDK/Windows8.1'
.ClangBasePath = '../External/SDK/ClangForWindows/3.4'
;-------------------------------------------------------------------------------
; Settings
;-------------------------------------------------------------------------------
Settings
{
.Environment = { "PATH=$VSBasePath$\Common7\IDE\;$VSBasePath$\VC\bin\",
"TMP=C:\Windows\Temp",
"SystemRoot=C:\Windows" }
.CachePath = "C:\.fbuild.cache"
}
//------------------------------------------------------------------------------
// Compilers
//------------------------------------------------------------------------------
Compiler( 'Compiler-x86' )
{
.Root = '$VSBasePath$\VC\bin'
.Executable = '$Root$\cl.exe'
.ExtraFiles = { '$Root$\c1.dll'
'$Root$\c1ast.dll',
'$Root$\c1xx.dll',
'$Root$\c1xxast.dll',
'$Root$\c2.dll',
'$Root$\msobj120.dll'
'$Root$\mspdb120.dll'
'$Root$\mspdbsrv.exe'
'$Root$\mspdbcore.dll'
'$Root$\mspft120.dll'
'$Root$\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'
}
}
Compiler( 'Compiler-x64' )
{
.Root = '$VSBasePath$\VC\bin'
.Executable = '$Root$\x86_amd64\cl.exe'
.ExtraFiles = { '$Root$\x86_amd64\c1.dll'
'$Root$\x86_amd64\c1ast.dll',
'$Root$\x86_amd64\c1xx.dll',
'$Root$\x86_amd64\c1xxast.dll',
'$Root$\x86_amd64\c2.dll',
'$Root$\x86_amd64\1033\clui.dll'
'$Root$\msobj120.dll'
'$Root$\mspdb120.dll'
'$Root$\mspdbsrv.exe'
'$Root$\mspdbcore.dll'
'$Root$\mspft120.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'
}
}
Compiler( 'Compiler-x86Clang' )
{
.Root = '$ClangBasePath$'
.Executable = '$Root$\bin\clang++.exe'
}
//------------------------------------------------------------------------------
// Configurations
//------------------------------------------------------------------------------
.MSVCBaseConfig =
[
.AdditionalWarnings = ' /we4062' // enumerator 'identifier' in a switch of enum 'enumeration' is not handled
+ ' /we4263' // 'function' : member function does not override any base class virtual member function
+ ' /we4265' // 'class': class has virtual functions, but destructor is not virtual
+ ' /we4296' // 'operator': expression is always false
+ ' /we4555' // expression has no effect; expected expression with side-effect
+ ' /we4619' // #pragma warning : there is no warning number 'number'
+ ' /we4640' // 'instance' : construction of local static object is not thread-safe
+ ' /we4826' // Conversion from 'type1 ' to 'type_2' is sign-extended. This may cause unexpected runtime behavior.
+ ' /we4836' // nonstandard extension used : 'type' : local types or unnamed types cannot be used as template arguments
+ ' /we4905' // wide string literal cast to 'LPSTR'
+ ' /we4906' // string literal cast to 'LPWSTR'
.CompilerOptions = '"%1" /Z7 /d2Zi+ /nologo /c /W4 /WX'
+ ' /Zc:inline' // Remove unreferenced COMDATs at compile time (VS2013.2+)
+ ' /Zc:strictStrings' // Require const only usage of string literals (VS2013+)
+ .AdditionalWarnings
+ ' /fp:fast'
+ ' /D"WIN32_LEAN_AND_MEAN" /D_WIN32 /D__WINDOWS__'
+ ' /D"_CRT_SECURE_NO_WARNINGS"' // don't warn about unsafe functions
+ ' /D"_WINSOCK_DEPRECATED_NO_WARNINGS"' // don't warn about deprecated winsock functions - TODO:C Update API use
.PCHOptions = .CompilerOptions
+ ' /Fp"%2" /Fo"%3"'
.CompilerOptions + ' /Fo"%2"'
.LibrarianOptions = '/NODEFAULTLIB /WX /NOLOGO /OUT:"%2" "%1"'
.LinkerOptions = '/NODEFAULTLIB /WX /NOLOGO /INCREMENTAL:NO /OUT:"%2" "%1" /DEBUG'
+ ' /IGNORE:4001' ; don't complain about linking libs only
// Optimizations
.CompilerDebugOptimizations = ' /MTd /Od /RTC1 /GS /Oy- /GR- /analyze'
.CompilerReleaseOptimizations = ' /MT /Ox /Oy /Oi /GS- /GF /GL /Gy /Gw /GR- /analyze'
.LibrarianDebugOptimizations = ''
.LibrarianReleaseOptimizations = ' /LTCG'
.LinkerDebugOptimizations = ''
.LinkerReleaseOptimizations = ' /LTCG /OPT:REF,ICF'
.BaseIncludePaths = ' /I"./"'
+ ' /I"$VSBasePath$/VC/include/"'
+ ' /I"$WindowsSDKBasePath$/include/um"'
+ ' /I"$WindowsSDKBasePath$/include/shared"'
.CompilerOptions + .BaseIncludePaths
.PCHOptions + .BaseIncludePaths
.WindowsLibPaths = '$WindowsSDKBasePath$/lib/winv6.3/um'
.UseExceptions = ' /EHsc'
]
// X86
//------------------------------------------------------------------------------
.X86BaseConfig =
[
Using( .MSVCBaseConfig )
.ToolsBasePath = '$VSBasePath$\VC\bin'
.Compiler = 'Compiler-x86'
.Librarian = '$ToolsBasePath$\lib.exe'
.Linker = '$ToolsBasePath$\link.exe'
.CompilerOptions + ' /arch:SSE2'
+ ' /DWIN32'
.PCHOptions + ' /arch:SSE2'
+ ' /DWIN32'
.LinkerOptions + ' /MACHINE:X86'
.Platform = 'x86'
.LinkerOptions + ' /LIBPATH:"$WindowsLibPaths$/x86" /LIBPATH:"$VSBasePath$/VC/lib"'
]
.X86DebugConfig =
[
Using( .X86BaseConfig )
.Config = 'Debug'
.CompilerOptions + ' /DDEBUG /DPROFILING_ENABLED'
+ .CompilerDebugOptimizations
.PCHOptions + ' /DDEBUG /DPROFILING_ENABLED'
+ .CompilerDebugOptimizations
.LibrarianOptions + .LibrarianDebugOptimizations
.LinkerOptions + .LinkerDebugOptimizations
]
.X86ReleaseConfig =
[
Using( .X86BaseConfig )
.Config = 'Release'
.CompilerOptions + ' /DRELEASE'
.PCHOptions + ' /DRELEASE'
// Setup de-optimization options (FASTBUILD_DEOPTIMIZE_OBJECT)
.DeoptimizeWritableFilesWithToken = true
.CompilerOptionsDeoptimized = '$CompilerOptions$ /Od'
.PCHOptionsDeoptimized = '$PCHOptions$ /Od'
.CompilerOptions + .CompilerReleaseOptimizations
.PCHOptions + .CompilerReleaseOptimizations
.LibrarianOptions + .LibrarianReleaseOptimizations
.LinkerOptions + .LinkerReleaseOptimizations
]
.X86ProfileConfig =
[
Using( .X86ReleaseConfig ) // Note: based on Release config
.Config = 'Profile'
.CompilerOptions + ' /DPROFILING_ENABLED'
.PCHOptions + ' /DPROFILING_ENABLED'
.DeoptimizeWritableFilesWithToken = false
]
// X64
//------------------------------------------------------------------------------
.X64BaseConfig =
[
Using( .MSVCBaseConfig )
.ToolsBasePath = '$VSBasePath$\VC\bin\x86_amd64'
.Compiler = 'Compiler-x64'
.Librarian = '$ToolsBasePath$\lib.exe'
.Linker = '$ToolsBasePath$\link.exe'
.CompilerOptions + ' /DWIN64'
.PCHOptions + ' /DWIN64'
.LinkerOptions + ' /MACHINE:X64'
.Platform = 'x64'
.LinkerOptions + ' /LIBPATH:"$WindowsLibPaths$/x64" /LIBPATH:"$VSBasePath$/VC/lib/amd64"'
]
.X64DebugConfig =
[
Using( .X64BaseConfig )
.Config = 'Debug'
.CompilerOptions + ' /DDEBUG /DPROFILING_ENABLED'
+ .CompilerDebugOptimizations
.PCHOptions + ' /DDEBUG /DPROFILING_ENABLED'
+ .CompilerDebugOptimizations
.LibrarianOptions + .LibrarianDebugOptimizations
.LinkerOptions + .LinkerDebugOptimizations
]
.X64ReleaseConfig =
[
Using( .X64BaseConfig )
.Config = 'Release'
.CompilerOptions + ' /DRELEASE'
.PCHOptions + ' /DRELEASE'
// Setup de-optimization options (FASTBUILD_DEOPTIMIZE_OBJECT)
.DeoptimizeWritableFilesWithToken = true
.CompilerOptionsDeoptimized = '$CompilerOptions$ /Od'
.PCHOptionsDeoptimized = '$PCHOptions$ /Od'
.CompilerOptions + .CompilerReleaseOptimizations
.PCHOptions + .CompilerReleaseOptimizations
.LibrarianOptions + .LibrarianReleaseOptimizations
.LinkerOptions + .LinkerReleaseOptimizations
]
.X64ProfileConfig =
[
Using( .X64ReleaseConfig ) // Note: based on Release config
.Config = 'Profile'
.CompilerOptions + ' /DPROFILING_ENABLED'
.PCHOptions + ' /DPROFILING_ENABLED'
.DeoptimizeWritableFilesWithToken = false
]
// X86 Clang
//------------------------------------------------------------------------------
.X86ClangConfig =
[
.ToolsBasePath = '$ClangBasePath$'
.Compiler = 'Compiler-x86Clang'
.Librarian = '$ToolsBasePath$\bin\llvm-ar.exe'
.Linker = '$VSBasePath$\VC\bin\link.exe' //'$ToolsBasePath$\lld.exe'
.WindowsLibPaths = '$WindowsSDKBasePath$/lib/winv6.3/um'
.CompilerOptions = '-o"%2" "%1" -c -g'
+ ' -I"./"'
+ ' -I"$VSBasePath$/VC/include/"'
+ ' -I"$WindowsSDKBasePath$/include/um"'
+ ' -I"$WindowsSDKBasePath$/include/shared"'
+ ' -D"WIN32_LEAN_AND_MEAN" -D_WIN32 -D__WINDOWS__'
+ ' -DWIN32 -D_WIN32'
+ ' -DRELEASE'
+ ' -D"_X86_=1" -D_M_IX86'
+ ' -D"_INTEGRAL_MAX_BITS=64"'
+ ' -D"_MSC_VER=1500"'
// MS compatibility
+ ' -fms-compatibility'
+ ' -fms-extensions'
+ ' -fmsc-version=1700'
+ ' -mms-bitfields'
+ ' -Wno-microsoft' // suppress "enumerator value is not representable in the underlying type 'int' [-Wmicrosoft]'"
+ ' -Wno-#pragma-messages'
+ ' -Werror' // warnings as errors
+ ' -fno-exceptions'
+ ' -fno-rtti'
+ ' -Wno-ignored-attributes' // ignore 'restrict, noalias' keyword
+ ' -Wno-c++11-extensions'
+ ' -Wno-c++11-long-long' // don't want about use of "long long"
+ ' -Wno-deprecated-declarations'
+ ' -Wno-unused-value' // TODO: Need to re-enable this
+ ' -integrated-as' // use the built-in assembler (don't try to use gcc)
+ ' -fdata-sections'
+ ' -ffunction-sections'
.PCHOptions = .CompilerOptions // TODO: Configure this properly
.LibrarianOptions = 'rc "%2" "%1"' // NOTE: output must come first
.LinkerOptions = '/NODEFAULTLIB /WX /NOLOGO /INCREMENTAL:NO /OUT:"%2" "%1" /DEBUG'
+ ' /IGNORE:4001' ; don't complain about linking libs only
+ ' /LIBPATH:"$WindowsLibPaths$/x86" /LIBPATH:"$VSBasePath$/VC/lib"'
+ ' /MACHINE:X86'
.Platform = 'x86Clang'
.Config = 'Debug'
.UseExceptions = ' -fexceptions'
]
// Resource Compiler
//------------------------------------------------------------------------------
.ResourceCompiler =
[
.Compiler = '$WindowsSDKBasePath$\Bin\x86\RC.exe'
.CompilerOutputExtension = '.res'
.CompilerOptions = '/nologo /fo"%2" %1'
]
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
.OutputBase = '..\tmp'
//------------------------------------------------------------------------------
// Unity/Blob files (shared across configs)
//------------------------------------------------------------------------------
.UnityInputIsolateWritableFiles = true
//------------------------------------------------------------------------------
// VisualStudio Project Generation
//------------------------------------------------------------------------------
.ProjectCommon =
[
.ProjectBuildCommand = 'cd ^$(SolutionDir)\..\..\ & fbuild -vs -dist -cache ^$(ProjectName)-^$(Configuration)'
.ProjectRebuildCommand = 'cd ^$(SolutionDir)\..\..\ & fbuild -vs -dist -cache -clean ^$(ProjectName)-^$(Configuration)'
.OutputDirectory = '^$(SolutionDir)\..\tmp2'
.IntermediateDirectory = '^$(SolutionDir)\..\tmp2'
.Platform = 'Win32' // unused
.PlatformToolset = 'v120'
.IncludeSearchPath = '^$(SolutionDir)..\..;.\'
.X86Defines = 'WIN32_LEAN_AND_MEAN;_WIN32;__WINDOWS__;WIN32;'
.X64Defines = 'WIN32_LEAN_AND_MEAN;_WIN32;__WINDOWS__;WIN64;'
.DebugDefines = 'DEBUG;PROFILING_ENABLED'
.ProfileDefines = 'RELEASE;PROFILING_ENABLED'
.ReleaseDefines = 'RELEASE'
]
.ProjectX86Debug = [ Using( .ProjectCommon ) .Config = 'x86-Debug' .PreprocessorDefinitions = .X86Defines + .DebugDefines ]
.ProjectX86Profile = [ Using( .ProjectCommon ) .Config = 'x86-Profile' .PreprocessorDefinitions = .X86Defines + .ProfileDefines ]
.ProjectX86Release = [ Using( .ProjectCommon ) .Config = 'x86-Release' .PreprocessorDefinitions = .X86Defines + .ReleaseDefines ]
.ProjectX64Debug = [ Using( .ProjectCommon ) .Config = 'x64-Debug' .PreprocessorDefinitions = .X64Defines + .DebugDefines ]
.ProjectX64Profile = [ Using( .ProjectCommon ) .Config = 'x64-Profile' .PreprocessorDefinitions = .X64Defines + .ProfileDefines ]
.ProjectX64Release = [ Using( .ProjectCommon ) .Config = 'x64-Release' .PreprocessorDefinitions = .X64Defines + .ReleaseDefines ]
.ProjectX86ClangDebug = [ Using( .ProjectCommon ) .Config = 'x86Clang-Debug' ]
.ProjectConfigs = { .ProjectX86Debug, .ProjectX86Profile, .ProjectX86Release,
.ProjectX64Debug, .ProjectX64Profile, .ProjectX64Release,
.ProjectX86ClangDebug }
VCXProject( 'All-proj' )
{
.ProjectOutput = '.\All.vcxproj'
.ProjectFiles = { '.\fbuild.bff' }
.ProjectBasePath = '.\'
}
// Configurations
//------------------------------------------------------------------------------
.Configs = { .X86DebugConfig, .X86ProfileConfig, .X86ReleaseConfig,
.X64DebugConfig, .X64ProfileConfig, .X64ReleaseConfig,
.X86ClangConfig }
.Configs_Windows_MSVC = { .X86DebugConfig, .X86ProfileConfig, .X86ReleaseConfig,
.X64DebugConfig, .X64ProfileConfig, .X64ReleaseConfig }
.Configs_Windows_Clang = { .X86ClangConfig }
// External
#include "..\External\LZ4\lz4-r117\LZ4.bff"
// Test Framework
#include "TestFramework\TestFramework.bff"
// Core
#include "Core\Core.bff"
#include "Core\CoreTest\CoreTest.bff"
// FBuild
#include "Tools\FBuild\FBuildCore\FBuildCore.bff"
#include "Tools\FBuild\FBuildApp\FBuildApp.bff"
#include "Tools\FBuild\FBuildWorker\FBuildWorker.bff"
#include "Tools\FBuild\FBuildTest\FBuildTest.bff"
// Aliases : All-$Platform$-$Config$
//------------------------------------------------------------------------------
ForEach( .Config in .Configs )
{
Using( .Config )
Alias( 'All-$Platform$-$Config$' )
{
.Targets = { // tests
'CoreTest-$Platform$-$Config$',
'FBuildTest-$Platform$-$Config$',
// executables
'FBuildApp-$Platform$-$Config$',
'FBuildWorker-$Platform$-$Config$'
// Clang doesn't link at the moment, so we need list all the libs manually
'Core-$Platform$-$Config$',
'TestFramework-$Platform$-$Config$',
'FBuildCore-$Platform$-$Config$'
}
}
}
// Aliases : All-$Platform$
//------------------------------------------------------------------------------
.Platforms = { 'x86', 'x64' }
ForEach( .Platform in .Platforms )
{
Alias( 'All-$Platform$' )
{
.Targets = { 'All-$Platform$-Debug',
'All-$Platform$-Profile',
'All-$Platform$-Release'
}
}
}
Alias( 'All-x86Clang' )
{
.Targets = { 'All-x86Clang-Debug' }
}
// Aliases : All
//------------------------------------------------------------------------------
Alias( 'All' )
{
.Targets = { 'All-x86',
'All-x86Clang',
'All-x64'
}
}
// Aliases : Tests
//------------------------------------------------------------------------------
Alias( 'Tests' )
{
.Targets = { 'CoreTest-RunTest-x86-Debug',
'CoreTest-RunTest-x86-Release',
'CoreTest-RunTest-x64-Debug',
'CoreTest-RunTest-x64-Release',
'FBuildTest-RunTest-x64-Debug'
}
}
// Aliases : All+Tests
//------------------------------------------------------------------------------
Alias( 'All+Tests' )
{
.Targets = { 'All', 'Tests' }
}
// Aliases : proj (all projects)
//------------------------------------------------------------------------------
Alias( 'proj' )
{
.Targets = { 'All-proj',
'Core-proj',
'CoreTest-proj',
'FBuildApp-proj'
'FBuildCore-proj',
'FBuildTest-proj',
'FBuildWorker-proj',
'LZ4-proj',
'TestFramework-proj'
}
}
//------------------------------------------------------------------------------