Build SDL 2.0.16 with vanilla GCC

Hi,

I want to compile the SDL 2.0.16 sources with my application. I’m using Windows and GCC version 11.2.0.

Right now i’m trying to compile using this script:

@echo off

echo SDL_windowsclipboard...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsclipboard.c -o SDL_windowsclipboard.o
echo SDL_windowsevents...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsevents.c -o SDL_windowsevents.o
echo SDL_windowsframebuffer...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsframebuffer.c -o SDL_windowsframebuffer.o
echo SDL_windowskeyboard...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowskeyboard.c -o SDL_windowskeyboard.o
echo SDL_windowsmessagebox...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsmessagebox.c -o SDL_windowsmessagebox.o
echo SDL_windowsmodes...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsmodes.c -o SDL_windowsmodes.o
echo SDL_windowsmouse...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsmouse.c -o SDL_windowsmouse.o
echo SDL_windowsopengl...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsopengl.c -o SDL_windowsopengl.o
echo SDL_windowsopengles...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsopengles.c -o SDL_windowsopengles.o
echo SDL_windowsshape...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsshape.c -o SDL_windowsshape.o
echo SDL_windowsvideo...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsvideo.c -o SDL_windowsvideo.o
echo SDL_windowsvulkan...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowsvulkan.c -o SDL_windowsvulkan.o
echo SDL_windowswindow...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\windows\SDL_windowswindow.c -o SDL_windowswindow.o
echo SDL_blit...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_blit.c -o SDL_blit.o
echo SDL_blit_0...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_blit_0.c -o SDL_blit_0.o
echo SDL_blit_1...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_blit_1.c -o SDL_blit_1.o
echo SDL_blit_A...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_blit_A.c -o SDL_blit_A.o
echo SDL_blit_auto...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_blit_auto.c -o SDL_blit_auto.o
echo SDL_blit_copy...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_blit_copy.c -o SDL_blit_copy.o
echo SDL_blit_N...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_blit_N.c -o SDL_blit_N.o
echo SDL_blit_slow...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_blit_slow.c -o SDL_blit_slow.o
echo SDL_bmp...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_bmp.c -o SDL_bmp.o
echo SDL_clipboard...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_clipboard.c -o SDL_clipboard.o
echo SDL_egl...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_egl.c -o SDL_egl.o
echo SDL_fillrect...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_fillrect.c -o SDL_fillrect.o
echo SDL_pixels...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_pixels.c -o SDL_pixels.o
echo SDL_rect...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_rect.c -o SDL_rect.o
echo SDL_RLEaccel...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_RLEaccel.c -o SDL_RLEaccel.o
echo SDL_shape...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_shape.c -o SDL_shape.o
echo SDL_stretch...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_stretch.c -o SDL_stretch.o
echo SDL_surface...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_surface.c -o SDL_surface.o
echo SDL_video...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_video.c -o SDL_video.o
echo SDL_vulkan_utils...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_vulkan_utils.c -o SDL_vulkan_utils.o
echo SDL_yuv...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\video\SDL_yuv.c -o SDL_yuv.o
echo SDL_audio...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\audio\SDL_audio.c -o SDL_audio.o
echo SDL_audiocvt...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\audio\SDL_audiocvt.c -o SDL_audiocvt.o
echo SDL_audiodev...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\audio\SDL_audiodev.c -o SDL_audiodev.o
echo SDL_audiotypecvt...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\audio\SDL_audiotypecvt.c -o SDL_audiotypecvt.o
echo SDL_mixer...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\audio\SDL_mixer.c -o SDL_mixer.o
echo SDL_wave...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\audio\SDL_wave.c -o SDL_wave.o
echo SDL_wasapi...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\audio\wasapi\SDL_wasapi.c -o SDL_wasapi.o
echo SDL_wasapi_win32...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\audio\wasapi\SDL_wasapi_win32.c -o SDL_wasapi_win32.o
echo SDL_hid...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\core\windows\SDL_hid.c -o SDL_hid.o
echo SDL_windows...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\core\windows\SDL_windows.c -o SDL_windows.o
echo SDL_xinput...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\core\windows\SDL_xinput.c -o SDL_xinput.o
echo SDL...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\SDL.c -o SDL.o
echo SDL_assert...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\SDL_assert.c -o SDL_assert.o
echo SDL_dataqueue...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\SDL_dataqueue.c -o SDL_dataqueue.o
echo SDL_error...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\SDL_error.c -o SDL_error.o
echo SDL_hints...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\SDL_hints.c -o SDL_hints.o
echo SDL_log...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\SDL_log.c -o SDL_log.o
echo SDL_windows_main...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\main\windows\SDL_windows_main.c -o SDL_windows_main.o
echo SDL_d3dmath...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\SDL_d3dmath.c -o SDL_d3dmath.o
echo SDL_render...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\SDL_render.c -o SDL_render.o
echo SDL_yuv_sw...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\SDL_yuv_sw.c -o SDL_yuv_sw.o
echo SDL_blendfillrect...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\software\SDL_blendfillrect.c -o SDL_blendfillrect.o
echo SDL_blendline...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\software\SDL_blendline.c -o SDL_blendline.o
echo SDL_blendpoint...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\software\SDL_blendpoint.c -o SDL_blendpoint.o
echo SDL_drawline...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\software\SDL_drawline.c -o SDL_drawline.o
echo SDL_drawpoint...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\software\SDL_drawpoint.c -o SDL_drawpoint.o
echo SDL_render_sw...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\software\SDL_render_sw.c -o SDL_render_sw.o
echo SDL_rotate...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\render\software\SDL_rotate.c -o SDL_rotate.o
echo SDL_crc32...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\stdlib\SDL_crc32.c -o SDL_crc32.o
echo SDL_getenv...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\stdlib\SDL_getenv.c -o SDL_getenv.o
echo SDL_iconv...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\stdlib\SDL_iconv.c -o SDL_iconv.o
echo SDL_malloc...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\stdlib\SDL_malloc.c -o SDL_malloc.o
echo SDL_qsort...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\stdlib\SDL_qsort.c -o SDL_qsort.o
echo SDL_stdlib...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\stdlib\SDL_stdlib.c -o SDL_stdlib.o
echo SDL_string...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\stdlib\SDL_string.c -o SDL_string.o
echo SDL_strtokr...
gcc -c -IC:\Users\Alessandro\Desktop\SDL2-2.0.16\include C:\Users\Alessandro\Desktop\SDL2-2.0.16\src\stdlib\SDL_strtokr.c -o SDL_strtokr.o

