This SConstruct file can be used as a simple template to build a SDL application in Windows. Uses MinWG and will need to be customized slightly to work with other compilers like Visual Studio's compiler.
This example includes a windows resource which links the executable to a .ico file and it uses the -mwindows flag so no annoying dialog window will appear when the application is started.
1 # SCons SConstruct file to build a typical SDL application on Windows with a windows icon using mingw
2
3 env = Environment(ENV=os.environ)
4 Tool('mingw')(env)
5
6 build_filename = 'appname' # Will automatically add .exe extension
7 sources = [Glob('src/*.cpp'), env.RES('appname.rc')] #Add window resource to include .ico file
8 libraries = ['mingw32', 'SDLmain', 'SDL', 'SDL_mixer', 'SDL_image', 'SDL_ttf']
9 library_paths = ['/MinGW/lib']
10
11 env.MergeFlags('-mwindows') # Parse the -mwindows flag to remove the annoying console window
12 env.Program(target = build_filename, source = sources, LIBS = libraries, LIBPATH = library_paths)
appname.rc:
A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "appname.ico"
