add dist target to SConstruct

This commit is contained in:
Josh Holtrop 2011-05-17 15:33:23 -04:00
parent 45ebca0650
commit cf3a986b49

View File

@ -1,4 +1,3 @@
# vim:filetype=python
import os
@ -8,6 +7,7 @@ from subprocess import *
target = 'anaglym'
DEBUG = False
Default(target)
if 'install_dir' in os.environ:
install_dir = os.environ['install_dir']
else:
@ -33,10 +33,9 @@ if platform == 'PLATFORM_LINUX':
env.Append(CPPFLAGS = ['-D'+platform, '-I.'])
env.Append(LIBS = ['SDL_image', 'SDL_sound', 'vorbisfile'])
cflags = ['-O2', '-Wall']
env.Append(CCFLAGS = ['-O2', '-Wall'])
if DEBUG:
cflags += ['-g']
env.Append(CFLAGS = cflags, CXXFLAGS = cflags)
env.Append(CCFLAGS = ['-g'])
sources = [Glob('*.cc')]
if not os.path.exists('ag_lua.cc'):
@ -71,9 +70,30 @@ def F2C(target, source, env):
def SDLKeymap(target, source, env):
Popen(['perl', str(source[0])]).wait()
def bt(cmd):
return Popen(cmd, shell = True, stdout = PIPE).communicate()[0]
env.Append(BUILDERS = {'SDLKeymap' : Builder(action = SDLKeymap)})
env.Append(BUILDERS = {'F2C' : Builder(action = F2C)})
env.F2C('ag_lua.cc', 'ag.lua')
env.SDLKeymap('sdl_keymap.cc', 'gen-sdl-keymap.pl')
env.Program(target, sources)
env.Install('dist', target)
env.Install('dist', 'lib')
env.Install('dist', 'doc')
if platform == 'PLATFORM_WINDOWS':
env.Install('dist', bt('which SDL.dll'))
env.Install('dist', bt('which SDL.dll'))
env.Install('dist', bt('which SDL_image.dll'))
env.Install('dist', bt('which jpeg.dll'))
env.Install('dist', bt('which libpng12-0.dll'))
env.Install('dist', bt('which zlib1.dll'))
env.Install('dist', bt('which libtiff-3.dll'))
env.Install('dist', bt('which libftgl-2.dll'))
env.Install('dist', bt('which lua5.1.dll'))
env.Install('dist', bt('which freetype6.dll'))
env.Install('dist', bt('which libogg-0.dll'))
env.Install('dist', bt('which libvorbis-0.dll'))
env.Install('dist', bt('which libvorbisfile-3.dll'))