pause

But many file are failing with:
fatal error: EGL/egl.h: No such file or directory

Are there any external dependencies i’m missing?

Thank you,
Alessandro

You probably don’t need to compile SDL_egl.c

If you want to do this, I would recommend looking through the Visual Studio project file for exactly what a Windows build needs to compile.

Grep can give you a good list:

grep ClCompile VisualC/SDL/SDL.vcxproj

You might need to -D_WINDOWS, too, as the Visual Studio projects do that.

There might be other little issues, but I’m curious to see if this works out, so report back if you make progress!

A little update,

Files i’m compiling:

call :compile_file SDL2_2_0_16\src\atomic\SDL_atomic.c
call :compile_file SDL2_2_0_16\src\atomic\SDL_spinlock.c
call :compile_file SDL2_2_0_16\src\stdlib\SDL_crc32.c
call :compile_file SDL2_2_0_16\src\stdlib\SDL_getenv.c
call :compile_file SDL2_2_0_16\src\stdlib\SDL_iconv.c
call :compile_file SDL2_2_0_16\src\stdlib\SDL_malloc.c
call :compile_file SDL2_2_0_16\src\stdlib\SDL_qsort.c
call :compile_file SDL2_2_0_16\src\stdlib\SDL_stdlib.c
call :compile_file SDL2_2_0_16\src\stdlib\SDL_string.c
call :compile_file SDL2_2_0_16\src\stdlib\SDL_strtokr.c
call :compile_file SDL2_2_0_16\src\file\SDL_rwops.c
call :compile_file SDL2_2_0_16\src\video\SDL_egl.c
call :compile_file SDL2_2_0_16\src\events\SDL_clipboardevents.c
call :compile_file SDL2_2_0_16\src\events\SDL_displayevents.c
call :compile_file SDL2_2_0_16\src\events\SDL_dropevents.c
call :compile_file SDL2_2_0_16\src\events\SDL_events.c
call :compile_file SDL2_2_0_16\src\events\SDL_gesture.c
call :compile_file SDL2_2_0_16\src\events\SDL_keyboard.c
call :compile_file SDL2_2_0_16\src\events\SDL_mouse.c
call :compile_file SDL2_2_0_16\src\events\SDL_quit.c
call :compile_file SDL2_2_0_16\src\events\SDL_touch.c
call :compile_file SDL2_2_0_16\src\events\SDL_windowevents.c
call :compile_file SDL2_2_0_16\src\thread\SDL_thread.c
call :compile_file SDL2_2_0_16\src\thread\windows\SDL_syscond_srw.c
call :compile_file SDL2_2_0_16\src\thread\windows\SDL_sysmutex.c
call :compile_file SDL2_2_0_16\src\thread\windows\SDL_syssem.c
call :compile_file SDL2_2_0_16\src\thread\windows\SDL_systhread.c
call :compile_file SDL2_2_0_16\src\thread\windows\SDL_systls.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsclipboard.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsevents.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsframebuffer.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowskeyboard.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsmessagebox.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsmodes.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsmouse.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsopengl.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsopengles.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsshape.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsvideo.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowsvulkan.c
call :compile_file SDL2_2_0_16\src\video\windows\SDL_windowswindow.c
call :compile_file SDL2_2_0_16\src\video\SDL_blit.c
call :compile_file SDL2_2_0_16\src\video\SDL_blit_0.c
call :compile_file SDL2_2_0_16\src\video\SDL_blit_1.c
call :compile_file SDL2_2_0_16\src\video\SDL_blit_A.c
call :compile_file SDL2_2_0_16\src\video\SDL_blit_auto.c
call :compile_file SDL2_2_0_16\src\video\SDL_blit_copy.c
call :compile_file SDL2_2_0_16\src\video\SDL_blit_N.c
call :compile_file SDL2_2_0_16\src\video\SDL_blit_slow.c
call :compile_file SDL2_2_0_16\src\video\SDL_bmp.c
call :compile_file SDL2_2_0_16\src\video\SDL_clipboard.c
call :compile_file SDL2_2_0_16\src\video\SDL_fillrect.c
call :compile_file SDL2_2_0_16\src\video\SDL_pixels.c
call :compile_file SDL2_2_0_16\src\video\SDL_rect.c
call :compile_file SDL2_2_0_16\src\video\SDL_RLEaccel.c
call :compile_file SDL2_2_0_16\src\video\SDL_shape.c
call :compile_file SDL2_2_0_16\src\video\SDL_stretch.c
call :compile_file SDL2_2_0_16\src\video\SDL_surface.c
call :compile_file SDL2_2_0_16\src\video\SDL_video.c
call :compile_file SDL2_2_0_16\src\video\SDL_vulkan_utils.c
call :compile_file SDL2_2_0_16\src\video\SDL_yuv.c
call :compile_file SDL2_2_0_16\src\audio\SDL_audio.c
call :compile_file SDL2_2_0_16\src\audio\SDL_audiocvt.c
call :compile_file SDL2_2_0_16\src\audio\SDL_audiodev.c
call :compile_file SDL2_2_0_16\src\audio\SDL_audiotypecvt.c
call :compile_file SDL2_2_0_16\src\audio\SDL_mixer.c
call :compile_file SDL2_2_0_16\src\audio\SDL_wave.c
call :compile_file SDL2_2_0_16\src\audio\wasapi\SDL_wasapi.c
call :compile_file SDL2_2_0_16\src\audio\wasapi\SDL_wasapi_win32.c
call :compile_file SDL2_2_0_16\src\core\windows\SDL_hid.c
call :compile_file SDL2_2_0_16\src\core\windows\SDL_windows.c
call :compile_file SDL2_2_0_16\src\core\windows\SDL_xinput.c
call :compile_file SDL2_2_0_16\src\SDL.c
call :compile_file SDL2_2_0_16\src\SDL_assert.c
call :compile_file SDL2_2_0_16\src\SDL_dataqueue.c
call :compile_file SDL2_2_0_16\src\SDL_error.c
call :compile_file SDL2_2_0_16\src\SDL_hints.c
call :compile_file SDL2_2_0_16\src\SDL_log.c
call :compile_file SDL2_2_0_16\src\main\windows\SDL_windows_main.c
call :compile_file SDL2_2_0_16\src\render\SDL_d3dmath.c
call :compile_file SDL2_2_0_16\src\render\SDL_render.c
call :compile_file SDL2_2_0_16\src\render\SDL_yuv_sw.c
call :compile_file SDL2_2_0_16\src\render\software\SDL_blendfillrect.c
call :compile_file SDL2_2_0_16\src\render\software\SDL_blendline.c
call :compile_file SDL2_2_0_16\src\render\software\SDL_blendpoint.c
call :compile_file SDL2_2_0_16\src\render\software\SDL_drawline.c
call :compile_file SDL2_2_0_16\src\render\software\SDL_drawpoint.c
call :compile_file SDL2_2_0_16\src\render\software\SDL_render_sw.c
call :compile_file SDL2_2_0_16\src\render\software\SDL_rotate.c
call :compile_file SDL2_2_0_16\src\libm\e_atan2.c
call :compile_file SDL2_2_0_16\src\libm\e_exp.c
call :compile_file SDL2_2_0_16\src\libm\e_fmod.c
call :compile_file SDL2_2_0_16\src\libm\e_log.c
call :compile_file SDL2_2_0_16\src\libm\e_log10.c
call :compile_file SDL2_2_0_16\src\libm\e_pow.c
call :compile_file SDL2_2_0_16\src\libm\e_rem_pio2.c
call :compile_file SDL2_2_0_16\src\libm\e_sqrt.c
call :compile_file SDL2_2_0_16\src\libm\k_cos.c
call :compile_file SDL2_2_0_16\src\libm\k_rem_pio2.c
call :compile_file SDL2_2_0_16\src\libm\k_sin.c
call :compile_file SDL2_2_0_16\src\libm\k_tan.c
call :compile_file SDL2_2_0_16\src\libm\s_atan.c
call :compile_file SDL2_2_0_16\src\libm\s_copysign.c
call :compile_file SDL2_2_0_16\src\libm\s_cos.c
call :compile_file SDL2_2_0_16\src\libm\s_fabs.c
call :compile_file SDL2_2_0_16\src\libm\s_floor.c
call :compile_file SDL2_2_0_16\src\libm\s_scalbn.c
call :compile_file SDL2_2_0_16\src\libm\s_sin.c
call :compile_file SDL2_2_0_16\src\libm\s_tan.c

