From cf3a986b4921115297af8a30b335a9acb779c08d Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 17 May 2011 15:33:23 -0400 Subject: [PATCH] add dist target to SConstruct --- SConstruct | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index b72e6ac..f9050f7 100644 --- a/SConstruct +++ b/SConstruct @@ -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'))