More consistency in SConstruct command-line variables; Added automatic Endianess-checker; Set target to 'd1x-rebirth' no matter if OpenGL or not

This commit is contained in:
zicodxx 2011-01-03 11:42:50 +01:00
parent 8c75bd0957
commit 182fa63ea8
3 changed files with 69 additions and 57 deletions

View file

@ -4,6 +4,7 @@ D1X-Rebirth Changelog
-------- --------
arch/sdl/joy.c, arch/sdl/key.c, arch/sdl/mouse.c, include/args.h, main/kconfig.c, main/kconfig.h, main/playsave.c, misc/args.c: Added Cycle Primary/Secondary to the config panels for keyboard and joystick like in D2X-Rebirth and store them in the designated key/button arrays; Added Cycle Primary/Secondary for Mouse which makes wheel axis cycling unnecessary and also let Weapon Keys be assigned to a Mouse button; If GameArg.NoStickyKeys do flush these keys so they can be used as normal game keys - otherwise ban them; Fixed crash when reassigning mouse button greater than 3; Joystick/Mouse function taking button as argument now check for sanity of this value so they can safely be used in kconfig code and deal with unassigned key values arch/sdl/joy.c, arch/sdl/key.c, arch/sdl/mouse.c, include/args.h, main/kconfig.c, main/kconfig.h, main/playsave.c, misc/args.c: Added Cycle Primary/Secondary to the config panels for keyboard and joystick like in D2X-Rebirth and store them in the designated key/button arrays; Added Cycle Primary/Secondary for Mouse which makes wheel axis cycling unnecessary and also let Weapon Keys be assigned to a Mouse button; If GameArg.NoStickyKeys do flush these keys so they can be used as normal game keys - otherwise ban them; Fixed crash when reassigning mouse button greater than 3; Joystick/Mouse function taking button as argument now check for sanity of this value so they can safely be used in kconfig code and deal with unassigned key values
d1x.ini, include/args.h, main/gauges.c, main/hud.c, main/inferno.c, main/menu.c, main/playsave.c, main/playsave.h, misc/args.c: Added feature to disable D2-style Prox. Bomb Gauge; Moved NoRedundancy and MultiMessages toggles from GameArg to PlayerCfg to be set via Misc Options d1x.ini, include/args.h, main/gauges.c, main/hud.c, main/inferno.c, main/menu.c, main/playsave.c, main/playsave.h, misc/args.c: Added feature to disable D2-style Prox. Bomb Gauge; Moved NoRedundancy and MultiMessages toggles from GameArg to PlayerCfg to be set via Misc Options
SConstruct, INSTALL.txt: More consistency in SConstruct command-line variables; Added automatic Endianess-checker; Set target to 'd1x-rebirth' no matter if OpenGL or not
20110102 20110102
-------- --------

View file

@ -21,11 +21,11 @@ Compiling:
*NIX: *NIX:
----- -----
Type 'scons' to compile the source. Type 'scons' to compile the source.
You can also give additional options like 'scons sdl_only=1 asm=1'. See 'scons -h' for available options. You can also give additional options like 'scons use_ipx=0'. See 'scons -h' for available options.
To install, use 'scons install' but remember to use all your options as well or SCons will re-compile and To install, use 'scons install' but remember to use all your options as well or SCons will re-compile and
install without any options given to prior compiling. However it's STRONGLY recommended NOT to use the install without any options given to prior compiling. However it's STRONGLY recommended NOT to use the
'install' argument but to create a package for your Linux distribution or operating system. 'install' will 'install' argument but to create a package for your Linux distribution or operating system. 'install' will
compile the resulting binary (d1x-rebirth-gl/sdl) to /usr/local/bin/ by default so to uninstall, just compile the resulting binary (d1x-rebirth) to /usr/local/bin/ by default so to uninstall, just
delete the binary. delete the binary.
MacOS: MacOS:

View file