Compiling with:

set DEFINITIONS= ^
	-DDLL_EXPORT ^
	-D_DEBUG ^
	-D_WINDOWS ^
	-D__MINGW32__ ^
	-D__WINDOWS__ ^
	-DSDL_VIDEO_RENDER_SW ^
	-DSDL_JOYSTICK_DISABLED=1 ^
	-DSDL_HAPTIC_DISABLED=1 ^
	-DSDL_SENSOR_DISABLED=1 ^
	-DSDL_TIMERS_DISABLED=1

set INCLUDES= ^
	-ISDL2_2_0_16\include

Linking with

set LIBS= ^
	-lgdi32 ^
	-lversion ^
	-limm32 ^
	-lole32 ^
	-loleaut32 ^
	-lstrmiids

SDL_config_windows.h (slightly refarctored)

/*
  Simple DirectMedia Layer
  Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
     claim that you wrote the original software. If you use this software
     in a product, an acknowledgment in the product documentation would be
     appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
     misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.
*/

#ifndef SDL_config_windows_h_
#define SDL_config_windows_h_
#define SDL_config_h_

   #include "SDL_platform.h"


   #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)

      #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) || defined(__clang__)

         #define HAVE_STDINT_H   1

      #elif defined(_MSC_VER)

         #warning Compiling for Visual Studio

         typedef signed __int8 int8_t;
         typedef unsigned __int8 uint8_t;
         typedef signed __int16 int16_t;
         typedef unsigned __int16 uint16_t;
         typedef signed __int32 int32_t;
         typedef unsigned __int32 uint32_t;
         typedef signed __int64 int64_t;
         typedef unsigned __int64 uint64_t;

         #ifndef _UINTPTR_T_DEFINED

            #ifdef  _WIN64
               typedef unsigned __int64 uintptr_t;
            #else
               typedef unsigned int uintptr_t;
            #endif

            #define _UINTPTR_T_DEFINED

         #endif

         /* Older Visual C++ headers don't have the Win64-compatible typedefs... */
         #if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
            #define DWORD_PTR DWORD
         #endif

         #if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
            #define LONG_PTR LONG
         #endif

      #else /* !__GNUC__ && !_MSC_VER */

         #warning Compiling for Unknown

         typedef signed char int8_t;
         typedef unsigned char uint8_t;
         typedef signed short int16_t;
         typedef unsigned short uint16_t;
         typedef signed int int32_t;
         typedef unsigned int uint32_t;
         typedef signed long long int64_t;
         typedef unsigned long long uint64_t;

         #ifndef _SIZE_T_DEFINED_
            #define _SIZE_T_DEFINED_
            typedef unsigned int size_t;
         #endif

         typedef unsigned int uintptr_t;

      #endif /* __GNUC__ || _MSC_VER */

   #endif /* !_STDINT_H_ && !HAVE_STDINT_H */


   #ifdef _WIN64

      #warning Building for 64 bit platform
      #define SIZEOF_VOIDP 8

   #else

      #define SIZEOF_VOIDP 4

   #endif


   #define HAVE_DDRAW_H 1

   #define HAVE_DINPUT_H 1

   #define HAVE_DSOUND_H 1

   #define HAVE_DXGI_H 1

   #define HAVE_XINPUT_H 1

   #define HAVE_MMDEVICEAPI_H 1

   #define HAVE_AUDIOCLIENT_H 1

   #define HAVE_SENSORSAPI_H 1


   #if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)

      #define HAVE_IMMINTRIN_H 1

   #elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))

      #if __has_include(<immintrin.h>)

         /* ALESSANDRO: It has it */
         #define HAVE_IMMINTRIN_H 1

      #endif

   #endif

   /* This is disabled by default to avoid C runtime dependencies and manifest requirements */

   #ifdef HAVE_LIBC

      /* Useful headers */
      #define STDC_HEADERS 1
      #define HAVE_CTYPE_H 1
      #define HAVE_FLOAT_H 1
      #define HAVE_LIMITS_H 1
      #define HAVE_MATH_H 1
      #define HAVE_SIGNAL_H 1
      #define HAVE_STDIO_H 1
      #define HAVE_STRING_H 1

      /* C library functions */
      #define HAVE_MALLOC 1
      #define HAVE_CALLOC 1
      #define HAVE_REALLOC 1
      #define HAVE_FREE 1
      #define HAVE_ALLOCA 1
      #define HAVE_QSORT 1
      #define HAVE_ABS 1
      #define HAVE_MEMSET 1
      #define HAVE_MEMCPY 1
      #define HAVE_MEMMOVE 1
      #define HAVE_MEMCMP 1
      #define HAVE_STRLEN 1
      #define HAVE__STRREV 1
      /* These functions have security warnings, so we won't use them */
      /* #undef HAVE__STRUPR */
      /* #undef HAVE__STRLWR */
      #define HAVE_STRCHR 1
      #define HAVE_STRRCHR 1
      #define HAVE_STRSTR 1
      /* #undef HAVE_STRTOK_R */
      /* These functions have security warnings, so we won't use them */
      /* #undef HAVE__LTOA */
      /* #undef HAVE__ULTOA */
      #define HAVE_STRTOL 1
      #define HAVE_STRTOUL 1
      #define HAVE_STRTOD 1
      #define HAVE_ATOI 1
      #define HAVE_ATOF 1
      #define HAVE_STRCMP 1
      #define HAVE_STRNCMP 1
      #define HAVE__STRICMP 1
      #define HAVE__STRNICMP 1
      #define HAVE__WCSICMP 1
      #define HAVE__WCSNICMP 1
      #define HAVE__WCSDUP 1
      #define HAVE_ACOS   1
      #define HAVE_ACOSF  1
      #define HAVE_ASIN   1
      #define HAVE_ASINF  1
      #define HAVE_ATAN   1
      #define HAVE_ATANF  1
      #define HAVE_ATAN2  1
      #define HAVE_ATAN2F 1
      #define HAVE_CEILF  1
      #define HAVE__COPYSIGN 1
      #define HAVE_COS    1
      #define HAVE_COSF   1
      #define HAVE_EXP    1
      #define HAVE_EXPF   1
      #define HAVE_FABS   1
      #define HAVE_FABSF  1
      #define HAVE_FLOOR  1
      #define HAVE_FLOORF 1
      #define HAVE_FMOD   1
      #define HAVE_FMODF  1
      #define HAVE_LOG    1
      #define HAVE_LOGF   1
      #define HAVE_LOG10  1
      #define HAVE_LOG10F 1
      #define HAVE_POW    1
      #define HAVE_POWF   1
      #define HAVE_SIN    1
      #define HAVE_SINF   1
      #define HAVE_SQRT   1
      #define HAVE_SQRTF  1
      #define HAVE_TAN    1
      #define HAVE_TANF   1

      #if defined(_MSC_VER)

         /* These functions were added with the VC++ 2013 C runtime library */
         #if _MSC_VER >= 1800
            #define HAVE_STRTOLL 1
            #define HAVE_STRTOULL 1
            #define HAVE_VSSCANF 1
            #define HAVE_LROUND 1
            #define HAVE_LROUNDF 1
            #define HAVE_ROUND 1
            #define HAVE_ROUNDF 1
            #define HAVE_SCALBN 1
            #define HAVE_SCALBNF 1
            #define HAVE_TRUNC  1
            #define HAVE_TRUNCF 1
         #endif

         /* This function is available with at least the VC++ 2008 C runtime library */
         #if _MSC_VER >= 1400
            #define HAVE__FSEEKI64 1
         #endif

      #endif

      #if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
         #define HAVE_M_PI 1
      #endif

   #else

      #define HAVE_STDARG_H   1
      #define HAVE_STDDEF_H   1

   #endif


   /* Check to see if we have Windows 10 build environment */

   #if defined(_MSC_VER) && (_MSC_VER >= 1911) /* Visual Studio 15.3 */

      #include <sdkddkver.h>

      #if _WIN32_WINNT >= 0x0601  /* Windows 7 */
         #define SDL_WINDOWS7_SDK
      #endif

      #if _WIN32_WINNT >= 0x0602  /* Windows 8 */
         #define SDL_WINDOWS8_SDK
      #endif

      #if _WIN32_WINNT >= 0x0A00  /* Windows 10 */
         #define SDL_WINDOWS10_SDK
      #endif

   #endif


