Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to webmaster@scons.org. Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).

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"

SDLWindowsApp (last edited 2013-08-28 20:46:10 by WilliamDeegan)