From 973f5297412bb11978da34166e15ca342b2bbc63 Mon Sep 17 00:00:00 2001 From: Patedam Date: Thu, 23 Jul 2026 10:50:28 -0400 Subject: [PATCH] fix build error in msvc --- External/SDK/VisualStudio/VS2022.bff | 10 ++- Juliet/Juliet.bff | 1 + JulietApp/JulietApp.bff | 1 + JulietShaderCompiler/JulietShaderCompiler.bff | 12 ++- Romeo/Romeo.bff | 1 + fbuild.bff | 4 +- misc/build.bat | 85 +++++++++++++++++++ 7 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 misc/build.bat diff --git a/External/SDK/VisualStudio/VS2022.bff b/External/SDK/VisualStudio/VS2022.bff index a36bb3d..d93ab9f 100644 --- a/External/SDK/VisualStudio/VS2022.bff +++ b/External/SDK/VisualStudio/VS2022.bff @@ -142,8 +142,11 @@ Compiler( 'Compiler-VS2022-ARM64' ) + ' /diagnostics:caret' // Use improved warning/error messages + .CPPVersion + ' /permissive-' // Require conformant code + + ' /Gm-' // No RTTI + ' /GR-' // No RTTI - + ' /EHs-c-' // No exceptions + + ' /EHa-' // No exceptions + + ' /Oi' // Use assembly intrinsics where possible + + ' /Gy' // Function level linking + ' -D_CRT_SECURE_NO_WARNINGS' @@ -170,6 +173,9 @@ Compiler( 'Compiler-VS2022-ARM64' ) + ' /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 + + ' /wd4626' // assignment operator was implicitly defined as deleted + + ' /wd5026' // move constructor was implicitly defined as deleted + + ' /wd5027' // move assignment operator was implicitly defined as deleted // Include Paths + ' /I"./"' @@ -182,9 +188,11 @@ Compiler( 'Compiler-VS2022-ARM64' ) // Librarian .LibrarianOptions = '/NODEFAULTLIB /WX /NOLOGO /OUT:"%2" "%1"' + + ' /OPT:REF' // Linker .LinkerOptions = '/NODEFAULTLIB /WX /NOLOGO /INCREMENTAL:NO /OUT:"%2" "%1" /DEBUG' + + ' /OPT:REF' //CRT .CRTLibs_Static = ' LIBCMT.LIB' diff --git a/Juliet/Juliet.bff b/Juliet/Juliet.bff index 4cb2e6f..fa5cec1 100644 --- a/Juliet/Juliet.bff +++ b/Juliet/Juliet.bff @@ -23,6 +23,7 @@ .UnityInputPath = '$ProjectPath$/' .UnityOutputPath = '$OutputBase$/$ProjectPath$/' .UnityOutputPattern = '$ProjectName$_Unity*.cpp' + .UnityMaxFiles = 10 } // Library diff --git a/JulietApp/JulietApp.bff b/JulietApp/JulietApp.bff index e57757a..add4321 100644 --- a/JulietApp/JulietApp.bff +++ b/JulietApp/JulietApp.bff @@ -24,6 +24,7 @@ .UnityInputPath = '$ProjectPath$/' .UnityOutputPath = '$OutputBase$/$ProjectPath$/' .UnityOutputPattern = '$ProjectName$_Unity*.cpp' + .UnityMaxFiles = 5 } // Library diff --git a/JulietShaderCompiler/JulietShaderCompiler.bff b/JulietShaderCompiler/JulietShaderCompiler.bff index a743fb0..986fbe3 100644 --- a/JulietShaderCompiler/JulietShaderCompiler.bff +++ b/JulietShaderCompiler/JulietShaderCompiler.bff @@ -11,10 +11,20 @@ ForEach( .BuildConfig in .ShaderCompilerConfigs ) Using( .BuildConfig ) .OutputBase + '\$Platform$-$BuildConfigName$' + // Unity + //-------------------------------------------------------------------------- + Unity( '$ProjectName$-Unity-$Platform$-$BuildConfigName$' ) + { + .UnityInputPath = '$ProjectPath$/' + .UnityOutputPath = '$OutputBase$/$ProjectPath$/' + .UnityOutputPattern = '$ProjectName$_Unity*.cpp' + .UnityMaxFiles = 5 + } + // 2. Define the Build Targets for this specific configuration ObjectList( '$ProjectName$-Obs-$Platform$-$BuildConfigName$' ) { - .CompilerInputPath = '$ProjectPath$/' + .CompilerInputUnity = '$ProjectName$-Unity-$Platform$-$BuildConfigName$' .CompilerOutputPath = '$OutputBase$/$ProjectPath$/' .CompilerOptions + ' "-IJuliet/include"' + ' "-IJulietShaderCompiler"' diff --git a/Romeo/Romeo.bff b/Romeo/Romeo.bff index 76b81dd..2936949 100644 --- a/Romeo/Romeo.bff +++ b/Romeo/Romeo.bff @@ -25,6 +25,7 @@ .UnityInputPath = '$ProjectPath$/src/' .UnityOutputPath = '$OutputBase$/$ProjectPath$/' .UnityOutputPattern = '$ProjectName$_Unity*.cpp' + .UnityMaxFiles = 5 } // Library diff --git a/fbuild.bff b/fbuild.bff index 40f50b9..8422941 100644 --- a/fbuild.bff +++ b/fbuild.bff @@ -142,8 +142,8 @@ Settings #if __WINDOWS__ .ProjectCommon = [ - .ProjectBuildCommand = 'cd ^$(SolutionDir) & misc\fbuild -ide -dist -monitor -cache ^$(ProjectName)-^$(Configuration)' - .ProjectRebuildCommand = 'cd ^$(SolutionDir) & misc\fbuild -ide -dist -monitor -cache -clean ^$(ProjectName)-^$(Configuration)' + .ProjectBuildCommand = 'cd ^$(SolutionDir) & misc\build.bat ^$(ProjectName)-^$(Configuration)' + .ProjectRebuildCommand = 'cd ^$(SolutionDir) & misc\build.bat -clean ^$(ProjectName)-^$(Configuration)' .OutputDirectory = '^$(SolutionDir)\bin' .IntermediateDirectory = '^$(SolutionDir)\Intermediate' .BuildLogFile = '^$(SolutionDir)\Intermediate\^$(ProjectName)-^$(Configuration).log' diff --git a/misc/build.bat b/misc/build.bat new file mode 100644 index 0000000..0ac3e97 --- /dev/null +++ b/misc/build.bat @@ -0,0 +1,85 @@ +@echo off +setlocal enabledelayedexpansion + +:: ------------------------------------------------------------------------------ +:: FastBuild Unity Build Script (Located in misc/) +:: ------------------------------------------------------------------------------ + +set SCRIPT_DIR=%~dp0 +cd /d "%SCRIPT_DIR%.." + +set FBUILD=misc\fbuild.exe +set CONFIG=Debug +set TARGETS= + +if not exist "%FBUILD%" ( + echo [ERROR] Could not find %FBUILD%. Please check workspace setup. + exit /b 1 +) + +:parse_args +if "%~1"=="" goto run_build + +if /i "%~1"=="debug" ( + set CONFIG=Debug + shift + goto parse_args +) + +if /i "%~1"=="release" ( + set CONFIG=Release + shift + goto parse_args +) + +if /i "%~1"=="profile" ( + set CONFIG=Profile + shift + goto parse_args +) + +if /i "%~1"=="clean" ( + echo Cleaning build artifacts... + "%FBUILD%" -clean + exit /b %ERRORLEVEL% +) + +if /i "%~1"=="julietapp" ( + set TARGETS=!TARGETS! JulietApp-x64-%CONFIG% + shift + goto parse_args +) + +if /i "%~1"=="romeo" ( + set TARGETS=!TARGETS! Romeo-x64-%CONFIG% + shift + goto parse_args +) + +if /i "%~1"=="shader" ( + set TARGETS=!TARGETS! JulietShaderCompiler-x64Clang-%CONFIG% + shift + goto parse_args +) + +if /i "%~1"=="unity-only" ( + echo Generating Unity files only... + "%FBUILD%" JulietApp-Unity-x64-%CONFIG% Romeo-Unity-x64-%CONFIG% JulietShaderCompiler-Unity-x64Clang-%CONFIG% + exit /b %ERRORLEVEL% +) + +:: If target name passed explicitly +set TARGETS=!TARGETS! %~1 +shift +goto parse_args + +:run_build +if "!TARGETS!"=="" ( + echo Building default targets (JulietApp, Romeo, JulietShaderCompiler) [%CONFIG%]... + set TARGETS=JulietApp-x64-%CONFIG% Romeo-x64-%CONFIG% JulietShaderCompiler-x64Clang-%CONFIG% +) else ( + echo Building targets: !TARGETS! [%CONFIG%]... +) + +"%FBUILD%" -summary -showcmds !TARGETS! +exit /b %ERRORLEVEL%