/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : AUDIO DRIVER                                        */
/* ------------------------------------------------------------------------- */
//
   #define SDL_AUDIO_DRIVER_WASAPI 1
//
//   #define SDL_AUDIO_DRIVER_DSOUND 1
//
//   #define SDL_AUDIO_DRIVER_WINMM  1
//
//   #define SDL_AUDIO_DRIVER_DISK   1
//
//   #define SDL_AUDIO_DRIVER_DUMMY  1
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : INPUT DEVICE                                        */
/* ------------------------------------------------------------------------- */
//
//   #define SDL_JOYSTICK_DINPUT 1
//
//   #define SDL_JOYSTICK_HIDAPI 1
//
//   #ifndef __WINRT__
//   #define SDL_JOYSTICK_RAWINPUT   1
//   #endif
//
//   #define SDL_JOYSTICK_VIRTUAL    1
//
//   #ifdef SDL_WINDOWS10_SDK
//   #define SDL_JOYSTICK_WGI    1
//   #endif
//
//   #define SDL_JOYSTICK_XINPUT 1
//
   #define SDL_HAPTIC_DINPUT   1
//
//   #define SDL_HAPTIC_XINPUT   1
//
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : SESNOR                                              */
/* ------------------------------------------------------------------------- */
//
//   #define SDL_SENSOR_WINDOWS  1
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : OBJECT LOADING                                      */
/* ------------------------------------------------------------------------- */
//
   #define SDL_LOADSO_WINDOWS  1
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : MULTITHREADING                                      */
/* ------------------------------------------------------------------------- */
//
//   #define SDL_THREAD_GENERIC_COND_SUFFIX 1
   #define SDL_THREAD_WINDOWS  1
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : TIMER                                               */
/* ------------------------------------------------------------------------- */
//
//   #define SDL_TIMER_WINDOWS   1
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : VIDEO DRIVER                                        */
/* ------------------------------------------------------------------------- */
//
//   #define SDL_VIDEO_DRIVER_DUMMY  1
   #define SDL_VIDEO_DRIVER_WINDOWS    1
