Sunday, September 5

Building the SDL with SCons

Just as easy, another SConstruct in the root directory. Not SCons best practice, but certianly the simplest way and all that's needed for such relatively small (compared to say, the Linux Kernel) projects.

Note that I'm building static libraries - this is because the toolkit doesn't support the DLL versions of the C/C++ runtime libraries.


#
# Sconstruct file for SDL-1.2.7.
#
import sys

#
# microsoft tool kit environment
#
env = Environment(tools = [ 'mstoolkit' ])

#
# debug or release
#
project_config = ARGUMENTS.get('config', 'debug')
project_stdio = ARGUMENTS.get('stdio', 'yes' )

if not project_config in [ 'debug', 'release' ]:
print 'Invalid configuration - should be release or debug'
sys.exit(1)

if not project_stdio in [ 'yes', 'no' ]:
print 'Invalid stdio - must be yes or no'
sys.exit(1)

if project_config == 'debug':
library_names = [ "SDLd.lib", 'SDL_maind.lib' ]
env['CPPDEFINES'] = [ '_DEBUG', 'WIN32', '_WINDOWS', 'ENABLE_WINDIB', 'ENABLE_DIRECTX', '_WIN32_WINNT=0x0400' ]
env['CCFLAGS'] = [ '/nologo', '/W3', '/Zi', '/Od', '/MTd' ]
project_stdio = 'no'

if project_config == 'release':
library_names = [ "SDL.lib", 'SDL_main.lib' ]
env['CPPDEFINES'] = [ 'NDEBUG', 'WIN32', '_WINDOWS', 'ENABLE_WINDIB', 'ENABLE_DIRECTX', '_WIN32_WINNT=0x0400' ]
if project_stdio == 'no':
env['CPPDEFINES'] = env['CPPDEFINES'] + [ 'NO_STDIO_REDIRECT' ]
env['CCFLAGS'] = [ '/nologo', '/W3', '/GF', '/MT', '/G7', '/Ox', '/arch:SSE2', '/Gy' ]


env['CPPPATH'] = [ r'#\src', r'#\src\audio', r'#\src\video', r'src\video\wincommon', r'#\src\video\windx5',
r'#\src\events', r'#\src\joystick', r'#\src\cdrom', r'#\src\thread', r'#\src\thread\win32',
r'#\src\timer', r'#\include', r'#\include\SDL']

env.StaticLibrary( library_names[0], [
r"#\Src\SDL.c",
r"#\Src\Video\SDL_RLEaccel.c",
r"#\Src\Events\SDL_active.c",
r"#\Src\Audio\SDL_audio.c",
r"#\Src\Audio\SDL_audiocvt.c",
r"#\Src\Audio\SDL_audiomem.c",
r"#\Src\Video\SDL_blit.c",
r"#\Src\Video\SDL_blit_0.c",
r"#\Src\Video\SDL_blit_1.c",
r"#\Src\Video\SDL_blit_A.c",
r"#\Src\Video\SDL_blit_N.c",
r"#\Src\Video\SDL_bmp.c",
r"#\Src\Cdrom\SDL_cdrom.c",
r"#\Src\Cpuinfo\SDL_cpuinfo.c",
r"#\Src\Video\SDL_cursor.c",
r"#\src\audio\windib\SDL_dibaudio.c",
r"#\Src\Video\Windib\SDL_dibevents.c",
r"#\Src\Video\Windib\SDL_dibvideo.c",
r"#\src\audio\windx5\SDL_dx5audio.c",
r"#\Src\Video\Windx5\SDL_dx5events.c",
r"#\Src\Video\Windx5\SDL_dx5video.c",
r"#\src\video\windx5\SDL_dx5yuv.c",
r"#\Src\Endian\SDL_endian.c",
r"#\Src\SDL_error.c",
r"#\Src\Events\SDL_events.c",
r"#\Src\Events\SDL_expose.c",
r"#\Src\SDL_fatal.c",
r"#\src\video\SDL_gamma.c",
r"#\src\joystick\SDL_joystick.c",
r"#\Src\Events\SDL_keyboard.c",
r"#\Src\Audio\SDL_mixer.c",
r"#\src\joystick\win32\SDL_mmjoystick.c",
r"#\Src\Events\SDL_mouse.c",
r"#\Src\Video\SDL_pixels.c",
r"#\Src\Events\SDL_quit.c",
r"#\src\events\SDL_resize.c",
r"#\Src\File\SDL_rwops.c",
r"#\Src\Video\SDL_surface.c",
r"#\Src\Cdrom\Win32\SDL_syscdrom.c",
r"#\src\thread\generic\SDL_syscond.c",
r"#\Src\Video\wincommon\SDL_sysevents.c",
r"#\Src\Video\wincommon\SDL_sysmouse.c",
r"#\src\thread\win32\SDL_sysmutex.c",
r"#\src\thread\win32\SDL_syssem.c",
r"#\Src\Thread\Win32\SDL_systhread.c",
r"#\src\timer\win32\SDL_systimer.c",
r"#\Src\Video\wincommon\SDL_syswm.c",
r"#\Src\Thread\SDL_thread.c",
r"#\src\timer\SDL_timer.c",
r"#\Src\Video\SDL_video.c",
r"#\Src\Audio\SDL_wave.c",
r"#\src\video\wincommon\SDL_wingl.c",
r"#\src\video\SDL_yuv.c",
r"#\src\video\SDL_yuv_sw.c",
r"#\src\video\SDL_stretch.c" ] )

env.StaticLibrary(library_names[1], [ r"#\src\Main\Win32\SDL_win32_main.c" ])



No comments: