Merge pull request #29 from u130b8/master
build release without crt, build debug with crt
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -58,3 +58,5 @@ dkms.conf
|
|||||||
/bin.7z
|
/bin.7z
|
||||||
*.zip
|
*.zip
|
||||||
*.res
|
*.res
|
||||||
|
|
||||||
|
release
|
||||||
17
build.cmd
17
build.cmd
@@ -1,6 +1,5 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
set DEFS=/DUNICODE
|
|
||||||
set DIR_ROOT=%~dp0.
|
set DIR_ROOT=%~dp0.
|
||||||
set DIR_PROGMGR=%DIR_ROOT%\progmgr
|
set DIR_PROGMGR=%DIR_ROOT%\progmgr
|
||||||
set DIR_RELEASE=%DIR_ROOT%\release
|
set DIR_RELEASE=%DIR_ROOT%\release
|
||||||
@@ -8,18 +7,22 @@ set DIR_RELEASE=%DIR_ROOT%\release
|
|||||||
rmdir /S /Q "%DIR_RELEASE%" > nul 2>&1
|
rmdir /S /Q "%DIR_RELEASE%" > nul 2>&1
|
||||||
if not exist "%DIR_RELEASE%" mkdir "%DIR_RELEASE%"
|
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" (
|
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
|
set LINK=/DEBUG
|
||||||
) else (
|
) else (
|
||||||
set CL=/GL /O1 /DNDEBUG /GS- %DEFS%
|
set CL=/O1 /GS- /DUNICODE /DNDEBUG /DPROGMGR_RELEASE /DPROGMGR_GIT_HASH="%GIT_HASH%"
|
||||||
set LINK=/LTCG /OPT:REF /OPT:ICF
|
set LINK=/NODEFAULTLIB /OPT:REF /OPT:ICF
|
||||||
)
|
)
|
||||||
|
|
||||||
pushd "%DIR_RELEASE%"
|
pushd "%DIR_RELEASE%"
|
||||||
rc /nologo /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\lang\dlg_en-US.rc"
|
rc /nologo /DPROGMGR_GIT_HASH="""%GIT_HASH%""" /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\lang\dlg_en-US.rc"
|
||||||
rc /nologo /i "%DIR_PROGMGR%" "%DIR_PROGMGR%\lang\res_en-US.rc"
|
rc /nologo /DPROGMGR_GIT_HASH="""%GIT_HASH%""" /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%\resource.rc"
|
||||||
cl /nologo /W3 /WX /MP /Feprogmgr.exe ^
|
cl /nologo /W3 /WX /MP /Feprogmgr.exe ^
|
||||||
"%DIR_PROGMGR%\*.c" ^
|
"%DIR_PROGMGR%\*.c" ^
|
||||||
"%DIR_PROGMGR%\resource.res" ^
|
"%DIR_PROGMGR%\resource.res" ^
|
||||||
|
|||||||
@@ -166,7 +166,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance,
|
|||||||
return 0;
|
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)
|
#pragma function(memset)
|
||||||
void *memset(char* dst, int value, size_t count) {
|
void *memset(char* dst, int value, size_t count) {
|
||||||
while (count--) { *dst++ = value; }
|
while (count--) { *dst++ = value; }
|
||||||
|
|||||||
@@ -41,6 +41,13 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "progmgr.exe.manifest"
|
|||||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||||
#include "version.inc"
|
#include "version.inc"
|
||||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
#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
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION VER_FILEVERSION
|
FILEVERSION VER_FILEVERSION
|
||||||
PRODUCTVERSION VER_PRODUCTVERSION
|
PRODUCTVERSION VER_PRODUCTVERSION
|
||||||
|
|||||||
Reference in New Issue
Block a user