@ -6,6 +6,7 @@ import os
import SCons.Util import SCons.Util
PROGRAM_NAME = 'D1X-Rebirth' PROGRAM_NAME = 'D1X-Rebirth'
target = 'd1x-rebirth'
# version number # version number
D1XMAJOR = 0 D1XMAJOR = 0
@ -24,16 +25,27 @@ DATA_DIR = PREFIX + DATA_SUBDIR
sharepath = str(ARGUMENTS.get('sharepath', DATA_DIR)) sharepath = str(ARGUMENTS.get('sharepath', DATA_DIR))
debug = int(ARGUMENTS.get('debug', 0)) debug = int(ARGUMENTS.get('debug', 0))
profiler = int(ARGUMENTS.get('profiler', 0)) profiler = int(ARGUMENTS.get('profiler', 0))
sdl_only = int(ARGUMENTS.get('sdl_only', 0)) opengl = int(ARGUMENTS.get('opengl', 1))
asm = int(ARGUMENTS.get('asm', 0)) asm = int(ARGUMENTS.get('asm', 0))
editor = int(ARGUMENTS.get('editor', 0)) editor = int(ARGUMENTS.get('editor', 0))
sdlmixer = int(ARGUMENTS.get('sdlmixer', 0)) sdlmixer = int(ARGUMENTS.get('sdlmixer', 1))
arm = int(ARGUMENTS.get('arm', 0))
ipv6 = int(ARGUMENTS.get('ipv6', 0)) ipv6 = int(ARGUMENTS.get('ipv6', 0))
use_udp = int(ARGUMENTS.get('use_udp', 1)) use_udp = int(ARGUMENTS.get('use_udp', 1))
use_ipx = int(ARGUMENTS.get('use_ipx', 1)) use_ipx = int(ARGUMENTS.get('use_ipx', 1))
verbosebuild = int(ARGUMENTS.get('verbosebuild', 0)) verbosebuild = int(ARGUMENTS.get('verbosebuild', 0))
# 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"
print '\n===== ' + PROGRAM_NAME + VERSION_STRING + ' =====\n' print '\n===== ' + PROGRAM_NAME + VERSION_STRING + ' =====\n'
# general source files # general source files
@ -223,7 +235,7 @@ arch_ogl_sources = [
'arch/ogl/ogl.c', 'arch/ogl/ogl.c',
] ]
# for sdl # for non-ogl
arch_sdl_sources = [ arch_sdl_sources = [
'arch/sdl/gr.c', 'arch/sdl/gr.c',
'texmap/tmapflat.c' 'texmap/tmapflat.c'
@ -344,23 +356,34 @@ else:
ogllibs = ['GL', 'GLU'] ogllibs = ['GL', 'GLU']
lflags = '-L/usr/X11R6/lib' lflags = '-L/usr/X11R6/lib'
# arm architecture? # set endianess
if (arm == 1): if (checkEndian() == "big"):
print "BigEndian machine detected"
asm = 0 asm = 0
env.Append(CPPDEFINES = ['WORDS_NEED_ALIGNMENT']) env.Append(CPPDEFINES = ['WORDS_BIGENDIAN'])
env.Append(CPPFLAGS = ['-mstructure-size-boundary=8']) elif (checkEndian() == "little"):
print "LittleEndian machine detected"
# sdl or opengl? # opengl or software renderer?
if (sdl_only == 1): if (opengl == 1):
print "building with SDL"
target = 'd1x-rebirth-sdl'
common_sources += arch_sdl_sources
else:
print "building with OpenGL" print "building with OpenGL"
target = 'd1x-rebirth-gl'
env.Append(CPPDEFINES = ogldefines) env.Append(CPPDEFINES = ogldefines)
common_sources += arch_ogl_sources common_sources += arch_ogl_sources
libs += ogllibs libs += ogllibs
else:
print "building with Software Renderer"
common_sources += arch_sdl_sources
# assembler code?
if (asm == 1) and (opengl == 0):
print "including: ASSEMBLER"
Object(['texmap/tmappent.S', 'texmap/tmapppro.S'], AS='gcc', ASFLAGS='-D' + str(osdef) + ' -c ')
env.Replace(AS = 'nasm')
env.Append(ASCOM = ' -f ' + str(osasmdef) + ' -d' + str(osdef) + ' -Itexmap/ ')
common_sources += asm_sources + ['texmap/tmappent.o', 'texmap/tmapppro.o']
else:
env.Append(CPPDEFINES = ['NO_ASM'])
common_sources += noasm_sources
# SDL_mixer support? # SDL_mixer support?
if (sdlmixer == 1): if (sdlmixer == 1):
@ -383,17 +406,6 @@ if (profiler == 1):
env.Append(CPPFLAGS = ['-pg']) env.Append(CPPFLAGS = ['-pg'])
lflags += ' -pg' lflags += ' -pg'
# assembler code?
if (asm == 1) and (sdl_only == 1):
print "including: ASSEMBLER"
Object(['texmap/tmappent.S', 'texmap/tmapppro.S'], AS='gcc', ASFLAGS='-D' + str(osdef) + ' -c ')
env.Replace(AS = 'nasm')
env.Append(ASCOM = ' -f ' + str(osasmdef) + ' -d' + str(osdef) + ' -Itexmap/ ')
common_sources += asm_sources + ['texmap/tmappent.o', 'texmap/tmapppro.o']
else:
env.Append(CPPDEFINES = ['NO_ASM'])
common_sources += noasm_sources
#editor build? #editor build?
if (editor == 1): if (editor == 1):
env.Append(CPPDEFINES = ['EDITOR']) env.Append(CPPDEFINES = ['EDITOR'])
@ -441,18 +453,17 @@ Help(PROGRAM_NAME + ', SConstruct file help:' +
Extra options (add them to command line, like 'scons extraoption=value'): Extra options (add them to command line, like 'scons extraoption=value'):
'sharepath=DIR' (non-Mac OS *NIX only) use DIR for shared game data. (default: /usr/local/share/games/d1x-rebirth) 'sharepath=[DIR]' (non-Mac OS *NIX only) use [DIR] for shared game data. [default: /usr/local/share/games/d1x-rebirth]
'sdl_only=1' don't include OpenGL, use SDL-only instead 'opengl=[0/1]' build with OpenGL support [default: 1]
'sdlmixer=1' use SDL_Mixer for sound (includes external music support) 'sdlmixer=[0/1]' build with SDL_Mixer support for sound and music (includes external music support) [default: 1]
'asm=1' use ASSEMBLER code (only with sdl_only=1, requires NASM and x86) 'asm=[0/1]' build with ASSEMBLER code (only with opengl=0, requires NASM and x86) [default: 0]
'debug=1' build DEBUG binary which includes asserts, debugging output, cheats and more output 'debug=[0/1]' build DEBUG binary which includes asserts, debugging output, cheats and more output [default: 0]
'profiler=1' do profiler build 'profiler=[0/1]' profiler build [default: 0]
'editor=1' build editor !EXPERIMENTAL! 'editor=[0/1]' include editor into build (!EXPERIMENTAL!) [default: 0]
'arm=1' compile for ARM architecture 'ipv6=[0/1]' enable IPv6 compability [default: 0]
'ipv6=1' enables IPv6 copability 'use_udp=[0/1]' enable UDP support [default: 1]
'use_udp=0' disable UDP support 'use_ipx=[0/1]' enable IPX support (IPX available on Linux and Windows, only) [default: 1]
'use_ipx=0' disable IPX support (IPX available on Linux and Windows, only) 'verbosebuild=[0/1]' print out all compiler/linker messages during building [default: 0]
'verbosebuild=1' print out all compiler/linker messages during building
Default values: Default values:
""" + ' sharepath = ' + DATA_DIR + """ """ + ' sharepath = ' + DATA_DIR + """