Fastbuild all work for static linking

Need : Dll for game and lib to do hot reload
Need : static for release only
Way to compile only julietapp only shader app, only juliet.dll and game.dll
This commit is contained in:
2026-01-07 19:46:12 -05:00
parent bfd3648344
commit 1137466472
10 changed files with 186 additions and 21 deletions

View File

@@ -186,6 +186,16 @@ Compiler( 'Compiler-VS2022-ARM64' )
+ ' libvcruntime.lib'
+ ' libucrt.lib'
.CRTLibs_Dynamic = ' msvcrt.lib'
+ ' vcruntime.lib'
+ ' ucrt.lib'
+ ' msvcprt.lib'
.CRTLibs_DynamicDebug = ' msvcrtd.lib'
+ ' vcruntimed.lib'
+ ' ucrtd.lib'
+ ' msvcprtd.lib'
// File Extensions
.LibExtension = '.lib'
.ExeExtension = '.exe'

View File

@@ -8,7 +8,7 @@
#include <type_traits>
// Add any new fields into the concept below
#define DECLARE_ENTITY(entity) \
#define DECLARE_ENTITY() \
Entity* Base; \
static const Juliet::Class* Kind;

View File

@@ -18,7 +18,7 @@ namespace Game
return Manager;
}
void RegisterEntity(EntityManager& manager, Entity* entity)
void RegisterEntity(EntityManager& /*manager*/, Entity* entity)
{
entity->ID = EntityManager::ID++;
}

51
Game/Game.bff Normal file
View File

@@ -0,0 +1,51 @@
// Juliet - Lib
//------------------------------------------------------------------------------
{
.ProjectName = 'Game'
.ProjectPath = 'Game'
.JulietIncludePath = ' "-IJuliet/include"'
// 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$-Lib-$Platform$-$BuildConfigName$' )
{
// Input (Unity)
.CompilerInputUnity = '$ProjectName$-Unity-$Platform$-$BuildConfigName$'
// Extra Compiler Options
.CompilerOptions + .JulietIncludePath
+ ' "-IGame"'
#if __WINDOWS__
.CompilerOptions + ' -DJULIET_WIN32'
#endif
// Output
.CompilerOutputPath = '$OutputBase$/$ProjectPath$/'
}
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
}
}

View File

@@ -1,5 +1,5 @@
#include <cstdio>
#include <windows.h> // TODO: remove because our dll should not be platform dependant
#include <Windows.h> // TODO: remove because our dll should not be platform dependant
#undef min
#undef max
@@ -42,7 +42,7 @@ extern "C" __declspec(dllexport) void __cdecl GameInit()
door->IsOpened = true;
Entity* ent = door->Base;
Door* stillDoor = DownCast<Door>(ent);
[[maybe_unused]] Door* stillDoor = DownCast<Door>(ent);
Assert(door == stillDoor);
Rock* rock = MakeEntity<Rock>(manager, 1.f, 2.f);
@@ -64,7 +64,7 @@ extern "C" __declspec(dllexport) void __cdecl GameShutdown()
printf("Shutting down game...\n");
}
extern "C" __declspec(dllexport) void __cdecl GameUpdate(float deltaTime)
extern "C" __declspec(dllexport) void __cdecl GameUpdate([[maybe_unused]] float deltaTime)
{
//printf("Updating game...\n");
}

View File

@@ -25,7 +25,7 @@
// Library
//--------------------------------------------------------------------------
ObjectList( '$ProjectName$-CPP-$Platform$-$BuildConfigName$' )
ObjectList( '$ProjectName$-Lib-$Platform$-$BuildConfigName$' )
{
// Input (Unity)
.CompilerInputUnity = '$ProjectName$-Unity-$Platform$-$BuildConfigName$'
@@ -41,10 +41,6 @@
// 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$' }

View File

@@ -45,7 +45,7 @@ namespace Juliet
uint32_t crc = ~0U;
while (length--)
{
crc = details::crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
crc = details::crc32_tab[(crc ^ static_cast<uint8>(*p++)) & 0xFF] ^ (crc >> 8);
}
return crc ^ ~0U;
}

102
JulietApp/JulietApp.bff Normal file
View File

