I have a program that is statically linked for Linux so users don’t need to
have SDL installed on their machines. For Windows, I dynamically link and
provide SDL.dll which is only about a quarter megabyte. However, libSDL.a
is
a whopping 2.28 megabytes (this is SDL version 1.2.9) and the entire thing
gets linked into the program.
First, if you are trying to minimize size, then on Linux you should compile
SDL (and your program, assuming C/C++) with a "minimize code size"
optimization flag, and without debug information. On GCC, those are “-Os”
(minimize size) and “-g0” (disable debug).
I don’t need sound or networking, just basic graphics. How can I build a
custom libSDL.a that only contains the functionality I need and can be
linked
from the project directory so it doesn’t replace the standard libSDL.a?
It looks like the compile-time defines:
SDL_VIDEO_DISABLED
SDL_AUDIO_DISABLED
SDL_TIMERS_DISABLED
SDL_JOYSTICK_DISABLED
SDL_JOYSTICK_DISABLED
control what modules are built. I’d use Nikos’ suggestions of doing
"./configure --help" to get the “proper” way to set these. If you don’t mind
do a bit of manual effort, you can rename the resulting static link library
to something special like “libSDLcustom.a” and store it in some directory
relative to your project root. For example, if you had your directory like:
myfile.c
SDLstuff/libSDLcustom.a
You might do:
gcc myfile.c -LSDLstuff/ -lSDLcustom
The -L part adds the directory “SDLstuff” to the linker search path for
libraries. The last -l tells the linker to look for libSDLcustom.a, which of
course, will only be found inside of the “SDLstuff” folder.
Also, since I’ve been unable to get anything to work on Mac OSX, I’dOn Fri, May 6, 2011 at 6:56 AM, Jeff Post <j_post at pacbell.net> wrote:
appreciate it if someone were to volunteer to compile the program for Macs.
The program computes and plots linear regression for statistics students.
Thanks,
Jeff
SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org