//
//   #ifndef SDL_VIDEO_RENDER_D3D
//   #define SDL_VIDEO_RENDER_D3D    1
//   #endif
//
//   #ifdef SDL_WINDOWS7_SDK
//   #define SDL_VIDEO_RENDER_D3D11  1
//   #endif
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : OPENGL SUPPORT                                      */
/* ------------------------------------------------------------------------- */
//
//   #ifndef SDL_VIDEO_OPENGL
//   #define SDL_VIDEO_OPENGL    1
//   #endif
//
//   #ifndef SDL_VIDEO_OPENGL_WGL
//   #define SDL_VIDEO_OPENGL_WGL    1
//   #endif
//
//   #ifndef SDL_VIDEO_RENDER_OGL
//   #define SDL_VIDEO_RENDER_OGL    1
//   #endif
//
//   #ifndef SDL_VIDEO_RENDER_OGL_ES2
//   #define SDL_VIDEO_RENDER_OGL_ES2    1
//   #endif
//
//   #ifndef SDL_VIDEO_OPENGL_ES2
//   #define SDL_VIDEO_OPENGL_ES2    1
//   #endif
//
//   #ifndef SDL_VIDEO_OPENGL_EGL
//   #define SDL_VIDEO_OPENGL_EGL    1
//   #endif
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : VULKAN SUPPORT                                      */
/* ------------------------------------------------------------------------- */
//
//   #define SDL_VIDEO_VULKAN 1
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : SYSTEM POWER SUPPORT                                */
/* ------------------------------------------------------------------------- */
//
//   #define SDL_POWER_WINDOWS 1
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : FILESYSTEM SUPPORT                                  */
/* ------------------------------------------------------------------------- */
//
//   #define SDL_FILESYSTEM_WINDOWS  1
//
/* ------------------------------------------------------------------------- */
/* SELECT SDL FEATURES : ASSEMBLY ROUTINES                                   */
/* ------------------------------------------------------------------------- */
//
//   #ifndef _WIN64
//   #define SDL_ASSEMBLY_ROUTINES   1
//   #endif
//

#endif /* SDL_config_windows_h_ */

/* vi: set ts=4 sw=4 expandtab: */

Errors during link stage:


missing: `SDL_main'

missing: `SDL_Delay_REAL'
missing: `SDL_GetTicks_REAL'
missing: `SDL_Has3DNow_REAL'
missing: `SDL_HasARMSIMD_REAL'
missing: `SDL_HasAVX_REAL'
missing: `SDL_HasAltiVec_REAL'
missing: `SDL_HasMMX_REAL'
missing: `SDL_HasSSE2_REAL'
missing: `SDL_HasSSE_REAL'
missing: `SDL_LoadFunction_REAL'
missing: `SDL_LoadObject_REAL'
missing: `SDL_SIMDAlloc_REAL'
missing: `SDL_SIMDFree_REAL'
missing: `SDL_UnloadObject_REAL'

missing: `SDL_SetMainReady'
missing: `SDL_ShowSimpleMessageBox'
missing: `SDL_free'
missing: `SDL_iconv_string'
missing: `SDL_strlen'
missing: `SDL_wcslen'

missing: `yuv420_abgr_std'
missing: `yuv420_argb_std'
missing: `yuv420_bgra_std'
missing: `yuv420_rgb24_std'
missing: `yuv420_rgb565_std'
missing: `yuv420_rgba_std'
missing: `yuv422_abgr_std'
missing: `yuv422_argb_std'
missing: `yuv422_bgra_std'
missing: `yuv422_rgb24_std'
missing: `yuv422_rgb565_std'
missing: `yuv422_rgba_std'
missing: `yuvnv12_abgr_std'
missing: `yuvnv12_argb_std'
missing: `yuvnv12_bgra_std'
missing: `yuvnv12_rgb24_std'
missing: `yuvnv12_rgb565_std'
missing: `yuvnv12_rgba_std'

Some files are missing from the compile list, so i expect some missing functions; however i don’t understand where some are implemented. An an examlpe would be `yuv420_abgr_std’, where is this function? Can’t even find any definition of this function online.

I also am having difficulties understanding dynamic api: I understand it’s usefulness thanks to the doc folder and i understand that there is an OFF switch in SDL_dynapi.h (that didn’t work for me). Since most of the missing functions have _REAL suffix, is there something i’m missing with DYNAPI? Should something be defined at compile time for DYNAPI to work?

Hope this is intresting or at least useful to someone :slight_smile:

1 Like

Built and uploaded scripts to github :slight_smile:

1 Like