@@ -0,0 +1,102 @@
// Juliet - Lib
//------------------------------------------------------------------------------
{
.ProjectName = 'JulietApp'
.ProjectPath = 'JulietApp'
.JulietIncludePath = ' "-IJuliet/include"'
.ProjectDefPath = '$_WORKING_DIR_$/$ProjectName$/$ProjectName$.def'
// 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$-Lib-$Platform$-$BuildConfigName$' )
{
// Input (Unity)
.CompilerInputUnity = '$ProjectName$-Unity-$Platform$-$BuildConfigName$'
// Extra Compiler Options
.CompilerOptions + .JulietIncludePath
#if __WINDOWS__
.CompilerOptions + ' -DJULIET_WIN32'
#endif
// Output
.CompilerOutputPath = '$OutputBase$/$ProjectPath$/'
}
// Windows Manifest
//--------------------------------------------------------------------------
#if __WINDOWS__
.ManifestFile = '$OutputBase$/$ProjectPath$/$ProjectName$$ExeExtension$.manifest.tmp'
//CreateManifest( '$ProjectName$-Manifest-$Platform$-$BuildConfigName$'
// .ManifestFile )
#endif
// Executable
//--------------------------------------------------------------------------
Executable( '$ProjectName$-Exe-$Platform$-$BuildConfigName$' )
{
.Libraries = {
'JulietApp-Lib-$Platform$-$BuildConfigName$',
'Juliet-Lib-$Platform$-$BuildConfigName$',
'Game-Lib-$Platform$-$BuildConfigName$'
}
.LinkerOutput = '$OutputBase$/$ProjectPath$/JulietApp$ExeExtension$'
// TODO : Only use when using DLL and not static link
//.LinkerOptions + ' /DEF:"$ProjectDefPath$"'
#if __WINDOWS__
.LinkerOptions + ' /SUBSYSTEM:CONSOLE'
+ ' kernel32.lib'
+ ' user32.lib'
+ ' gdi32.lib'
+ ' dxguid.lib'
+ ' Ws2_32.lib'
+ ' dxgi.lib'
//+ .CRTLibs_Static
// Chose appropriate CRT
.CRTLibs = .CRTLibs_Dynamic
If ( .BuildConfigName == 'Debug' )
{
^CRTLibs = .CRTLibs_DynamicDebug
}
.LinkerOptions + .CRTLibs
// Manifest
.LinkerAssemblyResources = .ManifestFile
.LinkerOptions + ' /MANIFEST:EMBED'
// + ' /MANIFESTINPUT:%3'
#endif
}
Alias( '$ProjectName$-$Platform$-$BuildConfigName$' ) { .Targets = '$ProjectName$-Exe-$Platform$-$BuildConfigName$' }
^'Targets_$Platform$_$BuildConfigName$' + { '$ProjectName$-$Platform$-$BuildConfigName$' }
#if __WINDOWS__
.ProjectConfig = [ Using( .'Project_$Platform$_$BuildConfigName$' ) .Target = '$ProjectName$-$Platform$-$BuildConfigName$' ]
^ProjectConfigs + .ProjectConfig
#endif
}
}

View File

@@ -1,4 +1,4 @@
#include <main.h>
#include "main.h"
#include <Core/Application/ApplicationManager.h>
#include <Core/Common/EnumUtils.h>
@@ -279,7 +279,7 @@ JulietApplication& GetEditorApplication()
return EditorApplication;
}
int main(int argc, char** argv)
int main(int /*argc*/, char** /*argv*/)
{
// Allow only one instance to be launched.
// Need to create Mutex code in the lib because i dont want to include windows.h in this file anymore

View File

@@ -59,12 +59,12 @@ Settings
#if __WINDOWS__
.Debug_Optimizations_MSVC =
[
.CompilerOptions = ' /MTd /Od /RTC1 /GS /Oy-'
.CompilerOptions = ' /MDd /Od /RTC1 /GS /Oy-'
.CompilerOptionsC = .CompilerOptions
]
.Profile_Optimizations_MSVC =
[
.CompilerOptions = ' /MT /Ox /Oy /Oi /GS- /GF /Gy /Gw /Zo'
.CompilerOptions = ' /MD /Ox /Oy /Oi /GS- /GF /Gy /Gw /Zo'
.CompilerOptionsC = .CompilerOptions
.LinkerOptions = ' /OPT:REF,ICF'
]
@@ -83,7 +83,7 @@ Settings
.Debug_Optimizations =
[
#if __WINDOWS__ // Using clang-cl.exe on Windows
.CompilerOptions = ' /Od'
.CompilerOptions = ' /MDd /Od'
#else
.CompilerOptions = ' -O0'
#endif
@@ -92,6 +92,11 @@ Settings
.Profile_Optimizations =
[
.CompilerOptions = ' -O2'
#if __WINDOWS__ // Using clang-cl.exe on Windows
.CompilerOptions + ' /MD'
#endif
.CompilerOptionsC = .CompilerOptions
]
.Release_Optimizations =
@@ -148,9 +153,9 @@ Settings
[
.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'
.OutputDirectory = '^$(SolutionDir)\Intermediate'
.IntermediateDirectory = '^$(SolutionDir)\Intermediate'
.BuildLogFile = '^$(SolutionDir)\Intermediate\^$(ProjectName)-^$(Configuration).log'
.Platform = 'x64'
.PlatformToolset = '$VS_PlatformToolset$'
]
@@ -179,6 +184,8 @@ Settings
// Include all projects to build
#include "Juliet/Juliet.bff"
#include "Game/Game.bff"
#include "JulietApp/JulietApp.Bff"
// Aliases : All-$Platform$-$Config$
//------------------------------------------------------------------------------
@@ -193,8 +200,7 @@ ForEach( .BuildConfig in .BuildConfigs )
//------------------------------------------------------------------------------
Alias( 'Exes' )
{
.Targets = { 'FBuildWorker-Debug', 'FBuildWorker-Profile', 'FBuildWorker-Release'
'FBuild-Debug', 'FBuild-Profile', 'FBuild-Release' }
.Targets = { 'JulietApp-Debug', 'JulietApp-Profile', 'JulietApp-Release' }
}
// Aliases : All-$Platform$