@echo off setlocal enabledelayedexpansion if "%~1"=="" ( echo Usage: build_imgui_lib.cmd [Debug^|Release] exit /b 1 ) set CONFIG=%~1 if /I "%CONFIG%"=="Debug" ( rem /Z7 embeds debug info into PDB so we don't need to pass /Fd to cl set CFLAGS=/MTd /Od /Z7 /DDEBUG /DEBUG -diagnostics:caret -diagnostics:column -D_CRT_SECURE_NO_WARNINGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING -D_CRT_NONSTDC_NO_DEPRECATE -D_USE_MATH_DEFINES set LIB_PATH=bin/Debug ) else if /I "%CONFIG%"=="Release" ( set CFLAGS=/MT /O2 /DNDEBUG set LIB_PATH=bin/Release ) else ( echo Invalid configuration: %CONFIG% echo Usage: build_imgui_lib.cmd [Debug^|Release] exit /b 1 ) set OBJDIR=obj if not exist "%LIB_PATH%" mkdir "%LIB_PATH%" if not exist obj mkdir obj set LIB_NAME=dear-imgui set SRC_FILES=^ lib\third_party\dear-imgui\imgui.cpp ^ lib\third_party\dear-imgui\imgui_widgets.cpp ^ lib\third_party\dear-imgui\imgui_draw.cpp ^ lib\third_party\dear-imgui\imgui_tables.cpp ^ lib\third_party\dear-imgui\imgui_impl_dx11.cpp ^ lib\third_party\dear-imgui\imgui_impl_win32.cpp rem lib\third_party\dear-imgui\imgui_demo.cpp ^ set INCLUDE_DIRS=^ /Ilib\third_party set LINK_LIBS= REM Build STATIC LIBRARY: rem /Fd%LIB_PATH%/%LIB_NAME%.pdb can be passed to cl if compiling with /Zi echo Building static LIB (%CONFIG%) cl /nologo /EHsc /DWIN32 /wd4530 %CFLAGS% %INCLUDE_DIRS% %SRC_FILES% /c /Fo%OBJDIR%\ lib /OUT:%LIB_PATH%\%LIB_NAME%.lib %OBJDIR%\*.obj %LINK_LIBS% rd /s /q "%OBJDIR%" endlocal