commit 6608b81
uint
·
2026-06-22 23:19:39 +0000 UTC
parent 32bd2ed
Add windows build scripts for library, basic-window
2 files changed,
+65,
-0
+38,
-0
1@@ -0,0 +1,38 @@
2+@echo off
3+
4+if not exist build mkdir build
5+
6+set "COMPILER=%~1"
7+if "%COMPILER%"=="" set "COMPILER=gcc"
8+
9+if /I "%COMPILER%"=="msvc" goto msvc
10+if /I "%COMPILER%"=="gcc" goto gcc
11+if /I "%COMPILER%"=="clang" goto clang
12+
13+echo Usage: build.bat [msvc^|gcc^|clang]
14+exit /b 1
15+
16+:: MSVC
17+:msvc
18+cl /diagnostics:color /nologo /W3 /O2 /Iinclude /DBACKEND_WIN /c ^
19+ source/maus.c source/maus_win.c source/maus_font.c source/utils.c
20+lib /nologo /OUT:build\libmaus_win.lib *.obj
21+move /Y *.obj build\
22+goto :eof
23+
24+:: GCC
25+:gcc
26+cc -std=c99 -Wall -Wextra -O2 -Iinclude -DBACKEND_WIN -c ^
27+ source/maus.c source/maus_win.c source/maus_font.c source/utils.c
28+move *.o build\
29+ar rcs build\libmaus_win.a build\maus.o build\maus_win.o build\maus_font.o build\utils.o
30+goto :eof
31+
32+:: GCC
33+:clang
34+clang -std=c99 -Wall -Wextra -O2 -Iinclude -DBACKEND_WIN -c ^
35+ source/maus.c source/maus_win.c source/maus_font.c source/utils.c
36+move *.o build\
37+ar rcs build\libmaus_win.a build\maus.o build\maus_win.o build\maus_font.o build\utils.o
38+goto :eof
39+
+27,
-0
1@@ -0,0 +1,27 @@
2+@echo off
3+
4+set "COMPILER=%~1"
5+if "%COMPILER%"=="" set "COMPILER=gcc"
6+
7+if /I "%COMPILER%"=="msvc" goto msvc
8+if /I "%COMPILER%"=="gcc" goto gcc
9+if /I "%COMPILER%"=="clang" goto clang
10+
11+echo Usage: build.bat [msvc^|gcc^|clang]
12+exit /b 1
13+
14+:msvc
15+cl /diagnostics:color /nologo /W3 /O2 /I..\..\include main.c ..\..\build\libmaus_win.lib user32.lib gdi32.lib /link /OUT:basic-window.exe
16+echo Build complete
17+goto :eof
18+
19+:gcc
20+cc -std=c99 -Wall -Wextra -g -I../../include main.c ../../build/libmaus_win.a -lgdi32 -luser32 -o basic-window.exe
21+echo Build complete
22+goto :eof
23+
24+:clang
25+clang -std=c99 -Wall -Wextra -g -I../../include main.c ../../build/libmaus_win.a -lgdi32 -luser32 -o basic-window.exe
26+echo Build complete
27+goto :eof
28+