no need to use juliet obj everywhere, compile the dll directly

This commit is contained in:
2026-07-23 16:07:03 -04:00
parent cf75bf2dc7
commit 6afd675846
2 changed files with 97 additions and 97 deletions
+17 -19
View File
@@ -205,7 +205,7 @@ echo ===========================================================================
if not exist "bin\x64-!CFG!" mkdir "bin\x64-!CFG!"
if not exist "Intermediate\x64-!CFG!" mkdir "Intermediate\x64-!CFG!"
set COMMON_FLAGS=/nologo /std:c++20 /W4 /EHa- /utf-8 /DUNICODE /D_UNICODE /DWIN32_LEAN_AND_MEAN /D_CRT_SECURE_NO_WARNINGS /I"Juliet/include" /I"Juliet/src" /I"Game" /I"External/imgui" /I"External/imgui/backends" /DJULIET_WIN32 /wd5267 /wd4061 /wd4505 /wd4514 /wd4577 /wd4625 /wd4710 /wd4711 /wd4746 /wd4820 /wd5045 /wd5220 /wd5245 /wd4626 /wd5026 /wd5027 /wd4530 /Fd"Intermediate\x64-!CFG!\vc140.pdb"
set COMMON_FLAGS=/nologo /std:c++20 /W4 /EHa- /utf-8 /DUNICODE /D_UNICODE /DWIN32_LEAN_AND_MEAN /D_CRT_SECURE_NO_WARNINGS /I"Juliet/include" /I"Juliet/src" /I"Game" /I"External/imgui" /I"External/imgui/backends" /DJULIET_WIN32 /wd5267 /wd4061 /wd4505 /wd4514 /wd4577 /wd4625 /wd4710 /wd4711 /wd4746 /wd4820 /wd5045 /wd5220 /wd5245 /wd4626 /wd5026 /wd5027 /wd4530
if /i "!CFG!"=="Debug" (
set COMPILER_FLAGS=!COMMON_FLAGS! /MDd /Od /Zi /Gw /Gy /Zc:inline /DDEBUG /DPROFILING_ENABLED /DJULIET_ENABLE_IMGUI /DJULIET_DEBUG
@@ -223,16 +223,16 @@ set COMMON_LIBS=kernel32.lib user32.lib gdi32.lib dxguid.lib Ws2_32.lib dxgi.lib
:: --- Juliet Shared Objs ---
echo.
echo --- Compiling Shared Object Files (Juliet / ImGui) [%CFG%] ---
if !JULIET_NEED_COMPILE! equ 0 (
echo [SKIP / UP-TO-DATE] Intermediate\x64-!CFG!\Juliet_Unity*.obj [Unity files unchanged]
) else (
echo [REBUILDING] Compiling Intermediate\x64-!CFG!\Juliet_Unity*.obj...
"%CHECK_TOOL%" start_step "Compiling Juliet Shared Objs [!CFG!]"
%COMPILER% %COMPILER_FLAGS% /DJULIET_EXPORT /c Intermediate\Juliet\*.cpp /Fo"Intermediate\x64-!CFG!\\"
set "COMP_ERR=!ERRORLEVEL!"
"%CHECK_TOOL%" end_step
if !COMP_ERR! neq 0 exit /b !COMP_ERR!
)
:: if !JULIET_NEED_COMPILE! equ 0 (
:: echo [SKIP / UP-TO-DATE] Intermediate\x64-!CFG!\Juliet_Unity*.obj [Unity files unchanged]
:: ) else (
:: echo [REBUILDING] Compiling Intermediate\x64-!CFG!\Juliet_Unity*.obj...
:: "%CHECK_TOOL%" start_step "Compiling Juliet Shared Objs [!CFG!]"
:: %COMPILER% %COMPILER_FLAGS% /DJULIET_EXPORT /c Intermediate\Juliet\*.cpp /Fo"Intermediate\x64-!CFG!\\"
:: set "COMP_ERR=!ERRORLEVEL!"
:: "%CHECK_TOOL%" end_step
:: if !COMP_ERR! neq 0 exit /b !COMP_ERR!
:: )
:: --- ImGui Shared Objs ---
if defined IMGUI_UNITY_SRCS (
@@ -257,33 +257,31 @@ if !TARGET_JULIET! equ 1 set BUILD_GAME_DLL=1
if !TARGET_GAME! equ 1 set BUILD_GAME_DLL=1
:: --- Juliet.dll ---
if !TARGET_JULIET! equ 1 (
call :link_target "Juliet.dll" "Building Juliet.dll [!CFG!]" "!JULIET_NEED_COMPILE!" "%COMPILER_FLAGS% /DJULIET_EXPORT /LD" "%JULIET_OBJS% %IMGUI_OBJS%" "/link %COMMON_LIBS% /INCREMENTAL /ILK:Intermediate\x64-!CFG!\Juliet.ilk /PDB:Intermediate\x64-!CFG!\Juliet.pdb"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)
call :link_target "Juliet.dll" "Building Juliet.dll [!CFG!]" "!JULIET_NEED_COMPILE!" "%COMPILER_FLAGS% /DJULIET_EXPORT /LD" "Intermediate\Juliet\*.cpp %IMGUI_OBJS%" "/link %COMMON_LIBS% /INCREMENTAL /ILK:Intermediate\x64-!CFG!\Juliet.ilk /PDB:Intermediate\x64-!CFG!\Juliet.pdb"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
:: --- Game.dll ---
if !BUILD_GAME_DLL! equ 1 (
call :link_target "Game.dll" "Building Game.dll [!CFG!]" "!GAME_NEED_COMPILE!" "%COMPILER_FLAGS% /DJULIET_EXPORT /LD" "Intermediate\Game\*.cpp %JULIET_OBJS% %IMGUI_OBJS%" "/link %COMMON_LIBS% bin\x64-!CFG!\Juliet.lib /INCREMENTAL /ILK:Intermediate\x64-!CFG!\Game.ilk /PDB:Intermediate\x64-!CFG!\Game.pdb"
call :link_target "Game.dll" "Building Game.dll [!CFG!]" "!GAME_NEED_COMPILE!" "%COMPILER_FLAGS% /DJULIET_EXPORT /LD" "Intermediate\Game\*.cpp %IMGUI_OBJS%" "/link %COMMON_LIBS% bin\x64-!CFG!\Juliet.lib /INCREMENTAL /ILK:Intermediate\x64-!CFG!\Game.ilk /PDB:Intermediate\x64-!CFG!\Game.pdb"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)
:: --- JulietApp.exe ---
if !TARGET_JULIET! equ 1 (
call :link_target "JulietApp.exe" "Building JulietApp.exe [!CFG!]" "!JULIETAPP_NEED_COMPILE!" "%COMPILER_FLAGS%" "Intermediate\JulietApp\*.cpp %JULIET_OBJS% %IMGUI_OBJS%" "/link %COMMON_LIBS% bin\x64-!CFG!\Juliet.lib /SUBSYSTEM:CONSOLE /INCREMENTAL /ILK:Intermediate\x64-!CFG!\JulietApp.ilk /PDB:Intermediate\x64-!CFG!\JulietApp.pdb"
call :link_target "JulietApp.exe" "Building JulietApp.exe [!CFG!]" "!JULIETAPP_NEED_COMPILE!" "%COMPILER_FLAGS%" "Intermediate\JulietApp\*.cpp %IMGUI_OBJS%" "/link %COMMON_LIBS% bin\x64-!CFG!\Juliet.lib /SUBSYSTEM:CONSOLE /INCREMENTAL /ILK:Intermediate\x64-!CFG!\JulietApp.ilk /PDB:Intermediate\x64-!CFG!\JulietApp.pdb"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)
:: --- Romeo.exe ---
if !TARGET_ROMEO! equ 1 (
call :link_target "Romeo.exe" "Building Romeo.exe [!CFG!]" "!ROMEO_NEED_COMPILE!" "%COMPILER_FLAGS%" "%JULIET_OBJS% Intermediate\Romeo\*.cpp" "/link %COMMON_LIBS% /SUBSYSTEM:CONSOLE /INCREMENTAL /ILK:\"Intermediate\x64-!CFG!\Romeo.ilk\" /PDB:\"Intermediate\x64-!CFG!\Romeo.pdb\""
call :link_target "Romeo.exe" "Building Romeo.exe [!CFG!]" "!ROMEO_NEED_COMPILE!" "%COMPILER_FLAGS%" "Intermediate\Romeo\*.cpp %IMGUI_OBJS%" "/link %COMMON_LIBS% bin\x64-!CFG!\Juliet.lib /SUBSYSTEM:CONSOLE /INCREMENTAL /ILK:Intermediate\x64-!CFG!\Romeo.ilk /PDB:Intermediate\x64-!CFG!\Romeo.pdb"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)
:: --- JulietShaderCompiler.exe ---
if !TARGET_SHADER! equ 1 (
if exist "Intermediate\JulietShaderCompiler\*.cpp" (
call :link_target "JulietShaderCompiler.exe" "Building JulietShaderCompiler.exe [!CFG!]" "!SHADER_NEED_COMPILE!" "%COMPILER_FLAGS% /I\"JulietShaderCompiler\"" "%JULIET_OBJS% Intermediate\JulietShaderCompiler\*.cpp" "/link %COMMON_LIBS% dxcompiler.lib /DELAYLOAD:dxcompiler.dll /SUBSYSTEM:CONSOLE /INCREMENTAL /ILK:\"Intermediate\x64-!CFG!\JulietShaderCompiler.ilk\" /PDB:\"Intermediate\x64-!CFG!\JulietShaderCompiler.pdb\""
call :link_target "JulietShaderCompiler.exe" "Building JulietShaderCompiler.exe [!CFG!]" "!SHADER_NEED_COMPILE!" "%COMPILER_FLAGS% /IJulietShaderCompiler" "Intermediate\JulietShaderCompiler\*.cpp %IMGUI_OBJS%" "/link %COMMON_LIBS% dxcompiler.lib /DELAYLOAD:dxcompiler.dll /SUBSYSTEM:CONSOLE /INCREMENTAL /ILK:Intermediate\x64-!CFG!\JulietShaderCompiler.ilk /PDB:Intermediate\x64-!CFG!\JulietShaderCompiler.pdb"
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
)
)
+80 -78
View File
@@ -6,18 +6,18 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <windows.h>
// ============================================================================
// Minimal string / path helpers (no STL, no std::filesystem — pure speed)
// ============================================================================
static constexpr int MaxPath = 1024;
static constexpr int MaxFiles = 4096;
static constexpr int MaxPath = 1024;
static constexpr int MaxFiles = 4096;
static constexpr int MaxHashEntries = 512;
struct FixedString
@@ -25,7 +25,11 @@ struct FixedString
char Data[MaxPath];
int Length;
FixedString() : Data{}, Length(0) {}
FixedString()
: Data{}
, Length(0)
{
}
void Set(const char* str)
{
@@ -48,7 +52,7 @@ struct FixedString
Data[i] = str[i];
}
Data[len] = '\0';
Length = len;
Length = len;
}
void Append(const char* str)
@@ -67,7 +71,7 @@ struct FixedString
if (Length < MaxPath - 1)
{
Data[Length++] = c;
Data[Length] = '\0';
Data[Length] = '\0';
}
}
@@ -117,8 +121,9 @@ struct FileContent
[[nodiscard]] static FileContent ReadEntireFile(const char* path)
{
assert(path != nullptr);
FileContent result = {nullptr, 0};
HANDLE file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
FileContent result = { nullptr, 0 };
HANDLE file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, nullptr);
if (file == INVALID_HANDLE_VALUE)
{
return result;
@@ -139,8 +144,8 @@ struct FileContent
ReadFile(file, buffer, size, &bytesRead, nullptr);
CloseHandle(file);
buffer[bytesRead] = '\0';
result.Data = buffer;
result.Size = bytesRead;
result.Data = buffer;
result.Size = bytesRead;
return result;
}
@@ -158,7 +163,8 @@ static bool WriteEntireFile(const char* path, const char* data, DWORD size)
{
assert(path != nullptr);
assert(data != nullptr);
HANDLE file = CreateFileA(path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
HANDLE file = CreateFileA(path, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, nullptr);
if (file == INVALID_HANDLE_VALUE)
{
return false;
@@ -196,7 +202,7 @@ static void EnsureDirectoryExists(const char* path)
if (GetFileAttributesExA(path, GetFileExInfoStandard, &data))
{
ULARGE_INTEGER li;
li.LowPart = data.ftLastWriteTime.dwLowDateTime;
li.LowPart = data.ftLastWriteTime.dwLowDateTime;
li.HighPart = data.ftLastWriteTime.dwHighDateTime;
return static_cast<int64_t>(li.QuadPart);
}
@@ -250,7 +256,7 @@ struct HashCache
}
}
HashCache(const HashCache&) = delete;
HashCache(const HashCache&) = delete;
HashCache& operator=(const HashCache&) = delete;
[[nodiscard]] const char* Find(const char* path) const
@@ -314,7 +320,7 @@ static void LoadHashCache(const char* cachePath, HashCache& cache)
FixedString key;
key.Set(lineStart, static_cast<int>(sep - lineStart));
int valLen = static_cast<int>((lineStart + lineLen) - (sep + 1));
int valLen = static_cast<int>((lineStart + lineLen) - (sep + 1));
char val[32] = {};
if (valLen > 0 && valLen < 32)
{
@@ -338,7 +344,7 @@ static void SaveHashCache(const char* cachePath, const HashCache& cache)
{
assert(cachePath != nullptr);
size_t bufSize = static_cast<size_t>(MaxHashEntries) * (MaxPath + 32 + 2);
char* buffer = static_cast<char*>(HeapAlloc(GetProcessHeap(), 0, bufSize));
char* buffer = static_cast<char*>(HeapAlloc(GetProcessHeap(), 0, bufSize));
if (buffer == nullptr)
{
return;
@@ -347,8 +353,8 @@ static void SaveHashCache(const char* cachePath, const HashCache& cache)
for (int i = 0; i < cache.Count; i++)
{
int written = sprintf_s(buffer + offset, bufSize - static_cast<size_t>(offset),
"%s=%s\n", cache.Entries[i].Path.Data, cache.Entries[i].HashStr);
int written = sprintf_s(buffer + offset, bufSize - static_cast<size_t>(offset), "%s=%s\n",
cache.Entries[i].Path.Data, cache.Entries[i].HashStr);
if (written > 0)
{
offset += written;
@@ -372,7 +378,7 @@ struct CleanResult
[[nodiscard]] static CleanResult CleanAndHashUnityFile(const char* filePath)
{
assert(filePath != nullptr);
CleanResult result = {{}, false};
CleanResult result = { {}, false };
FileContent content = ReadEntireFile(filePath);
if (content.Data == nullptr)
@@ -461,7 +467,7 @@ struct CleanResult
searchPath.Append("\\*");
WIN32_FIND_DATAA findData;
HANDLE hFind = FindFirstFileA(searchPath.Data, &findData);
HANDLE hFind = FindFirstFileA(searchPath.Data, &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
return newest;
@@ -490,23 +496,22 @@ struct CleanResult
}
else
{
if (EndsWithNoCase(findData.cFileName, ".cpp") ||
EndsWithNoCase(findData.cFileName, ".h") ||
EndsWithNoCase(findData.cFileName, ".hpp") ||
EndsWithNoCase(findData.cFileName, ".inl") ||
if (EndsWithNoCase(findData.cFileName, ".cpp") || EndsWithNoCase(findData.cFileName, ".h") ||
EndsWithNoCase(findData.cFileName, ".hpp") || EndsWithNoCase(findData.cFileName, ".inl") ||
EndsWithNoCase(findData.cFileName, ".c"))
{
ULARGE_INTEGER li;
li.LowPart = findData.ftLastWriteTime.dwLowDateTime;
li.LowPart = findData.ftLastWriteTime.dwLowDateTime;
li.HighPart = findData.ftLastWriteTime.dwHighDateTime;
int64_t ft = static_cast<int64_t>(li.QuadPart);
int64_t ft = static_cast<int64_t>(li.QuadPart);
if (ft > newest)
{
newest = ft;
}
}
}
} while (FindNextFileA(hFind, &findData));
}
while (FindNextFileA(hFind, &findData));
FindClose(hFind);
return newest;
@@ -537,7 +542,7 @@ struct FilePathList
}
}
FilePathList(const FilePathList&) = delete;
FilePathList(const FilePathList&) = delete;
FilePathList& operator=(const FilePathList&) = delete;
void Add(const char* path)
@@ -559,7 +564,7 @@ static void CollectUnityFiles(const char* dirPath, FilePathList& list)
searchPath.Append("\\*");
WIN32_FIND_DATAA findData;
HANDLE hFind = FindFirstFileA(searchPath.Data, &findData);
HANDLE hFind = FindFirstFileA(searchPath.Data, &findData);
if (hFind == INVALID_HANDLE_VALUE)
{
return;
@@ -589,7 +594,8 @@ static void CollectUnityFiles(const char* dirPath, FilePathList& list)
list.Add(fullPath.Data);
}
}
} while (FindNextFileA(hFind, &findData));
}
while (FindNextFileA(hFind, &findData));
FindClose(hFind);
}
@@ -608,7 +614,7 @@ static int CommandStartBuild()
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
ULARGE_INTEGER li;
li.LowPart = ft.dwLowDateTime;
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
char buf[32];
@@ -627,11 +633,11 @@ static int CommandStartStep(int argc, char* argv[])
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
ULARGE_INTEGER li;
li.LowPart = ft.dwLowDateTime;
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
char buf[MaxPath + 64];
int len = sprintf_s(buf, "%s\n%llu\n", stepName, li.QuadPart);
int len = sprintf_s(buf, "%s\n%llu\n", stepName, li.QuadPart);
if (len > 0)
{
WriteEntireFile("Intermediate\\step_start.tmp", buf, static_cast<DWORD>(len));
@@ -653,8 +659,8 @@ static int CommandEndStep(int argc, char* argv[])
return 0;
}
char stepName[MaxPath] = "Unnamed Step";
uint64_t startTicks = 0;
char stepName[MaxPath] = "Unnamed Step";
uint64_t startTicks = 0;
const char* line1End = strchr(content.Data, '\n');
if (line1End != nullptr)
@@ -678,18 +684,18 @@ static int CommandEndStep(int argc, char* argv[])
FILETIME ftNow;
GetSystemTimeAsFileTime(&ftNow);
ULARGE_INTEGER nowLi;
nowLi.LowPart = ftNow.dwLowDateTime;
nowLi.LowPart = ftNow.dwLowDateTime;
nowLi.HighPart = ftNow.dwHighDateTime;
double elapsedSeconds = static_cast<double>(nowLi.QuadPart - startTicks) / 10000000.0;
char appendBuf[MaxPath + 64];
int appendLen = sprintf_s(appendBuf, "%s|%.3fs\n", stepName, elapsedSeconds);
int appendLen = sprintf_s(appendBuf, "%s|%.3fs\n", stepName, elapsedSeconds);
if (appendLen > 0)
{
FileContent existing = ReadEntireFile("Intermediate\\step_timings.tmp");
DWORD newSize = static_cast<DWORD>(appendLen) + existing.Size;
char* combined = static_cast<char*>(HeapAlloc(GetProcessHeap(), 0, newSize + 1));
DWORD newSize = static_cast<DWORD>(appendLen) + existing.Size;
char* combined = static_cast<char*>(HeapAlloc(GetProcessHeap(), 0, newSize + 1));
if (combined != nullptr)
{
DWORD offset = 0;
@@ -712,8 +718,8 @@ static int CommandEndStep(int argc, char* argv[])
static int CommandFinishBuild()
{
// Compute elapsed time
const char* elapsedStr = "0.000s";
char elapsedBuf[64] = {};
const char* elapsedStr = "0.000s";
char elapsedBuf[64] = {};
if (FileExists("Intermediate\\build_start.tmp"))
{
@@ -727,7 +733,7 @@ static int CommandFinishBuild()
FILETIME ftNow;
GetSystemTimeAsFileTime(&ftNow);
ULARGE_INTEGER nowLi;
nowLi.LowPart = ftNow.dwLowDateTime;
nowLi.LowPart = ftNow.dwLowDateTime;
nowLi.HighPart = ftNow.dwHighDateTime;
double elapsedSeconds = static_cast<double>(nowLi.QuadPart - startTicks) / 10000000.0;
@@ -739,10 +745,10 @@ static int CommandFinishBuild()
else
{
int totalMs = static_cast<int>(elapsedSeconds * 1000.0);
int hours = totalMs / 3600000;
int hours = totalMs / 3600000;
int minutes = (totalMs % 3600000) / 60000;
int seconds = (totalMs % 60000) / 1000;
int ms = totalMs % 1000;
int ms = totalMs % 1000;
sprintf_s(elapsedBuf, "%02d:%02d:%02d.%03d", hours, minutes, seconds, ms);
}
elapsedStr = elapsedBuf;
@@ -785,7 +791,7 @@ static int CommandFinishBuild()
if (pipePos != nullptr)
{
char stepName[MaxPath] = {};
int nameLen = static_cast<int>(pipePos - lineStart);
int nameLen = static_cast<int>(pipePos - lineStart);
if (nameLen < MaxPath)
{
memcpy(stepName, lineStart, static_cast<size_t>(nameLen));
@@ -793,7 +799,7 @@ static int CommandFinishBuild()
}
char durationStr[64] = {};
int durLen = static_cast<int>((lineStart + lineLen) - (pipePos + 1));
int durLen = static_cast<int>((lineStart + lineLen) - (pipePos + 1));
if (durLen < 64)
{
memcpy(durationStr, pipePos + 1, static_cast<size_t>(durLen));
@@ -816,7 +822,7 @@ static int CommandFinishBuild()
if (FileExists("Intermediate\\built_outputs.tmp"))
{
FileContent outputsContent = ReadEntireFile("Intermediate\\built_outputs.tmp");
bool anyPrinted = false;
bool anyPrinted = false;
if (outputsContent.Data != nullptr)
{
@@ -848,9 +854,9 @@ static int CommandFinishBuild()
if (GetFileAttributesExA(filePath, GetFileExInfoStandard, &fileData))
{
ULARGE_INTEGER fileSize;
fileSize.LowPart = fileData.nFileSizeLow;
fileSize.LowPart = fileData.nFileSizeLow;
fileSize.HighPart = fileData.nFileSizeHigh;
double sizeMB = static_cast<double>(fileSize.QuadPart) / (1024.0 * 1024.0);
double sizeMB = static_cast<double>(fileSize.QuadPart) / (1024.0 * 1024.0);
printf(" - %s (%.2f MB)\n", filePath, sizeMB);
anyPrinted = true;
}
@@ -882,11 +888,11 @@ static int CommandEvaluate(int argc, char* argv[])
QueryPerformanceCounter(&perfStart);
QueryPerformanceFrequency(&perfFreq);
const char* cfg = (argc > 2) ? argv[2] : "Debug";
bool targetJuliet = (argc > 3) && argv[3][0] == '1';
bool targetGame = (argc > 4) && argv[4][0] == '1';
bool targetRomeo = (argc > 5) && argv[5][0] == '1';
bool targetShader = (argc > 6) && argv[6][0] == '1';
const char* cfg = (argc > 2) ? argv[2] : "Debug";
bool targetJuliet = (argc > 3) && argv[3][0] == '1';
bool targetGame = (argc > 4) && argv[4][0] == '1';
bool targetRomeo = (argc > 5) && argv[5][0] == '1';
bool targetShader = (argc > 6) && argv[6][0] == '1';
EnsureDirectoryExists("Intermediate");
@@ -895,7 +901,7 @@ static int CommandEvaluate(int argc, char* argv[])
LoadHashCache("Intermediate\\.unity_hashes_cache", oldCache);
HashCache newCache;
bool unityChanged = false;
bool unityChanged = false;
FilePathList unityFiles;
CollectUnityFiles("Intermediate", unityFiles);
@@ -955,12 +961,12 @@ static int CommandEvaluate(int argc, char* argv[])
char path[MaxPath];
sprintf_s(path, "%s\\Juliet_Unity1.obj", intDir);
bool julietNeed = unityChanged || !IsUpToDate(path, julietCombined);
sprintf_s(path, "%s\\ImGui_Unity1.obj", intDir);
bool imguiNeed = unityChanged || !IsUpToDate(path, imguiTime);
sprintf_s(path, "%s\\Juliet.dll", binDir);
bool julietNeed = unityChanged || !IsUpToDate(path, julietCombined);
bool gameNeed = false;
if (targetJuliet || targetGame)
{
@@ -990,26 +996,22 @@ static int CommandEvaluate(int argc, char* argv[])
}
QueryPerformanceCounter(&perfEnd);
double durationMs = static_cast<double>(perfEnd.QuadPart - perfStart.QuadPart) * 1000.0 / static_cast<double>(perfFreq.QuadPart);
double durationMs =
static_cast<double>(perfEnd.QuadPart - perfStart.QuadPart) * 1000.0 / static_cast<double>(perfFreq.QuadPart);
printf("[PERF] Fast Native C++ EvaluateConfig: %.1f ms\n", durationMs);
// Write results
char statusBuf[512];
int statusLen = sprintf_s(statusBuf,
"FASTBUILD_UNITY_CHANGED=%d\n"
"JULIET_NEED_COMPILE=%d\n"
"IMGUI_NEED_COMPILE=%d\n"
"GAME_NEED_COMPILE=%d\n"
"JULIETAPP_NEED_COMPILE=%d\n"
"ROMEO_NEED_COMPILE=%d\n"
"SHADER_NEED_COMPILE=%d\n",
unityChanged ? 1 : 0,
julietNeed ? 1 : 0,
imguiNeed ? 1 : 0,
gameNeed ? 1 : 0,
julietAppNeed ? 1 : 0,
romeoNeed ? 1 : 0,
shaderNeed ? 1 : 0);
int statusLen = sprintf_s(statusBuf,
"FASTBUILD_UNITY_CHANGED=%d\n"
"JULIET_NEED_COMPILE=%d\n"
"IMGUI_NEED_COMPILE=%d\n"
"GAME_NEED_COMPILE=%d\n"
"JULIETAPP_NEED_COMPILE=%d\n"
"ROMEO_NEED_COMPILE=%d\n"
"SHADER_NEED_COMPILE=%d\n",
unityChanged ? 1 : 0, julietNeed ? 1 : 0, imguiNeed ? 1 : 0, gameNeed ? 1 : 0,
julietAppNeed ? 1 : 0, romeoNeed ? 1 : 0, shaderNeed ? 1 : 0);
WriteEntireFile("Intermediate\\config_status.tmp", statusBuf, static_cast<DWORD>(statusLen));
fflush(stdout);
@@ -1038,10 +1040,10 @@ int main(int argc, char* argv[])
const char* cmd = argv[1];
if (strcmp(cmd, "check_alive") == 0) return 0;
if (strcmp(cmd, "start_build") == 0) return CommandStartBuild();
if (strcmp(cmd, "start_step") == 0) return CommandStartStep(argc, argv);
if (strcmp(cmd, "end_step") == 0) return CommandEndStep(argc, argv);
if (strcmp(cmd, "finish_build")== 0) return CommandFinishBuild();
if (strcmp(cmd, "evaluate") == 0) return CommandEvaluate(argc, argv);
if (strcmp(cmd, "start_step") == 0) return CommandStartStep(argc, argv);
if (strcmp(cmd, "end_step") == 0) return CommandEndStep(argc, argv);
if (strcmp(cmd, "finish_build") == 0) return CommandFinishBuild();
if (strcmp(cmd, "evaluate") == 0) return CommandEvaluate(argc, argv);
printf("[ERROR] Unknown command: %s\n", cmd);
return 1;