2
0
mirror of https://github.com/arnavbhatt288/sdl-2.30.3-kolibri.git synced 2025-01-03 02:46:03 +01:00

add support for tests

Signed-off-by: Arnav Bhatt <arnav@ghativega.in>
This commit is contained in:
Arnav Bhatt 2024-06-27 14:17:28 +05:30
parent 872e26a649
commit 9968fdb39d
No known key found for this signature in database
GPG Key ID: 2F49C4D36103865D
2 changed files with 237 additions and 51 deletions

View File

@ -4,11 +4,14 @@ LD = kos32-ld
STRIP = kos32-strip
LIBNAME = libSDL2
LIBNAMETEST = libSDL2test
LIBS:= -lgcc -lc.dll -ldll -lsound
LDFLAGS+= -shared -s -T dll.lds --entry _DllStartup --image-base=0 --out-implib $(LIBNAME).dll.a
TLDFLAGS+= -shared -s -T dll.lds --entry _DllStartup --image-base=0 --out-implib $(LIBNAMETEST).dll.a
LDFLAGS+= -L/home/autobuild/tools/win32/mingw32/lib
TLDFLAGS+= -L/home/autobuild/tools/win32/mingw32/lib -L../../lib
atomic_OBJS = src/atomic/SDL_atomic.o src/atomic/SDL_spinlock.o
@ -92,26 +95,43 @@ OBJS = $(atomic_OBJS) $(audio_OBJS) $(cpuinfo_OBJS) $(events_OBJS) $(file_OBJS)
$(locale_OBJS) $(misc_OBJS) $(render_OBJS) $(sensor_OBJS) $(stdlib_OBJS) $(libm_OBJS) \
$(thread_OBJS) $(timer_OBJS) $(video_OBJS) $(curr_OBJS)
TOBJS = src/test/SDL_test_assert.o src/test/SDL_test_common.o src/test/SDL_test_compare.o \
src/test/SDL_test_crc32.o src/test/SDL_test_font.o src/test/SDL_test_fuzzer.o \
src/test/SDL_test_harness.o src/test/SDL_test_imageBlit.o \
src/test/SDL_test_imageBlitBlend.o src/test/SDL_test_imageFace.o \
src/test/SDL_test_imagePrimitives.o src/test/SDL_test_imagePrimitivesBlend.o \
src/test/SDL_test_log.o src/test/SDL_test_md5.o src/test/SDL_test_memory.o \
src/test/SDL_test_random.o
CFLAGS = -c -O2 -mpreferred-stack-boundary=2 -fno-ident -fomit-frame-pointer -fno-stack-check \
-fno-stack-protector -mno-stack-arg-probe -fno-exceptions -fno-asynchronous-unwind-tables \
-ffast-math -mno-ms-bitfields -fexpensive-optimizations \
-D__KOLIBRI__ -D_KOLIBRI -DKOLIBRI -D_KOS_ -D_KOS -DKOS -DDEBUG_AUDIO -DDEBUG_VIDEO \
-D__KOLIBRI__ -D_KOLIBRI -DKOLIBRI -D_KOS_ -D_KOS -DKOS \
-DPACKAGE=\"SDL\" -DVERSION=\"2.30.3\" -U_Win32 -UWIN32 -U_WIN32 -U__MINGW32__ -U__WIN32__ \
-I../newlib/libc/include/ -Iinclude/ -Iatomic/ -Iaudio/ -Icpuinfo/ -Ievents/ -Ifile/ -Ihaptic/ \
-Ihidapi/ -Ijoystick/ -Iloadso/ -Ipower/ -Ifilesystem/ -Ilocale/ -Imisc/ -Irender/ -Isensor/ \
-Istdlib/ -Ilibm/ -Ithread/ -Itimer/ -Ivideo/ -I.
all: $(LIBNAME).a $(LIBNAME).dll
all: $(LIBNAME).a $(LIBNAME).dll $(LIBNAMETEST).a $(LIBNAMETEST).dll
$(LIBNAME).a: $(OBJS)
$(AR) -crs ../../lib/$(LIBNAME).a $(OBJS)
$(AR) -crs ../../lib/$@ $^
$(LIBNAME).dll: $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
$(STRIP) -S $@
$(LIBNAMETEST).a: $(TOBJS)
$(AR) -crs ../../lib/$@ $^
$(LIBNAMETEST).dll: $(TOBJS)
$(LD) $(TLDFLAGS) -o $@ $^ -lSDL2 $(LIBS)
$(STRIP) -S $@
%.o : %.c Makefile
$(CC) $(CFLAGS) -o $@ $<
clean:
rm -f $(OBJS)
rm -f $(OBJS) $(TOBJS) ../../lib/$(LIBNAME).a ../../lib/$(LIBNAMETEST).a $(LIBNAME).dll $(LIBNAME).dll.a \
$(LIBNAMETEST).dll $(LIBNAMETEST).dll.a

