diff --git a/External/SDK/CPP/CPPHelper.bff b/External/SDK/CPP/CPPHelper.bff new file mode 100644 index 0000000..403de85 --- /dev/null +++ b/External/SDK/CPP/CPPHelper.bff @@ -0,0 +1,2 @@ +.CPPVersion = ' /std:c++20' +.CPPCompilerWarningOptions = ' -Wno-c++20-compat' \ No newline at end of file diff --git a/External/SDK/Clang/Clang.bff b/External/SDK/Clang/Clang.bff new file mode 100644 index 0000000..11f6668 --- /dev/null +++ b/External/SDK/Clang/Clang.bff @@ -0,0 +1,3 @@ +#if __WINDOWS__ + #include "Windows/Clang.bff" +#endif \ No newline at end of file diff --git a/External/SDK/Clang/Windows/Clang.bff b/External/SDK/Clang/Windows/Clang.bff new file mode 100644 index 0000000..bc5ca41 --- /dev/null +++ b/External/SDK/Clang/Windows/Clang.bff @@ -0,0 +1,211 @@ +// Clang 19.x.x +//------------------------------------------------------------------------------ +// +// Detect Clang +// +// We search in the following locations, in order of preference: +// 1) Vendorized in External (side by side with this bff) +// 2) Part of a Visual Studio installation (Program Files) +// 3) Default install location +// + +#include "../../CPP/CPPHelper.bff" + +#if file_exists( "19.1.5/bin/clang-cl.exe" ) + // Vendorized + .Clang19_BasePath = '$_CURRENT_BFF_DIR_$/19.1.5' + .Clang19_Version = '19.1.5' +#else + #if file_exists( "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/LLVM/x64/bin/clang-cl.exe" ) + // Installed with VS2022 + .Clang19_BasePath = 'C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/LLVM/x64' + .Clang19_Version = '19.x.x' + #else + #if file_exists( "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/LLVM/x64/bin/clang-cl.exe" ) + // Installed with VS2022 + .Clang19_BasePath = 'C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/LLVM/x64' + .Clang19_Version = '19.x.x' + #else + #if file_exists( "C:/Program Files/LLVM/bin/clang-cl.exe" ) + // Default Install + .Clang19_BasePath = 'C:/Program Files/LLVM' + .Clang19_Version = '19.x.x' + #else + // + // Failed + // + Print( '----------------------------------------------------------------------' ) + Print( '- Unable to auto-detect Clang - please specify installation manually -' ) + Print( '----------------------------------------------------------------------' ) + .Clang19_BasePath = .Set_Path_Here // <-- Set path here + .Clang19_Version = .Set_Version_Here // <-- Set version here + #endif + #endif + #endif +#endif + +// Print details of used version. TODO:C Move to Clang.bff +Print( 'Using Clang $Clang19_Version$ from $Clang19_BasePath$' ) + +// Compiler +//------------------------------------------------------------------------------ +Compiler( 'Compiler-Clang19' ) +{ + .Root = '$Clang19_BasePath$' + .ExtraFiles = { + '$Root$/bin/concrt140.dll' + '$Root$/bin/msvcp140.dll' + '$Root$/bin/vcruntime140.dll' + '$Root$/bin/vcruntime140_1.dll' + } + .Executable = '$Root$\bin\clang-cl.exe' + + // Allow tests to activate some experimental behavior + #if ENABLE_RELATIVE_PATHS + .UseRelativePaths_Experimental = true + #endif + #if ENABLE_SOURCE_MAPPING + .SourceMapping_Experimental = '/fastbuild-test-mapping' + #endif +} + +// Compiler +//------------------------------------------------------------------------------ +Compiler( 'Compiler-Clang19-NonCL' ) +{ + .Root = '$Clang19_BasePath$' + .ExtraFiles = { + '$Root$/bin/msvcp140.dll' + '$Root$/bin/vcruntime140.dll' + } + .Executable = '$Root$\bin\clang.exe' + + // Allow tests to activate some experimental behavior + #if ENABLE_RELATIVE_PATHS + .UseRelativePaths_Experimental = true + #endif + #if ENABLE_SOURCE_MAPPING + .SourceMapping_Experimental = '/fastbuild-test-mapping' + #endif +} + +// ToolChain +//------------------------------------------------------------------------------ +.ToolChain_Clang_Windows_Common = +[ + // Clang for Windows relies on the VS being present: + // - crt headers + // - crt libs/dlls + Using( .ToolChain_VS_Windows_X64 ) + + .Platform = 'x64Clang' + + // Librarian + .Librarian = '$Clang19_BasePath$\bin\llvm-ar.exe' + .LibrarianOptions = '/c echo %1 > %2' // 'rc "%2" "%1"' // NOTE: output must come first + + // Linker + .Linker = '$Clang19_BasePath$\bin\lld-link.exe' + .LinkerOptions = '/NODEFAULTLIB /WX /NOLOGO /INCREMENTAL:NO /OUT:"%2" "%1" /DEBUG' + + .VSLibPaths + + // Compiler Warnings + .CommonCompilerWarningOptions // Enable warnings + = ' -Wall -Wextra -Weverything' // All warnings + + ' -Werror -Wfatal-errors' // Warnings as fatal errors + + // Warnings that are not useful + + ' -Wno-#pragma-messages' // warning : %s [-W#pragma-messages] + + ' -Wno-c++98-compat-pedantic' // variadic macros are incompatible with C++98 + + ' -Wno-exit-time-destructors' // declaration requires an exit-time destructor + + ' -Wno-global-constructors' // declaration requires a global destructor + + ' -Wno-invalid-offsetof' // we get the offset of members in non-POD types + + ' -Wno-missing-prototypes' // no previous prototype for function '%s' + + ' -Wno-missing-variable-declarations' // no previous extern declaration for non-static variable '%s' + + ' -Wno-gnu-line-marker' // Clang complains about directives its own preprocessor generated + + ' -Wno-switch-enum' // Allow the use of "default" labels (we keep -Wswitch to ensure all cases are handled) + + ' -Wno-switch-default' // Don't require default: when all cases are already handled + + .CPPCompilerWarningOptions + + // Warnings that fire but might be best to be fixed + + ' -Wno-anon-enum-enum-conversion' // conversions between unrelated anonymous enums + + ' -Wno-cast-function-type-strict' // converts to incompatible function type + + ' -Wno-cast-qual' // cast from 'const %s *' to '%s *' drops const qualifier + + ' -Wno-deprecated-copy-dtor' // definition of implicit copy constructor for '%s' is deprecated because it has a user-declared destructor + + ' -Wno-missing-noreturn' // function '%s' could be declared with attribute 'noreturn' + + ' -Wno-old-style-cast' // use of old-style cast + + ' -Wno-unsafe-buffer-usage' // unsafe pointer arithmetic + + // File Extensions + .LibExtension = '.a' + .ExeExtension = '.exe' +] + +// ToolChain +//------------------------------------------------------------------------------ +.ToolChain_Clang_Windows = +[ + Using( .ToolChain_Clang_Windows_Common ) + + // Compiler Options + .Compiler = 'Compiler-Clang19' + .CommonCompilerOptions = ' -c' // Compile only + + ' /Z7' // Include debug info + + // Include paths + + ' -I"./"' + + .VSIncludePaths_ClangCl + + // x64 + + ' -m64' + + ' --target=x86_64-windows-msvc' + + // No RTTI + + ' /GR-' + + // No Exceptions + + ' /EHs-c-' + + // Warnings + + .CommonCompilerWarningOptions + + .CompilerOptions = ' /TP -o"%2" "%1" $CommonCompilerOptions$' + + .CPPVersion + .CompilerOptionsC = ' /TC -o"%2" "%1" $CommonCompilerOptions$' + .PCHOptions = ' /TP $CommonCompilerOptions$ "%1" /Fo"%3" /Fp"%2" /Yc"PrecompiledHeader.h"' + + .CPPVersion +] + +// ToolChain +//------------------------------------------------------------------------------ +.ToolChain_ClangNonCL_Windows = +[ + Using( .ToolChain_Clang_Windows_Common ) + + // Compiler Options + .Compiler = 'Compiler-Clang19-NonCL' + .CommonCompilerOptions = ' -c' // Compile only + + ' -g' // Include debug info + + // Include paths + + ' "-I./"' + + // x64 + + ' -m64' + + ' --target=x86_64-windows-msvc' + + // No RTTI + + ' -fno-rtti' + + // No Exceptions + + ' -fno-exceptions' + + // Warnings + + .CommonCompilerWarningOptions + + .CompilerOptions = ' -x c++ -o"%2" "%1" $CommonCompilerOptions$' + + .CPPVersion + .CompilerOptionsC = ' -x c -o"%2" "%1" $CommonCompilerOptions$' +] + +//------------------------------------------------------------------------------ \ No newline at end of file diff --git a/External/SDK/VisualStudio/VS2022.bff b/External/SDK/VisualStudio/VS2022.bff new file mode 100644 index 0000000..c36b6b7 --- /dev/null +++ b/External/SDK/VisualStudio/VS2022.bff @@ -0,0 +1,311 @@ +// Visual Studio 2022 +//------------------------------------------------------------------------------ +// +// Detect VS2022 +// +// We search in the following locations, in order of preference: +// 1) Vendorized in External (side by side with this bff) +// 2) Specified via environment variables (VS Command Prompt) +// 3) Part of a Visual Studio installation (Program Files) +// + +#include "../CPP/CPPHelper.bff" + +#if file_exists( "2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe" ) + // + // Use vendorized toolchain - v17.14.16 + // + .VS2022_BasePath = '$_CURRENT_BFF_DIR_$/2022/Community/VC' + .VS2022_Version = '14.44.35207' + .VS2022_MSC_VER = '1944' + #define MSVC_DYNAMIC_DEOPT_AVAILABLE +#else + // + // Use environment variable if available (VS Command Prompt) + // + #if exists( VS170COMNTOOLS ) + #import VCINSTALLDIR + #import VCToolsVersion + .VS2022_BasePath = .VCINSTALLDIR + .VS2022_Version = .VCToolsVersion + .VS2022_MSC_VER = '1944' // NOTE: This cannot be detected and may be incorrect + #else + // + // Use Visual Studio installation + // + #if file_exists( "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe" ) + // v17.14.9 + .VS2022_BasePath = 'C:/Program Files/Microsoft Visual Studio/2022/Community/VC' + .VS2022_Version = '14.44.35207' + .VS2022_MSC_VER = '1944' + #define MSVC_DYNAMIC_DEOPT_AVAILABLE + #else + // + // Use Visual Studio 2022 Enterprise installation (used by GitHub Actions) + // + #if file_exists( "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.44.35207/bin/Hostx64/x64/cl.exe" ) + // v17.14.9 + .VS2022_BasePath = 'C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC' + .VS2022_Version = '14.44.35207' + .VS2022_MSC_VER = '1944' + #define MSVC_DYNAMIC_DEOPT_AVAILABLE + #else + // + // Failed + // + Print( '-----------------------------------------------------------------------' ) + Print( '- Unable to auto-detect VS2022 - please specify installation manually -' ) + Print( '-----------------------------------------------------------------------' ) + .VS2022_BasePath = .Set_Path_Here // <-- Set path here + .VS2022_Version = .Set_Version_Here // <-- Set version here + .VS2022_MSC_VER = .Set_MSC_VER_Here // <-- Set MSC_VER here + #endif + #endif + #endif +#endif + +.VS2022_ToolchainPath = '$VS2022_BasePath$/Tools/MSVC/$VS2022_Version$' + +// X64 Compiler +//------------------------------------------------------------------------------ +Compiler( 'Compiler-VS2022-x64' ) +{ + .Root = '$VS2022_ToolchainPath$/bin/Hostx64/x64' + .Executable = '$Root$/cl.exe' + .ExtraFiles = { '$Root$/c1.dll' + '$Root$/c1xx.dll', + '$Root$/c2.dll', + '$Root$/msobj140.dll' + '$Root$/mspdb140.dll' + '$Root$/mspdbcore.dll' + '$Root$/mspdbsrv.exe' + '$Root$/mspft140.dll' + '$Root$/msvcp140.dll' + '$Root$/msvcp140_atomic_wait.dll' // Required circa 16.8.3 (14.28.29333) + '$Root$/tbbmalloc.dll' // Required as of 16.2 (14.22.27905) + '$Root$/vcruntime140.dll' + '$Root$/vcruntime140_1.dll' // Required as of 16.5.1 (14.25.28610) + '$Root$/1033/clui.dll' + '$Root$/1033/mspft140ui.dll' // Localized messages for static analysis + } + #if MSVC_DYNAMIC_DEOPT_AVAILABLE + + '$Root$/c2dd.dll' // Dynamic Deoptimization as of 17.14.0 (14.44.34918) + #endif + + #if ENABLE_LIGHT_CACHE + .UseLightCache_Experimental = true + #endif +} + +// ARM64 Compiler +//------------------------------------------------------------------------------ +Compiler( 'Compiler-VS2022-ARM64' ) +{ + .Root = '$VS2022_ToolchainPath$/bin/Hostx64/arm64' + .Executable = '$Root$/cl.exe' + .ExtraFiles = { '$Root$/c1.dll' + '$Root$/c1xx.dll', + '$Root$/c2.dll', + '$Root$/msobj140.dll' + '$Root$/mspdb140.dll' + '$Root$/mspdbcore.dll' + '$Root$/mspdbsrv.exe' + '$Root$/mspft140.dll' + '$Root$/msvcp140.dll' + '$Root$/msvcp140_atomic_wait.dll' // Required circa 16.8.3 (14.28.29333) + '$Root$/tbbmalloc.dll' // Required as of 16.2 (14.22.27905) + '$Root$/vcruntime140.dll' + '$Root$/vcruntime140_1.dll' // Required as of 16.5.1 (14.25.28610) + '$Root$/1033/clui.dll' + '$Root$/1033/mspft140ui.dll' // Localized messages for static analysis + } + + #if ENABLE_LIGHT_CACHE + .UseLightCache_Experimental = true + #endif +} + +// Common Toolchain for Windows +//------------------------------------------------------------------------------ +.Toolchain_VS2022_Windows = +[ + // Paths + .VSIncludePaths = ' /external:W0 /external:I"$VS2022_ToolchainPath$/include/"' + .VSIncludePaths_ClangCl = ' /imsvc "$VS2022_ToolchainPath$/include/"' + .VCPackagesPath = '$VS2022_BasePath$/../Common7/IDE/VC/vcpackages' + + // Compiler + .CommonCompilerOptions = ' /Z7 /nologo /c' + + ' /Zc:inline' // Remove unreferenced COMDATs at compile time (VS2013.2+) + + ' /Zc:strictStrings' // Require const only usage of string literals (VS2013+) + + ' /fp:fast' + + ' /diagnostics:caret' // Use improved warning/error messages + + .CPPVersion + + ' /permissive-' // Require conformant code + + ' /GR-' // No RTTI + + ' /EHs-c-' // No exceptions + + // Warnings + + ' /Wall' // Enable all warnings (we'll disable those that are not useful) + + ' /WX' // Warnings as errors + + // These warnings need further investigation + + ' /wd5267' // definition of implicit copy constructor for '%s' is deprecated because it has a user-provided destructor + + // These warnings are not useful + + ' /wd4061' // enumerator '%s' in switch of enum '%s' is not explicitly handled by a case label + + ' /wd4505' // unreferenced function with internal linkage has been removed + + ' /wd4514' // '%s': unreferenced inline function has been removed + + ' /wd4577' // 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc + + ' /wd4625' // '%s' : copy constructor was implicitly defined as deleted + + ' /wd4710' // '%s': function not inlined + + ' /wd4711' // function '%s' selected for automatic inline expansion + + ' /wd4746' // volatile access of '' is subject to /volatile: setting; consider using __iso_volatile_load/store intrinsic functions + + ' /wd4820' // '%s': '%u' bytes padding added after data member '%s' + + ' /wd5045' // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified + + ' /wd5220' // '%s': a non-static data member with a volatile qualified type no longer implies that compiler generated copy/move constructors and copy/move assignment operators are not trivial + + ' /wd5245' // 'function': unreferenced function with internal linkage has been removed + + // Include Paths + + ' /I"./"' + + .VSIncludePaths + + .CompilerOptions = ' $CommonCompilerOptions$ "%1" /Fo"%2"' + .CompilerOptionsC = ' $CommonCompilerOptions$ "%1" /Fo"%2"' + .CompilerOptionsDeoptimized = ' $CommonCompilerOptions$ "%1" /Fo"%2"' + .PCHOptions = ' $CommonCompilerOptions$ "%1" /Fo"%3" /Fp"%2" /Yc"PrecompiledHeader.h"' + + // Librarian + .LibrarianOptions = '/NODEFAULTLIB /WX /NOLOGO /OUT:"%2" "%1"' + + // Linker + .LinkerOptions = '/NODEFAULTLIB /WX /NOLOGO /INCREMENTAL:NO /OUT:"%2" "%1" /DEBUG' + + //CRT + .CRTLibs_Static = ' LIBCMT.LIB' + + ' libvcruntime.lib' + + ' libucrt.lib' + + // File Extensions + .LibExtension = '.lib' + .ExeExtension = '.exe' +] + + +// X64 ToolChain for Windows +//------------------------------------------------------------------------------ +.ToolChain_VS2022_Windows_X64 = +[ + Using( .Toolchain_VS2022_Windows ) + + .Platform = 'x64' + + // Paths + .VSLibPaths = ' /LIBPATH:"$VS2022_ToolchainPath$/lib/x64"' + + // Compiler + .Compiler = 'Compiler-VS2022-X64' + + // Librarian + .Librarian = '$VS2022_ToolchainPath$/bin/Hostx64/x64/lib.exe' + + // Linker + .Linker = '$VS2022_ToolchainPath$/bin/Hostx64/x64/link.exe' + .LinkerOptions + .VSLibPaths +] + +.ToolChain_VS2022_Windows_ARM64 = +[ + Using( .Toolchain_VS2022_Windows ) + + .Platform = 'ARM64' + + // Paths + .VSLibPaths = ' /LIBPATH:"$VS2022_ToolchainPath$/lib/arm64"' + + // Compiler + .Compiler = 'Compiler-VS2022-ARM64' + + // Librarian + .Librarian = '$VS2022_ToolchainPath$/bin/Hostx64/arm64/lib.exe' + + // Linker + .Linker = '$VS2022_ToolchainPath$/bin/Hostx64/arm64/link.exe' + .LinkerOptions + .VSLibPaths +] + +// PATH environment variable +//------------------------------------------------------------------------------ +.VS_2022_PATH = '$VS2022_ToolchainPath$/Hostx64/x64' + +// Platform Toolset for Project Generation +//------------------------------------------------------------------------------ +.VS_2022_PlatformToolset = 'v143' + +// _MSC_VER +//------------------------------------------------------------------------------ + +// VisualStudioSettings +//------------------------------------------------------------------------------ +.VisualStudioSettings_VS2022 = +[ + .VS_Version = .VS2022_Version + .VS_Version_HumanReadable = '2022' + .VS_SolutionVersion = '17' + .MSC_VER = .VS2022_MSC_VER + .VS_ToolchainPath = .VS2022_ToolchainPath + .ToolChain_VS_Windows_X64 = .ToolChain_VS2022_Windows_X64 + .ToolChain_VS_Windows_ARM64 = .ToolChain_VS2022_Windows_ARM64 + .VS_PATH = .VS_2022_PATH + .VS_PlatformToolset = .VS_2022_PlatformToolset + + // Enable and specify analysis engine + .StaticAnalysisOptions = ' /analyze' + + ' /analyze:plugin"$VS2022_ToolchainPath$\bin\HostX64\x64\EspXEngine.dll"' + + ' /analyze:external-' // Disable analysis of external headers + + // To investigate: These warnings might be useful and should be checked + + ' /wd26400' // Do not assign the result of an allocation or a function call with an owner return value to a raw pointer, use owner instead (i.11). + + ' /wd26401' // Do not delete a raw pointer that is not an owner (i.11). + + ' /wd26430' // Symbol '%s' is not tested for nullness on all paths (f.23).: Lines: ... + + ' /wd26432' // If you define or delete any default operation in the type '%s', define or delete them all (c.21). + + ' /wd26436' // The type '%s' with a virtual function needs either public virtual or protected non-virtual destructor (c.35). + + ' /wd26438' // Avoid 'goto' (es.76). + + ' /wd26451' // Arithmetic overflow: Using operator '*' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '*' to avoid overflow (io.2). + + ' /wd26460' // The reference argument '%s' for function '%s' can be marked as const (con.3). + + ' /wd26475' // Do not use function style C-casts (es.49). + + ' /wd26476' // Expression/symbol '%s' uses a naked union '%s' with multiple type pointers: Use variant instead (type.7). + + ' /wd26491' // Don't use static_cast downcasts (type.2). + + ' /wd26494' // Variable '%s' is uninitialized. Always initialize an object (type.5). + + ' /wd26495' // Variable '%s' is uninitialized. Always initialize a member variable (type.6). + + ' /wd26497' // The function '%s' could be marked constexpr if compile-time evaluation is desired (f.4). + + ' /wd26814' // The const variable '%s' can be computed at compile-time. Consider using constexpr (con.5). + + // These warnings are not useful. They either: + // a) Are about things we want to do or have no viable alternative + // b) Are nonsensical, undesirable or impractical + + ' /wd26402' // Return a scoped object instead of a heap-allocated if it has a move constructor (r.3). + + ' /wd26409' // Avoid calling new and delete explicitly, use std::make_unique instead (r.11). + + ' /wd26426' // Global initializer calls a non-constexpr function '%s' (i.22). + + ' /wd26429' // Symbol '%s' is never tested for nullness, it can be marked as not_null (f.23). + + ' /wd26435' // Function '%s' should specify exactly one of 'virtual', 'override', or 'final' (c.128). + + ' /wd26439' // This kind of function may not throw. Declare it 'noexcept' (f.6). + + ' /wd26440' // Function '%s' can be declared 'noexcept' (f.6). + + ' /wd26446' // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). + + ' /wd26447' // The function is declared 'noexcept' but calls function '%s' which may throw exceptions (f.6). + + ' /wd26455' // Default constructor may not throw. Declare it 'noexcept' (f.6). + + ' /wd26457' // (void) should not be used to ignore return values, use 'std::ignore =' instead (es.48). + + ' /wd26461' // The pointer argument '%s' for function '%s' can be marked as a pointer to const (con.3). + + ' /wd26467' // Converting from floating point to unsigned integral types results in non-portable code if the double/float has a negative value. Use gsl::narrow_cast or gsl::narrow instead to guard against undefined behavior and potential data loss (es.46). + + ' /wd26472' // Don't use a static_cast for arithmetic conversions. Use brace initialization, gsl::narrow_cast or gsl::narrow (type.1). + + ' /wd26481' // Don't use pointer arithmetic. Use span instead (bounds.1). + + ' /wd26482' // Only index into arrays using constant expressions (bounds.2).' + + ' /wd26485' // Expression '%s': No array to pointer decay (bounds.3). + + ' /wd26490' // Don't use reinterpret_cast (type.1). + + ' /wd26492' // Don't use const_cast to cast away const or volatile (type.3). + + ' /wd26493' // Don't use C-style casts (type.4). + + ' /wd26826' // Don't use C-style variable arguments (f.55). + + ' /wd26831' // Allocation size might be the result of a numerical overflow. +] + +//------------------------------------------------------------------------------ \ No newline at end of file diff --git a/External/SDK/VisualStudio/VisualStudio.bff b/External/SDK/VisualStudio/VisualStudio.bff new file mode 100644 index 0000000..15269b9 --- /dev/null +++ b/External/SDK/VisualStudio/VisualStudio.bff @@ -0,0 +1,20 @@ +// VisualStudio +//------------------------------------------------------------------------------ +#if __WINDOWS__ + +// Select desired Visual Studio version +//------------------------------------------------------------------------------ +#define USING_VS2022 + +// Activate +//------------------------------------------------------------------------------ +.VisualStudioSettings = [] +#if USING_VS2022 + #include "VS2022.bff" + .VisualStudioSettings = .VisualStudioSettings_VS2022 +#endif +Using( .VisualStudioSettings ) +Print( 'Using VS$VS_Version_HumanReadable$ (v$VS_Version$) from $VS_ToolchainPath$' ) + +//------------------------------------------------------------------------------ +#endif \ No newline at end of file diff --git a/External/SDK/Windows/Windows.bff b/External/SDK/Windows/Windows.bff new file mode 100644 index 0000000..24d830d --- /dev/null +++ b/External/SDK/Windows/Windows.bff @@ -0,0 +1,16 @@ +// Windows +//------------------------------------------------------------------------------ +#if __WINDOWS__ + +// The Windows 10 SDK is used regardless of which OS version is being targetted +#define USING_WINDOWS10_SDK + +// Activate +//------------------------------------------------------------------------------ +#if USING_WINDOWS10_SDK + #include "Windows10SDK.bff" + Alias( 'ResourceCompiler' ) { .Targets = 'ResourceCompiler-Windows10' } +#endif + +//------------------------------------------------------------------------------ +#endif \ No newline at end of file diff --git a/External/SDK/Windows/Windows10SDK.bff b/External/SDK/Windows/Windows10SDK.bff new file mode 100644 index 0000000..02f3b76 --- /dev/null +++ b/External/SDK/Windows/Windows10SDK.bff @@ -0,0 +1,121 @@ +// Windows 10 SDK +//------------------------------------------------------------------------------ +// +// Detect Windows 10 SDK +// +// We search in the following locations, in order of preference: +// 1) Vendorized in External (side by side with this bff) +// 2) Part of a Windows 10 installation (Program Files) +// +#if file_exists( "10\bin\10.0.26100.0\x64\RC.exe" ) + // + // Use vendorized toolchain + // + .Windows10_SDKBasePath = '$_CURRENT_BFF_DIR_$\10' + .Windows10_SDKVersion = '10.0.26100.0' +#else + // + // Use Windows10SDK installation + // + #if file_exists( "C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64\RC.exe" ) + .Windows10_SDKBasePath = 'C:\Program Files (x86)\Windows Kits\10' + .Windows10_SDKVersion = '10.0.26100.0' + #else + // + // Failed + // + Print( '-----------------------------------------------------------------------' ) + Print( '- Unable to auto-detect Windows10SDK - please specify installation manually -' ) + Print( '-----------------------------------------------------------------------' ) + .Windows10_SDKBasePath = .Set_Path_Here // <-- Set path here + .Windows10_SDKVersion = .Set_Version_Here // <-- Set version here + #endif +#endif + +// Defines +//------------------------------------------------------------------------------ +.WindowsSDK_Defines = ' -DWIN32_LEAN_AND_MEAN' + + ' -DWIN32' + + ' -D_WIN32' + + ' -D__WINDOWS__' + + ' -D_HAS_EXCEPTIONS=0' + +// Windows 10 SDK +//------------------------------------------------------------------------------ +.Windows10_SDK = +[ +#if USING_VS2022 + .WindowsSDK_IncludePaths = ' "/external:I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/ucrt"' + + ' "/external:I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/um"' + + ' "/external:I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/shared"' +#else + .WindowsSDK_IncludePaths = ' "-I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/ucrt"' + + ' "-I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/um"' + + ' "-I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/shared"' +#endif + .WindowsSDK_IncludePaths_RC = ' "-I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/ucrt"' + + ' "-I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/um"' + + ' "-I$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/shared"' + + .WindowsDK_WinRTAssemblyPath = '$Windows10_SDKBasePath$/UnionMetadata/$Windows10_SDKVersion$/' + + .CommonCompilerOptions = .WindowsSDK_IncludePaths + + .WindowsSDK_Defines + + ' -DWIN64' + + .CompilerOptions = .CommonCompilerOptions + .CompilerOptionsC = .CommonCompilerOptions + .CompilerOptionsDeoptimized = .CommonCompilerOptions + .PCHOptions = .CommonCompilerOptions +] + +.Windows10_SDK_X64 = +[ + Using( .Windows10_SDK ) + + .LinkerOptions = ' /LIBPATH:"$Windows10_SDKBasePath$/Lib/$Windows10_SDKVersion$/um/x64"' + + ' /LIBPATH:"$Windows10_SDKBasePath$/Lib/$Windows10_SDKVersion$/ucrt/x64"' + + ' /MACHINE:X64' +] +.Windows10_SDK_ARM64 = +[ + Using( .Windows10_SDK ) + + .LinkerOptions = ' /LIBPATH:"$Windows10_SDKBasePath$/Lib/$Windows10_SDKVersion$/um/arm64"' + + ' /LIBPATH:"$Windows10_SDKBasePath$/Lib/$Windows10_SDKVersion$/ucrt/arm64"' + + ' /MACHINE:ARM64' +] +.Windows10_SDK_X64_ClangCl = +[ + // When using clang-cl, we can use these include paths to suppress compile errors + // inside system headers (which are full of problems) + .WindowsSDK_IncludePaths = ' /imsvc "$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/ucrt"' + + ' /imsvc "$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/um"' + + ' /imsvc "$Windows10_SDKBasePath$/Include/$Windows10_SDKVersion$/shared"' + + .WindowsDK_WinRTAssemblyPath = '$Windows10_SDKBasePath$/UnionMetadata/$Windows10_SDKVersion$/' + + .CommonCompilerOptions = .WindowsSDK_IncludePaths + + .WindowsSDK_Defines + + ' -DWIN64' + + .CompilerOptions = .CommonCompilerOptions + .CompilerOptionsC = .CommonCompilerOptions + .CompilerOptionsDeoptimized = .CommonCompilerOptions + .PCHOptions = .CommonCompilerOptions + + .LinkerOptions = ' /LIBPATH:"$Windows10_SDKBasePath$/Lib/$Windows10_SDKVersion$/um/x64"' + + ' /LIBPATH:"$Windows10_SDKBasePath$/Lib/$Windows10_SDKVersion$/ucrt/x64"' + + ' /MACHINE:X64' +] +Compiler( 'ResourceCompiler-Windows10' ) +{ + .Executable = '$Windows10_SDKBasePath$/Bin/$Windows10_SDKVersion$/x64/RC.exe' + .CompilerFamily = 'custom' +} + +// PATH environment variable +//------------------------------------------------------------------------------ +.WINDOWS_SDK_2019_PATH = '$Windows10_SDKBasePath$/bin/$Windows10_SDKVersion$/x64' + +//------------------------------------------------------------------------------ \ No newline at end of file diff --git a/Juliet/Juliet.bff b/Juliet/Juliet.bff new file mode 100644 index 0000000..e6da80b --- /dev/null +++ b/Juliet/Juliet.bff @@ -0,0 +1,56 @@ +// Juliet - Lib +//------------------------------------------------------------------------------ +{ + .ProjectName = 'Juliet' + .ProjectPath = 'Juliet' + .JulietIncludePath = ' "-IJuliet/include"' + + ' "-IJuliet/src"' + + // Library + //-------------------------------------------------------------------------- + .ProjectConfigs = {} + ForEach( .BuildConfig in .BuildConfigs ) + { + Using( .BuildConfig ) + .OutputBase + '\$Platform$-$BuildConfigName$' + + // Unity + //-------------------------------------------------------------------------- + Unity( '$ProjectName$-Unity-$Platform$-$BuildConfigName$' ) + { + .UnityInputPath = '$ProjectPath$/' + .UnityOutputPath = '$OutputBase$/$ProjectPath$/' + .UnityOutputPattern = '$ProjectName$_Unity*.cpp' + } + + // Library + //-------------------------------------------------------------------------- + ObjectList( '$ProjectName$-CPP-$Platform$-$BuildConfigName$' ) + { + // Input (Unity) + .CompilerInputUnity = '$ProjectName$-Unity-$Platform$-$BuildConfigName$' + + // Extra Compiler Options + .CompilerOptions + .JulietIncludePath + + ' -DJULIET_EXPORT' + + #if __WINDOWS__ + .CompilerOptions + ' -DJULIET_WIN32' + #endif + + // Output + .CompilerOutputPath = '$OutputBase$/$ProjectPath$/' + } + Alias( '$ProjectName$-Lib-$Platform$-$BuildConfigName$' ) + { + .Targets = { '$ProjectName$-CPP-$Platform$-$BuildConfigName$' } + } + Alias( '$ProjectName$-$Platform$-$BuildConfigName$' ) { .Targets = '$ProjectName$-Lib-$Platform$-$BuildConfigName$' } + ^'Targets_$Platform$_$BuildConfigName$' + { '$ProjectName$-$Platform$-$BuildConfigName$' } + + #if __WINDOWS__ + .ProjectConfig = [ Using( .'Project_$Platform$_$BuildConfigName$' ) .Target = '$ProjectName$-$Platform$-$BuildConfigName$' ] + ^ProjectConfigs + .ProjectConfig + #endif + } +} \ No newline at end of file diff --git a/JulietShaderCompiler/JulietShaderCompiler.bff b/JulietShaderCompiler/JulietShaderCompiler.bff new file mode 100644 index 0000000..e69de29 diff --git a/fbuild.bff b/fbuild.bff new file mode 100644 index 0000000..5b06776 --- /dev/null +++ b/fbuild.bff @@ -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 + diff --git a/misc/FBuild.exe b/misc/FBuild.exe new file mode 100644 index 0000000..4f33a9a Binary files /dev/null and b/misc/FBuild.exe differ diff --git a/misc/FBuildWorker.exe b/misc/FBuildWorker.exe new file mode 100644 index 0000000..c533a5b Binary files /dev/null and b/misc/FBuildWorker.exe differ