2006-12-19 02:25:50 +00:00
|
|
|
#SConstruct
|
|
|
|
|
|
|
|
# needed imports
|
|
|
|
import sys
|
|
|
|
import os
|
2007-05-22 01:20:06 +00:00
|
|
|
import SCons.Util
|
2006-12-19 02:25:50 +00:00
|
|
|
|
|
|
|
PROGRAM_NAME = 'D2X-Rebirth'
|
2011-01-03 10:42:53 +00:00
|
|
|
target = 'd2x-rebirth'
|
2006-12-19 02:25:50 +00:00
|
|
|
|
|
|
|
# version number
|
|
|
|
D2XMAJOR = 0
|
2011-05-07 00:51:21 +00:00
|
|
|
D2XMINOR = 57
|
2011-11-02 00:04:42 +00:00
|
|
|
D2XMICRO = 2
|
2010-02-23 15:05:50 +00:00
|
|
|
VERSION_STRING = ' v' + str(D2XMAJOR) + '.' + str(D2XMINOR) + '.' + str(D2XMICRO)
|
2006-12-19 02:25:50 +00:00
|
|
|
|
|
|
|
# installation path
|
2008-12-30 22:14:06 +00:00
|
|
|
PREFIX = str(ARGUMENTS.get('prefix', '/usr/local'))
|
|
|
|
BIN_SUBDIR = '/bin'
|
|
|
|
DATA_SUBDIR = '/share/games/d2x-rebirth'
|
2006-12-19 02:25:50 +00:00
|
|
|
BIN_DIR = PREFIX + BIN_SUBDIR
|
|
|
|
DATA_DIR = PREFIX + DATA_SUBDIR
|
|
|
|
|
|
|
|
# command-line parms
|
|
|
|
sharepath = str(ARGUMENTS.get('sharepath', DATA_DIR))
|
|
|
|
debug = int(ARGUMENTS.get('debug', 0))
|
|
|
|
profiler = int(ARGUMENTS.get('profiler', 0))
|
2011-01-03 10:42:53 +00:00
|
|
|
opengl = int(ARGUMENTS.get('opengl', 1))
|
2011-01-17 18:27:55 +00:00
|
|
|
opengles = int(ARGUMENTS.get('opengles', 0))
|
2007-08-28 00:01:25 +00:00
|
|
|
asm = int(ARGUMENTS.get('asm', 0))
|
2006-12-19 02:25:50 +00:00
|
|
|
editor = int(ARGUMENTS.get('editor', 0))
|
2011-01-03 10:42:53 +00:00
|
|
|
sdlmixer = int(ARGUMENTS.get('sdlmixer', 1))
|
2007-12-17 22:45:45 +00:00
|
|
|
ipv6 = int(ARGUMENTS.get('ipv6', 0))
|
2009-11-29 16:46:13 +00:00
|
|
|
use_udp = int(ARGUMENTS.get('use_udp', 1))
|
2011-04-05 00:24:34 +00:00
|
|
|
use_tracker = int(ARGUMENTS.get('use_tracker', 1))
|
2010-07-30 07:34:33 +00:00
|
|
|
verbosebuild = int(ARGUMENTS.get('verbosebuild', 0))
|
2009-11-29 16:46:13 +00:00
|
|
|
|
2011-01-03 10:42:53 +00:00
|
|
|
# endianess-checker
|
|
|
|
def checkEndian():
|
|
|
|
import struct
|
|
|
|
array = struct.pack('cccc', '\x01', '\x02', '\x03', '\x04')
|
|
|
|
i = struct.unpack('i', array)
|
|
|
|
if i == struct.unpack('<i', array):
|
|
|
|
return "little"
|
|
|
|
elif i == struct.unpack('>i', array):
|
|
|
|
return "big"
|
|
|
|
return "unknown"
|
|
|
|
|
|
|
|
|
2010-02-23 01:21:55 +00:00
|
|
|
print '\n===== ' + PROGRAM_NAME + VERSION_STRING + ' =====\n'
|
2006-12-19 02:25:50 +00:00
|
|
|
|
|
|
|
# general source files
|
|
|
|
common_sources = [
|
|
|
|
'2d/2dsline.c',
|
|
|
|
'2d/bitblt.c',
|
|
|
|
'2d/bitmap.c',
|
|
|
|
'2d/box.c',
|
|
|
|
'2d/canvas.c',
|
|
|
|
'2d/circle.c',
|
|
|
|
'2d/disc.c',
|
|
|
|
'2d/font.c',
|
|
|
|
'2d/gpixel.c',
|
|
|
|
'2d/line.c',
|
|
|
|
'2d/palette.c',
|
|
|
|
'2d/pcx.c',
|
|
|
|
'2d/pixel.c',
|
|
|
|
'2d/poly.c',
|
|
|
|
'2d/rect.c',
|
|
|
|
'2d/rle.c',
|
|
|
|
'2d/scalec.c',
|
|
|
|
'3d/clipper.c',
|
|
|
|
'3d/draw.c',
|
|
|
|
'3d/globvars.c',
|
|
|
|
'3d/instance.c',
|
|
|
|
'3d/interp.c',
|
|
|
|
'3d/matrix.c',
|
|
|
|
'3d/points.c',
|
|
|
|
'3d/rod.c',
|
|
|
|
'3d/setup.c',
|
|
|
|
'arch/sdl/event.c',
|
2008-11-14 16:56:40 +00:00
|
|
|
'arch/sdl/init.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'arch/sdl/joy.c',
|
|
|
|
'arch/sdl/key.c',
|
|
|
|
'arch/sdl/mouse.c',
|
|
|
|
'arch/sdl/rbaudio.c',
|
|
|
|
'arch/sdl/timer.c',
|
2009-05-21 12:16:39 +00:00
|
|
|
'arch/sdl/window.c',
|
2007-09-18 13:37:39 +00:00
|
|
|
'arch/sdl/digi.c',
|
|
|
|
'arch/sdl/digi_audio.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'iff/iff.c',
|
|
|
|
'libmve/decoder8.c',
|
|
|
|
'libmve/decoder16.c',
|
|
|
|
'libmve/mve_audio.c',
|
|
|
|
'libmve/mvelib.c',
|
|
|
|
'libmve/mveplay.c',
|
|
|
|
'main/ai.c',
|
|
|
|
'main/ai2.c',
|
|
|
|
'main/aipath.c',
|
|
|
|
'main/automap.c',
|
|
|
|
'main/bm.c',
|
|
|
|
'main/cntrlcen.c',
|
|
|
|
'main/collide.c',
|
|
|
|
'main/config.c',
|
|
|
|
'main/console.c',
|
|
|
|
'main/controls.c',
|
|
|
|
'main/credits.c',
|
2008-04-06 20:23:28 +00:00
|
|
|
'main/digiobj.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'main/dumpmine.c',
|
|
|
|
'main/effects.c',
|
|
|
|
'main/endlevel.c',
|
|
|
|
'main/escort.c',
|
|
|
|
'main/fireball.c',
|
|
|
|
'main/fuelcen.c',
|
|
|
|
'main/fvi.c',
|
|
|
|
'main/game.c',
|
|
|
|
'main/gamecntl.c',
|
|
|
|
'main/gamefont.c',
|
|
|
|
'main/gamemine.c',
|
|
|
|
'main/gamepal.c',
|
|
|
|
'main/gamerend.c',
|
|
|
|
'main/gamesave.c',
|
|
|
|
'main/gameseg.c',
|
|
|
|
'main/gameseq.c',
|
|
|
|
'main/gauges.c',
|
|
|
|
'main/hostage.c',
|
|
|
|
'main/hud.c',
|
|
|
|
'main/inferno.c',
|
|
|
|
'main/kconfig.c',
|
|
|
|
'main/kmatrix.c',
|
|
|
|
'main/laser.c',
|
|
|
|
'main/lighting.c',
|
|
|
|
'main/menu.c',
|
|
|
|
'main/mglobal.c',
|
|
|
|
'main/mission.c',
|
|
|
|
'main/morph.c',
|
|
|
|
'main/movie.c',
|
|
|
|
'main/multi.c',
|
|
|
|
'main/multibot.c',
|
|
|
|
'main/newdemo.c',
|
|
|
|
'main/newmenu.c',
|
|
|
|
'main/object.c',
|
|
|
|
'main/paging.c',
|
|
|
|
'main/physics.c',
|
|
|
|
'main/piggy.c',
|
|
|
|
'main/player.c',
|
|
|
|
'main/playsave.c',
|
|
|
|
'main/polyobj.c',
|
|
|
|
'main/powerup.c',
|
|
|
|
'main/render.c',
|
|
|
|
'main/robot.c',
|
|
|
|
'main/scores.c',
|
|
|
|
'main/segment.c',
|
|
|
|
'main/slew.c',
|
|
|
|
'main/songs.c',
|
|
|
|
'main/state.c',
|
|
|
|
'main/switch.c',
|
|
|
|
'main/terrain.c',
|
|
|
|
'main/texmerge.c',
|
|
|
|
'main/text.c',
|
|
|
|
'main/titles.c',
|
|
|
|
'main/vclip.c',
|
|
|
|
'main/wall.c',
|
|
|
|
'main/weapon.c',
|
2011-01-19 20:35:14 +00:00
|
|
|
'maths/fixc.c',
|
|
|
|
'maths/rand.c',
|
|
|
|
'maths/tables.c',
|
|
|
|
'maths/vecmat.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'mem/mem.c',
|
|
|
|
'misc/args.c',
|
2007-09-18 13:37:39 +00:00
|
|
|
'misc/dl_list.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'misc/error.c',
|
|
|
|
'misc/hash.c',
|
2010-07-18 20:28:15 +00:00
|
|
|
'misc/hmp.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'misc/ignorecase.c',
|
|
|
|
'misc/physfsrwops.c',
|
2010-08-09 14:04:22 +00:00
|
|
|
'misc/physfsx.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'misc/strio.c',
|
|
|
|
'misc/strutil.c',
|
|
|
|
'texmap/ntmap.c',
|
2007-12-17 22:45:45 +00:00
|
|
|
'texmap/scanline.c'
|
2006-12-19 02:25:50 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
# for editor
|
|
|
|
editor_sources = [
|
2010-12-28 03:21:43 +00:00
|
|
|
'editor/centers.c',
|
|
|
|
'editor/curves.c',
|
|
|
|
'editor/autosave.c',
|
|
|
|
'editor/eglobal.c',
|
|
|
|
'editor/ehostage.c',
|
|
|
|
'editor/elight.c',
|
|
|
|
'editor/eobject.c',
|
|
|
|
'editor/eswitch.c',
|
|
|
|
'editor/fixseg.c',
|
|
|
|
'editor/func.c',
|
|
|
|
'editor/group.c',
|
|
|
|
'editor/info.c',
|
|
|
|
'editor/kbuild.c',
|
|
|
|
'editor/kcurve.c',
|
|
|
|
'editor/kfuncs.c',
|
|
|
|
'editor/kgame.c',
|
|
|
|
'editor/khelp.c',
|
|
|
|
'editor/kmine.c',
|
|
|
|
'editor/ksegmove.c',
|
|
|
|
'editor/ksegsel.c',
|
|
|
|
'editor/ksegsize.c',
|
|
|
|
'editor/ktmap.c',
|
|
|
|
'editor/kview.c',
|
|
|
|
'editor/med.c',
|
|
|
|
'editor/meddraw.c',
|
|
|
|
'editor/medmisc.c',
|
|
|
|
'editor/medrobot.c',
|
|
|
|
'editor/medsel.c',
|
|
|
|
'editor/medwall.c',
|
|
|
|
'editor/mine.c',
|
|
|
|
'editor/objpage.c',
|
|
|
|
'editor/segment.c',
|
|
|
|
'editor/seguvs.c',
|
|
|
|
'editor/texpage.c',
|
|
|
|
'editor/texture.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'main/bmread.c',
|
|
|
|
'ui/button.c',
|
|
|
|
'ui/checkbox.c',
|
2011-01-17 14:42:18 +00:00
|
|
|
'ui/dialog.c',
|
2006-12-19 02:25:50 +00:00
|
|
|
'ui/file.c',
|
|
|
|
'ui/gadget.c',
|
|
|
|
'ui/icon.c',
|
|
|
|
'ui/inputbox.c',
|
|
|
|
'ui/keypad.c',
|
|
|
|
'ui/keypress.c',
|
|
|
|
'ui/keytrap.c',
|
|
|
|
'ui/listbox.c',
|
|
|
|
'ui/menu.c',
|
|
|
|
'ui/menubar.c',
|
|
|
|
'ui/message.c',
|
|
|
|
'ui/popup.c',
|
|
|
|
'ui/radio.c',
|
|
|
|
'ui/scroll.c',
|
|
|
|
'ui/ui.c',
|
|
|
|
'ui/uidraw.c',
|
2011-01-17 14:42:18 +00:00
|
|
|
'ui/userbox.c'
|
2006-12-19 02:25:50 +00:00
|
|
|
]
|
|
|
|
|
2007-09-18 13:37:39 +00:00
|
|
|
# SDL_mixer sound implementation
|
|
|
|
arch_sdlmixer = [
|
|
|
|
'arch/sdl/digi_mixer.c',
|
2008-01-02 15:36:51 +00:00
|
|
|
'arch/sdl/digi_mixer_music.c',
|
2007-09-18 13:37:39 +00:00
|
|
|
'arch/sdl/jukebox.c'
|
2009-11-29 16:46:13 +00:00
|
|
|
]
|
2007-04-25 02:39:10 +00:00
|
|
|
|
2006-12-19 02:25:50 +00:00
|
|
|
# for opengl
|
|
|
|
arch_ogl_sources = [
|
|
|
|
'arch/ogl/gr.c',
|
|
|
|
'arch/ogl/ogl.c',
|
|
|
|
]
|
|
|
|
|
2011-01-03 10:42:53 +00:00
|
|
|
# for non-ogl
|
2006-12-19 02:25:50 +00:00
|
|
|
arch_sdl_sources = [
|
|
|
|
'arch/sdl/gr.c',
|
|
|
|
'texmap/tmapflat.c'
|
|
|
|
]
|
|
|
|
|
|
|
|
# assembler related
|
|
|
|
asm_sources = [
|
|
|
|
'texmap/tmap_ll.asm',
|
|
|
|
'texmap/tmap_flt.asm',
|
|
|
|
'texmap/tmapfade.asm',
|
|
|
|
'texmap/tmap_lin.asm',
|
|
|
|
'texmap/tmap_per.asm'
|
|
|
|
]
|
|
|
|
|
2008-10-28 17:58:54 +00:00
|
|
|
# Acquire environment object...
|
2006-12-19 02:25:50 +00:00
|
|
|
env = Environment(ENV = os.environ)
|
2008-10-28 17:58:54 +00:00
|
|
|
|
|
|
|
# Prettier build messages......
|
2010-07-30 07:34:33 +00:00
|
|
|
if (verbosebuild == 0):
|
|
|
|
env["CCCOMSTR"] = "Compiling $SOURCE ..."
|
|
|
|
env["CXXCOMSTR"] = "Compiling $SOURCE ..."
|
|
|
|
env["LINKCOMSTR"] = "Linking $TARGET ..."
|
|
|
|
env["ARCOMSTR"] = "Archiving $TARGET ..."
|
|
|
|
env["RANLIBCOMSTR"] = "Indexing $TARGET ..."
|
2008-10-28 17:58:54 +00:00
|
|
|
|
|
|
|
# flags and stuff for all platforms
|
2008-04-06 20:23:28 +00:00
|
|
|
env.Append(CPPFLAGS = ['-Wall', '-funsigned-char'])
|
2010-02-23 15:05:50 +00:00
|
|
|
env.Append(CPPDEFINES = [('PROGRAM_NAME', '\\"' + str(PROGRAM_NAME) + '\\"'), ('D2XMAJOR', '\\"' + str(D2XMAJOR) + '\\"'), ('D2XMINOR', '\\"' + str(D2XMINOR) + '\\"'), ('D2XMICRO', '\\"' + str(D2XMICRO) + '\\"')])
|
2009-11-29 16:46:13 +00:00
|
|
|
env.Append(CPPDEFINES = ['NETWORK', '_REENTRANT'])
|
2006-12-19 02:25:50 +00:00
|
|
|
env.Append(CPPPATH = ['include', 'main', 'arch/include'])
|
2011-09-26 17:15:43 +00:00
|
|
|
libs = ['physfs', 'm']
|
2006-12-19 02:25:50 +00:00
|
|
|
|
2007-05-22 01:20:06 +00:00
|
|
|
# Get traditional compiler environment variables
|
|
|
|
if os.environ.has_key('CC'):
|
|
|
|
env['CC'] = os.environ['CC']
|
|
|
|
if os.environ.has_key('CFLAGS'):
|
|
|
|
env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
|
|
|
|
if os.environ.has_key('CXX'):
|
|
|
|
env['CXX'] = os.environ['CXX']
|
|
|
|
if os.environ.has_key('CXXFLAGS'):
|
|
|
|
env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
|
|
|
|
if os.environ.has_key('LDFLAGS'):
|
|
|
|
env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
|
|
|
|
|
2006-12-19 02:25:50 +00:00
|
|
|
# windows or *nix?
|
|
|
|
if sys.platform == 'win32':
|
|
|
|
print "compiling on Windows"
|
|
|
|
osdef = '_WIN32'
|
|
|
|
osasmdef = 'win32'
|
|
|
|
sharepath = ''
|
2009-11-29 16:46:13 +00:00
|
|
|
env.Append(CPPDEFINES = ['_WIN32', 'HAVE_STRUCT_TIMEVAL'])
|
2007-08-21 22:55:00 +00:00
|
|
|
env.Append(CPPPATH = ['arch/win32/include'])
|
2008-04-06 20:23:28 +00:00
|
|
|
ogldefines = ['OGL']
|
2010-11-28 12:08:29 +00:00
|
|
|
common_sources += ['arch/win32/messagebox.c']
|
2006-12-19 02:25:50 +00:00
|
|
|
ogllibs = ''
|
2011-04-05 00:24:34 +00:00
|
|
|
libs += ['glu32', 'wsock32', 'ws2_32', 'winmm', 'mingw32', 'SDLmain', 'SDL']
|
2010-08-21 17:08:53 +00:00
|
|
|
lflags = '-mwindows arch/win32/d2xr.res'
|
2007-04-25 02:39:10 +00:00
|
|
|
elif sys.platform == 'darwin':
|
|
|
|
print "compiling on Mac OS X"
|
|
|
|
osdef = '__APPLE__'
|
2008-03-22 04:48:37 +00:00
|
|
|
sharepath = ''
|
2007-04-25 02:39:10 +00:00
|
|
|
env.Append(CPPDEFINES = ['HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL', '__unix__'])
|
2007-08-28 00:01:25 +00:00
|
|
|
asm = 0
|
2007-04-25 02:39:10 +00:00
|
|
|
env.Append(CPPPATH = ['arch/linux/include'])
|
2008-04-06 20:23:28 +00:00
|
|
|
ogldefines = ['OGL']
|
2010-11-28 12:08:29 +00:00
|
|
|
common_sources += ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c']
|
2007-04-25 02:39:10 +00:00
|
|
|
ogllibs = ''
|
|
|
|
libs = ''
|
|
|
|
# Ugly way of linking to frameworks, but kreator has seen uglier
|
2010-11-28 12:08:29 +00:00
|
|
|
lflags = '-framework ApplicationServices -framework Carbon -framework Cocoa -framework SDL'
|
|
|
|
libs += '../physfs/build/Debug/libphysfs.dylib'
|
2007-04-25 02:39:10 +00:00
|
|
|
if (sdl_only == 0):
|
|
|
|
lflags += ' -framework OpenGL'
|
|
|
|
if (sdlmixer == 1):
|
|
|
|
print "including SDL_mixer"
|
|
|
|
lflags += ' -framework SDL_mixer'
|
|
|
|
sys.path += ['./arch/cocoa']
|
2007-06-10 02:27:12 +00:00
|
|
|
VERSION = str(D2XMAJOR) + '.' + str(D2XMINOR)
|
|
|
|
if (D2XMICRO):
|
|
|
|
VERSION += '.' + str(D2XMICRO)
|
2007-04-25 02:39:10 +00:00
|
|
|
env['VERSION_NUM'] = VERSION
|
|
|
|
env['VERSION_NAME'] = PROGRAM_NAME + ' v' + VERSION
|
|
|
|
import tool_bundle
|
2006-12-19 02:25:50 +00:00
|
|
|
else:
|
|
|
|
print "compiling on *NIX"
|
|
|
|
osdef = '__LINUX__'
|
|
|
|
osasmdef = 'elf'
|
2007-01-22 10:40:14 +00:00
|
|
|
sharepath += '/'
|
2010-07-30 07:34:33 +00:00
|
|
|
env.ParseConfig('sdl-config --cflags')
|
|
|
|
env.ParseConfig('sdl-config --libs')
|
2009-11-29 16:46:13 +00:00
|
|
|
env.Append(CPPDEFINES = ['__LINUX__', 'HAVE_STRUCT_TIMESPEC', 'HAVE_STRUCT_TIMEVAL'])
|
2006-12-19 02:25:50 +00:00
|
|
|
env.Append(CPPPATH = ['arch/linux/include'])
|
2008-04-06 20:23:28 +00:00
|
|
|
ogldefines = ['OGL']
|
2010-07-30 12:10:28 +00:00
|
|
|
libs += env['LIBS']
|
2011-01-06 11:43:58 +00:00
|
|
|
if (opengles == 1):
|
|
|
|
ogllibs = ['GLES_CM', 'EGL']
|
|
|
|
else:
|
|
|
|
ogllibs = ['GL', 'GLU']
|
2007-02-09 15:50:50 +00:00
|
|
|
lflags = '-L/usr/X11R6/lib'
|
2006-12-19 02:25:50 +00:00
|
|
|
|
2011-01-03 10:42:53 +00:00
|
|
|
# set endianess
|
|
|
|
if (checkEndian() == "big"):
|
|
|
|
print "BigEndian machine detected"
|
2007-08-28 00:01:25 +00:00
|
|
|
asm = 0
|
2011-01-03 10:42:53 +00:00
|
|
|
env.Append(CPPDEFINES = ['WORDS_BIGENDIAN'])
|
|
|
|
elif (checkEndian() == "little"):
|
|
|
|
print "LittleEndian machine detected"
|
2006-12-19 02:25:50 +00:00
|
|
|
|
2011-01-03 10:42:53 +00:00
|
|
|
# opengl or software renderer?
|
2011-01-06 11:43:58 +00:00
|
|
|
if (opengl == 1) or (opengles == 1):
|
|
|
|
if (opengles == 1):
|
|
|
|
print "building with OpenGL ES"
|
|
|
|
env.Append(CPPDEFINES = ['OGLES'])
|
|
|
|
else:
|
|
|
|
print "building with OpenGL"
|
2006-12-19 02:25:50 +00:00
|
|
|
env.Append(CPPDEFINES = ogldefines)
|
|
|
|
common_sources += arch_ogl_sources
|
|
|
|
libs += ogllibs
|
2011-01-03 10:42:53 +00:00
|
|
|
else:
|
|
|
|
print "building with Software Renderer"
|
|
|
|
common_sources += arch_sdl_sources
|
|
|
|
|
|
|
|
# assembler code?
|
|
|
|
if (asm == 1) and (opengl == 0):
|
|
|
|
print "including: ASSEMBLER"
|
|
|
|
env.Replace(AS = 'nasm')
|
|
|
|
env.Append(ASCOM = ' -f ' + str(osasmdef) + ' -d' + str(osdef) + ' -Itexmap/ ')
|
2011-01-19 20:35:14 +00:00
|
|
|
common_sources += asm_sources
|
2011-01-03 10:42:53 +00:00
|
|
|
else:
|
|
|
|
env.Append(CPPDEFINES = ['NO_ASM'])
|
2006-12-19 02:25:50 +00:00
|
|
|
|
2009-11-29 16:46:13 +00:00
|
|
|
# SDL_mixer support?
|
|
|
|
if (sdlmixer == 1):
|
2006-12-19 02:25:50 +00:00
|
|
|
print "including SDL_mixer"
|
2009-11-29 16:46:13 +00:00
|
|
|
env.Append(CPPDEFINES = ['USE_SDLMIXER'])
|
|
|
|
common_sources += arch_sdlmixer
|
|
|
|
if (sys.platform != 'darwin'):
|
2010-02-23 01:21:55 +00:00
|
|
|
libs += ['SDL_mixer']
|
2006-12-19 02:25:50 +00:00
|
|
|
|
|
|
|
# debug?
|
|
|
|
if (debug == 1):
|
|
|
|
print "including: DEBUG"
|
2009-11-30 22:42:55 +00:00
|
|
|
env.Append(CPPFLAGS = ['-g'])
|
2006-12-19 02:25:50 +00:00
|
|
|
else:
|
|
|
|
env.Append(CPPDEFINES = ['NDEBUG', 'RELEASE'])
|
|
|
|
env.Append(CPPFLAGS = ['-O2'])
|
|
|
|
|
|
|
|
# profiler?
|
|
|
|
if (profiler == 1):
|
|
|
|
env.Append(CPPFLAGS = ['-pg'])
|
2007-03-22 11:32:22 +00:00
|
|
|
lflags += ' -pg'
|
2006-12-19 02:25:50 +00:00
|
|
|
|
|
|
|
#editor build?
|
|
|
|
if (editor == 1):
|
|
|
|
env.Append(CPPDEFINES = ['EDITOR'])
|
|
|
|
env.Append(CPPPATH = ['include/editor'])
|
|
|
|
common_sources += editor_sources
|
|
|
|
|
2007-12-17 22:45:45 +00:00
|
|
|
# IPv6 compability?
|
|
|
|
if (ipv6 == 1):
|
|
|
|
env.Append(CPPDEFINES = ['IPv6'])
|
|
|
|
|
2009-11-29 16:46:13 +00:00
|
|
|
# UDP support?
|
|
|
|
if (use_udp == 1):
|
|
|
|
env.Append(CPPDEFINES = ['USE_UDP'])
|
|
|
|
common_sources += ['main/net_udp.c']
|
2011-04-05 00:24:34 +00:00
|
|
|
|
|
|
|
# Tracker support? (Relies on UDP)
|
|
|
|
if( use_tracker == 1 ):
|
|
|
|
env.Append( CPPDEFINES = [ 'USE_TRACKER' ] )
|
2009-11-29 16:46:13 +00:00
|
|
|
|
2006-12-19 02:25:50 +00:00
|
|
|
print '\n'
|
|
|
|
|
2007-01-22 10:40:14 +00:00
|
|
|
env.Append(CPPDEFINES = [('SHAREPATH', '\\"' + str(sharepath) + '\\"')])
|
2006-12-19 02:25:50 +00:00
|
|
|
# finally building program...
|
2007-09-28 22:44:04 +00:00
|
|
|
env.Program(target=str(target), source = common_sources, LIBS = libs, LINKFLAGS = str(lflags))
|
2007-04-25 02:39:10 +00:00
|
|
|
if (sys.platform != 'darwin'):
|
|
|
|
env.Install(BIN_DIR, str(target))
|
|
|
|
env.Alias('install', BIN_DIR)
|
|
|
|
else:
|
|
|
|
tool_bundle.TOOL_BUNDLE(env)
|
|
|
|
env.MakeBundle(PROGRAM_NAME + '.app', target,
|
|
|
|
'free.d2x-rebirth', 'd2xgl-Info.plist',
|
|
|
|
typecode='APPL', creator='DCT2',
|
|
|
|
icon_file='arch/cocoa/d2x-rebirth.icns',
|
|
|
|
subst_dict={'d2xgl' : target}, # This is required; manually update version for Xcode compatibility
|
|
|
|
resources=[['English.lproj/InfoPlist.strings', 'English.lproj/InfoPlist.strings']])
|
2006-12-19 02:25:50 +00:00
|
|
|
|
|
|
|
# show some help when running scons -h
|
|
|
|
Help(PROGRAM_NAME + ', SConstruct file help:' +
|
|
|
|
"""
|
|
|
|
|
|
|
|
Type 'scons' to build the binary.
|
|
|
|
Type 'scons install' to build (if it hasn't been done) and install.
|
|
|
|
Type 'scons -c' to clean up.
|
|
|
|
|
|
|
|
Extra options (add them to command line, like 'scons extraoption=value'):
|
|
|
|
|
2011-01-03 10:42:53 +00:00
|
|
|
'sharepath=[DIR]' (non-Mac OS *NIX only) use [DIR] for shared game data. [default: /usr/local/share/games/d2x-rebirth]
|
|
|
|
'opengl=[0/1]' build with OpenGL support [default: 1]
|
2011-01-06 11:43:58 +00:00
|
|
|
'opengles=[0/1]' build with OpenGL ES support [default: 0]
|
2011-01-03 10:42:53 +00:00
|
|
|
'sdlmixer=[0/1]' build with SDL_Mixer support for sound and music (includes external music support) [default: 1]
|
|
|
|
'asm=[0/1]' build with ASSEMBLER code (only with opengl=0, requires NASM and x86) [default: 0]
|
|
|
|
'debug=[0/1]' build DEBUG binary which includes asserts, debugging output, cheats and more output [default: 0]
|
|
|
|
'profiler=[0/1]' profiler build [default: 0]
|
|
|
|
'editor=[0/1]' include editor into build (!EXPERIMENTAL!) [default: 0]
|
|
|
|
'ipv6=[0/1]' enable IPv6 compability [default: 0]
|
|
|
|
'use_udp=[0/1]' enable UDP support [default: 1]
|
2011-04-05 00:24:34 +00:00
|
|
|
'use_tracker=[0/1]' enable Tracker support (requires udp) [default :1]
|
2011-01-03 10:42:53 +00:00
|
|
|
'verbosebuild=[0/1]' print out all compiler/linker messages during building [default: 0]
|
2006-12-19 02:25:50 +00:00
|
|
|
|
|
|
|
Default values:
|
2007-05-22 01:20:06 +00:00
|
|
|
""" + ' sharepath = ' + DATA_DIR + """
|
|
|
|
|
|
|
|
Some influential environment variables:
|
2007-05-30 14:16:49 +00:00
|
|
|
CC C compiler command
|
|
|
|
CFLAGS C compiler flags
|
|
|
|
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
|
2007-05-22 01:20:06 +00:00
|
|
|
nonstandard directory <lib dir>
|
|
|
|
<include dir>
|
2007-05-30 14:16:49 +00:00
|
|
|
CXX C++ compiler command
|
|
|
|
CXXFLAGS C++ compiler flags
|
2007-05-22 01:20:06 +00:00
|
|
|
""")
|
2006-12-19 02:25:50 +00:00
|
|
|
#EOF
|