166
test/Makefile Normal file
View File

@ -0,0 +1,166 @@
CC = kos32-gcc
LD = kos32-ld
OBJCOPY = kos32-objcopy
SDK_DIR = ../../..
LDFLAGS = -nostdlib -static --image-base 0 -T $(SDK_DIR)/sources/newlib/app.lds --subsystem native
CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -D_KOLIBRI -DNO_ZIP -DPERFORMANCE
LIBS = -lSDL2test -lSDL2 -lgcc -lc.dll -lc -lsound
INCLUDES = -I $(SDK_DIR)/sources/newlib/libc/include -I ../include/
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
all: checkkeys loopwave testatomic testaudioinfo testbounds testcustomcursor testdisplayinfo testdraw2 testdrawchessboard testfile \
testfilesystem testgeometry testiconv testime testintersections testkeys testmouse testmultiaudio testoverlay2 \
testplatform testqsort testrelative testrendercopyex testrendertarget testresample testscale testshape testsprite2 \
testspriteminimal teststreaming testver testviewport testwm2 testyuv
checkkeys: checkkeys.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
loopwave: loopwave.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
loopwavequeue: loopwavequeue.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testatomic: testatomic.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testaudioinfo: testaudioinfo.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testbounds: testbounds.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testcustomcursor: testcustomcursor.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testdisplayinfo: testdisplayinfo.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testdraw2: testdraw2.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testdrawchessboard: testdrawchessboard.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testfile: testfile.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testfilesystem: testfilesystem.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testgeometry: testgeometry.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testiconv: testiconv.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testime: testime.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testintersections: testintersections.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testkeys: testkeys.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testmouse: testmouse.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testmultiaudio: testmultiaudio.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testoverlay2: testoverlay2.o testyuv_cvt.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testplatform: testplatform.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testqsort: testqsort.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testrelative: testrelative.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testrendercopyex: testrendercopyex.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testrendertarget: testrendertarget.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testresample: testresample.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testscale: testscale.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testshape: testshape.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testsprite2: testsprite2.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testspriteminimal: testspriteminimal.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
teststreaming: teststreaming.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testver: testver.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testviewport: testviewport.o testutils.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testwm2: testwm2.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
testyuv: testyuv.o testyuv_cvt.o
$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $^ $(LIBS)
$(OBJCOPY) $@ -O binary
%.o : %.c Makefile
$(CC) $(CFLAGS) $(INCLUDES) -o $@ $<
clean:
rm -f *.o
rm -f checkkeys loopwave testatomic testaudioinfo testbounds testcustomcursor testdisplayinfo testdraw2 testdrawchessboard testfile \
testfilesystem testgeometry testiconv testime testintersections testkeys testmouse testmultiaudio testoverlay2 \
testplatform testqsort testrelative testrendercopyex testrendertarget testresample testscale testshape testsprite2 \
testspriteminimal teststreaming testver testviewport testwm2 testyuv