diff --git a/build.bat b/build.bat index b426364..bb9a45f 100755 --- a/build.bat +++ b/build.bat @@ -1,4 +1,12 @@ @echo off +setlocal enabledelayedexpansion +cd /D "%~dp0" + +for %%a in (%*) do set "%%~a=1" +if not "%release%"=="1" set debug=1 +if "%debug%"=="1" set release=0 && echo [debug mode] +if "%release%"=="1" set debug=0 && echo [release mode] +if "%package%"=="1" echo [package zip] if not exist "src\external\SDL" ( pushd src\external @@ -7,21 +15,30 @@ if not exist "src\external\SDL" ( git checkout release-3.4.0 cmake -S . -B build_win32_static -DCMAKE_BUILD_TYPE=Release -DSDL_STATIC=ON pushd build_win32_static - msbuild SDL3.sln + msbuild SDL3.sln -maxCpuCount:16 -p:Configuration=Release popd popd popd ) set sdl=..\src\external\SDL -set sdllib=%sdl%\build_win32_static\Debug +set sdllib=%sdl%\build_win32_static\Release mkdir build pushd build -set flags=/EHsc- /MD /Zi /FC /nologo /WX /W3 /wd4200 /wd4334 /diagnostics:column -DDEBUG_BUILD=1 +set flags=/EHsc- /MT /Zi /FC /nologo /WX /W3 /wd4200 /wd4334 /diagnostics:column +if "%release%"=="1" set flags=%flags% -O2 -DDEBUG_BUILD=0 + set libs=%sdllib%/SDL3-static.lib %sdllib%/SDL_uclibc.lib kernel32.lib gdi32.lib user32.lib Imm32.lib ole32.lib Shell32.lib OleAut32.lib Cfgmgr32.lib Setupapi.lib Advapi32.lib version.lib winmm.lib cl %flags% ../src/text_editor/text_editor.cpp -Fe:te.exe -I%sdl%/include -I../src/external/glad -I../src/ %libs% -link /SUBSYSTEM:WINDOWS /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:MSVCRTD + +:: small util when working on the editor using the editor copy te.exe te2.exe popd -rem /fsanitize=address + +if "%package%"=="1" ( + copy build\te.exe . + "C:\Program Files\7-Zip\7z.exe" a te.zip te.exe + del te.exe +) \ No newline at end of file diff --git a/src/backup/todo.txt b/src/backup/todo.txt index 2391afe..cb8bcc0 100644 --- a/src/backup/todo.txt +++ b/src/backup/todo.txt @@ -2,9 +2,7 @@ ! From a user (novice) point of view, how does it look like? - Buffer edit history separate from caret history (tagging history blocks with carets???) -- Search and replace - We need regex for: [FormatCode matching, IsCode matching, -- IndentKind has issues with stuff still like cleaning whitespace etc. - Remedybg commands integrated! (like clicking f5 and opening up the window) - Macros - ctrl-e started doing no-ops again ... ?? diff --git a/src/basic/basic_alloc.h b/src/basic/basic_alloc.h index 1e8c1b6..91f0d11 100644 --- a/src/basic/basic_alloc.h +++ b/src/basic/basic_alloc.h @@ -5,12 +5,8 @@ struct LocationTrace { int line; }; -#if DEBUG_BUILD thread_local LocationTrace LocationTraceO; #define LOCATION_TRACE (LocationTraceO.file = __FILE__, LocationTraceO.line = __LINE__) -#else -#define LOCATION_TRACE -#endif const int AllocatorKind_Allocate = 1; const int AllocatorKind_Deallocate = 2; diff --git a/src/text_editor/globals.cpp b/src/text_editor/globals.cpp index dae2cfa..e59b3e9 100644 --- a/src/text_editor/globals.cpp +++ b/src/text_editor/globals.cpp @@ -8,11 +8,7 @@ bool WaitForEventsState = true; bool RunGCThisFrame; bool SearchCaseSensitive = false; bool SearchWordBoundary = false; -#if OS_WINDOWS -bool BreakOnError = true; -#else bool BreakOnError = false; -#endif WindowID WindowIDs; ViewID ViewIDs; diff --git a/src/text_editor/profiler.h b/src/text_editor/profiler.h index 991c302..0bb1970 100644 --- a/src/text_editor/profiler.h +++ b/src/text_editor/profiler.h @@ -1,4 +1,4 @@ -#if 1 +#if BUILD_DEBUG // SPDX-FileCopyrightText: © 2023 Phillip Trudeau-Tavara // SPDX-License-Identifier: MIT @@ -404,6 +404,7 @@ struct ProfileScopeClass { ~ProfileScopeClass() { EndProfileScope(); } }; #else + #define ProfileScopeEx(name) #define ProfileScope(name) #define ProfileFunction() #define BeginProfiler()