This commit is contained in:
freedom
2023-09-07 03:19:37 -06:00
5 changed files with 25 additions and 9 deletions

4
.gitignore vendored
View File

@@ -57,4 +57,6 @@ dkms.conf
/misc/supermiumman.png
/bin.7z
*.zip
*.res
*.res
release

View File

@@ -1,6 +1,5 @@
@echo off
set DEFS=/DUNICODE
set DIR_ROOT=%~dp0.
set DIR_PROGMGR=%DIR_ROOT%\progmgr
set DIR_RELEASE=%DIR_ROOT%\release
@@ -8,18 +7,22 @@ set DIR_RELEASE=%DIR_ROOT%\release
rmdir /S /Q "%DIR_RELEASE%" > nul 2>&1
if not exist "%DIR_RELEASE%" mkdir "%DIR_RELEASE%"
git rev-parse HEAD > %DIR_RELEASE%\.git_hash
set /P GIT_HASH=<%DIR_RELEASE%\.git_hash
set "GIT_HASH=%GIT_HASH:~0,8%"
if "%1" == "debug" (
set CL=/MT /Od /Zi /RTC1 /Fdprogmgr.pdb /fsanitize=address %DEFS%
set CL=/MT /Od /Zi /RTC1 /Fdprogmgr.pdb /fsanitize=address /DUNICODE /DPROGMGR_DEBUG /DPROGMGR_GIT_HASH="%GIT_HASH%"
set LINK=/DEBUG
) else (
set CL=/GL /O1 /DNDEBUG /GS- %DEFS%
set LINK=/LTCG /OPT:REF /OPT:ICF
set CL=/O1 /GS- /DUNICODE /DNDEBUG /DPROGMGR_RELEASE /DPROGMGR_GIT_HASH="%GIT_HASH%"
set LINK=/NODEFAULTLIB /OPT:REF /OPT:ICF
)
pushd "%DIR_RELEASE%"
rc /nologo /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\lang\dlg_en-US.rc"
rc /nologo /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\lang\res_en-US.rc"
rc /nologo /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\resource.rc"
rc /nologo /DPROGMGR_GIT_HASH="""%GIT_HASH%""" /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\lang\dlg_en-US.rc"
rc /nologo /DPROGMGR_GIT_HASH="""%GIT_HASH%""" /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\lang\res_en-US.rc"
rc /nologo /DPROGMGR_GIT_HASH="""%GIT_HASH%""" /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\resource.rc"
cl /nologo /W3 /WX /MP /Feprogmgr.exe ^
"%DIR_PROGMGR%\*.c" ^
"%DIR_PROGMGR%\resource.res" ^

View File

@@ -166,7 +166,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
return 0;
}
#ifdef PROGMGR_NO_CRT
// NOTE(u130b8): We're compiling without the C runtime by default in Release builds.
// But in Debug builds, we need the C runtime, otherwise the address sanitizer and
// MSVC debug tools break because they use the wWinMainCRTStartup entrypoint to initialize.
#ifdef PROGMGR_RELEASE
#pragma function(memset)
void *memset(char* dst, int value, size_t count) {
while (count--) { *dst++ = value; }

View File

@@ -41,6 +41,13 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "progmgr.exe.manifest"
#define APSTUDIO_HIDDEN_SYMBOLS
#include "version.inc"
#undef APSTUDIO_HIDDEN_SYMBOLS
// NOTE(u130b8): Example of using PROGMGR_GIT_HASH in the resource file
#ifdef PROGMGR_GIT_HASH
#undef VER_PRODUCTVERSION_STR
#define VER_PRODUCTVERSION_STR "git-" PROGMGR_GIT_HASH
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION