When static linking, how do we use the #defines to reduce footprint? ‭(SDL_LEAN_AND_MEAN)

I notice in the very latest source code that a few #defines have been added to reduce footprint for static builds. One is SDL_VIDEO_RENDER_SW, which I’m excited about. Excluding the software renderer for Android builds will help reduce the APK size.

Two questions:

How do we use them? I’m a bit ignorant to how this works. I added -USDL_VIDEO_RENDER_SW to ‘APP_CFLAGS’, but it didn’t seem to work.

Are there more defines like this? How can we find out what they are and what they do?

Thanks in advance :slight_smile:

1 Like

This is recent and may change.
Currently, you need need to manually edit the file and replace ‘1’ by ‘0’, so that modules gets compiled out.
In order to see a real change in size, you need to statically link to SDL2 library, so that the linker prune every unused function in the end.

RENDER_SW is some part of the renderer software, not used elsewhere. (mostly blend_line/point function).
BLIT_0/1/N/A/AUTO are the software blitting function which are also shared with the software rendered, but which can be used while using the Blit surface functions.
RLE is some run-lenght-encoding function.
YUV is for the YUV Blit functions
Some doc added: https://hg.libsdl.org/SDL/rev/fe0c632448f0

Hope it helps

1 Like

I’ve just tried the recently added #define SDL_LEAN_AND_MEAN and it works really well! on Android. I’m very pleased with this feature, thank you for adding it.

arm64-v8a libs ‭298,056‬ bytes smaller!
armeabi-v7a libs ‭260,680‬ bytes smaller!

1 Like