fix compile against newer giflib
[rofl0r-obeditor.git] / SConstruct
blob4abfad2389f3d03133759e2a3b87cb64a81e204f
1 #!/usr/bin/env python
2 # Author: Bryan Cain
3 # Date: March 12, 2011
5 import os, sys, platform
6 from scons import wxconfig
8 def error(msg):
9 sys.stderr.write('Error: %s\n' % msg)
10 sys.exit(1)
12 env = Environment(ENV = os.environ)
13 conf = Configure(env, custom_tests = {'CheckWXConfig': wxconfig.CheckWXConfig})
15 # check for SDL
16 if not conf.CheckLib('SDL'):
17 error('SDL not found')
18 if not conf.CheckLib('SDL_mixer'):
19 error('SDL_mixer not found')
20 env.ParseConfig('sdl-config --cflags --libs')
21 env['LIBS'] += ['SDL_mixer']
23 # check for wxWidgets 2.8.9
24 if not conf.CheckWXConfig(2.89, ['adv', 'core', 'base']):
25 error('wxWidgets (>= 2.8.9) not found')
26 wxconfig.ParseWXConfig(env)
28 # check for libgif
29 if not conf.CheckLib('gif'):
30 error('libgif not found')
31 env['LIBS'] += ['gif']
33 # set compile flags
34 env['CCFLAGS'] += ['-g', '-O2', '-DPACKAGE_VERSION=\\"1.5\\"', '-DPACKAGE_STRING=\\"obeditor\\ 1.5\\"']
35 if env['PLATFORM'] == 'win32':
36 env['CCFLAGS'] += ['-DOSWINDOW']
37 elif env['PLATFORM'] == 'posix':
38 env['CCFLAGS'] += ['-DOSLINUX']
39 else:
40 error('unknown platform')
42 # make the output prettier
43 env['CCCOMSTR'] = 'Compiling $SOURCE'
44 env['CXXCOMSTR'] = 'Compiling $SOURCE'
45 env['LINKCOMSTR'] = 'Linking $TARGET'
47 # build
48 env = conf.Finish()
49 Export('env')
50 SConscript('src/SConscript')
52 # move to "release" directory
53 os.system('rm -rf release')
54 os.mkdir('release')
55 env.Command('release/obeditor', 'src/obeditor', [Move('release/obeditor', 'src/obeditor')])
56 env.Command('release/resources', 'resources', [Copy('release/resources', 'resources')])