44fe00fb92
Reported by: pointyhat
106 lines
4 KiB
Text
106 lines
4 KiB
Text
--- SConstruct.orig Wed May 2 01:54:48 2007
|
|
+++ SConstruct Wed May 2 01:59:33 2007
|
|
@@ -1,4 +1,4 @@
|
|
-import os, string, sys
|
|
+import os, string, sys, commands, fnmatch
|
|
import SCons
|
|
import SCons.Errors
|
|
|
|
@@ -6,7 +6,10 @@
|
|
# Set configuration options
|
|
#
|
|
opts = Options('quake3.conf')
|
|
-opts.Add(EnumOption('arch', 'Choose architecture to build for', 'linux-i386', allowed_values=('linux-i386', 'linux-x86_64')))
|
|
+opts.Add('CC', 'C compiler')
|
|
+opts.Add('CCFLAGS', 'C compiler flags', Split(''))
|
|
+opts.Add('CPPPATH', 'Compiler include path', Split(''))
|
|
+opts.Add('LIBPATH', 'Linker library path', Split(''))
|
|
opts.Add(EnumOption('warnings', 'Choose warnings level', '1', allowed_values=('0', '1', '2')))
|
|
opts.Add(EnumOption('debug', 'Set to >= 1 to build for debug', '0', allowed_values=('0', '1', '2', '3')))
|
|
opts.Add(EnumOption('optimize', 'Set to >= 1 to build with general optimizations', '2', allowed_values=('0', '1', '2', '3', '4', '5', '6')))
|
|
@@ -15,6 +18,7 @@
|
|
opts.Add(BoolOption('lua', 'Set to 1 to compile qagame with Lua scripting support', 0))
|
|
opts.Add(BoolOption('vm', 'Set to 1 to compile engine with virtual machine support', 1))
|
|
opts.Add(BoolOption('smp', 'Set to 1 to compile engine with symetric multiprocessor support', 0))
|
|
+opts.Add(BoolOption('gamelibs', 'Set to 1 to compile .so game libraries (cgame, game and ui) when they are not needed (i.e. when "vm" is 1 and supported for current arch)', 0))
|
|
|
|
#
|
|
# Initialize compiler environment base
|
|
@@ -24,15 +28,33 @@
|
|
else:
|
|
env = Environment(ENV = {'PATH' : os.environ['PATH']}, options = opts)
|
|
|
|
-Help(opts.GenerateHelpText(env))
|
|
+ # Some values need to be splitten
|
|
+ env['CCFLAGS'] = Split(env['CCFLAGS'])
|
|
+ env['CPPPATH'] = Split(env['CPPPATH'])
|
|
+ env['LIBPATH'] = Split(env['LIBPATH'])
|
|
|
|
+ # Supported VM architectures (Linux)
|
|
+ env['vm_archs'] = ['x86', 'x86_64', 'ppc']
|
|
+ env['arch'] = commands.getoutput('uname -m')
|
|
+
|
|
+ # Equivalent arch names in FreeBSD
|
|
+ if fnmatch.fnmatch(sys.platform, 'freebsd*'):
|
|
+ vm_archs_freebsd = {'i386' : 'x86', 'amd64' : 'x86_64', 'powerpc' : 'ppc'}
|
|
+ if vm_archs_freebsd.has_key(env['arch']):
|
|
+ env['arch'] = vm_archs_freebsd[env['arch']]
|
|
+
|
|
+ # Build game libraries if VM is not supported in current arch
|
|
+ if env['vm_archs'].count(env['arch']) == 0 or env['vm'] == 0:
|
|
+ env['gamelibs'] = 1
|
|
+
|
|
+Help(opts.GenerateHelpText(env))
|
|
|
|
#
|
|
# Set common compiler flags
|
|
#
|
|
print 'compiling for architecture ', env['arch']
|
|
|
|
-env.Append(CCFLAGS = '-pipe -fsigned-char')
|
|
+env.Append(CCFLAGS = Split('-pipe -fsigned-char'))
|
|
|
|
if env['warnings'] == '1':
|
|
env.Append(CCFLAGS = '-Wall')
|
|
@@ -45,7 +67,7 @@
|
|
env.Append(CCFLAGS = '-DNDEBUG')
|
|
|
|
if env['optimize'] != '0':
|
|
- env.Append(CCFLAGS = '-O${optimize} -ffast-math -fno-strict-aliasing -funroll-loops')
|
|
+ env.Append(CCFLAGS = Split('-O${optimize} -ffast-math -fno-strict-aliasing -funroll-loops'))
|
|
|
|
if env['simd'] == 'sse':
|
|
env.Append(CCFLAGS = '-DSIMD_SSE')
|
|
@@ -54,15 +76,12 @@
|
|
|
|
conf = Configure(env)
|
|
|
|
-if sys.platform == 'linux2' or sys.platform == 'linux-i386':
|
|
+# The "dl" library is needed on Linux
|
|
+if fnmatch.fnmatch(sys.platform, 'linux*'):
|
|
if not conf.CheckLib('dl', autoadd=0):
|
|
print 'Did not find libdl.a, exiting!'
|
|
Exit(1)
|
|
|
|
-if not conf.CheckLib('m', autoadd=0):
|
|
- print 'Did not find libm.a or m.lib, exiting!'
|
|
- Exit(1)
|
|
-
|
|
env = conf.Finish()
|
|
|
|
# Save options
|
|
@@ -70,8 +89,10 @@
|
|
|
|
Export('env')
|
|
|
|
-SConscript('SConscript_quake3-server', build_dir='build/quake3-server', duplicate=0)
|
|
SConscript('SConscript_quake3', build_dir='build/quake3', duplicate=0)
|
|
-SConscript('SConscript_cgame', build_dir='build/cgame', duplicate=0)
|
|
-SConscript('SConscript_game', build_dir='build/game', duplicate=0)
|
|
-SConscript('SConscript_ui', build_dir='build/ui', duplicate=0)
|
|
+SConscript('SConscript_quake3-server', build_dir='build/quake3-server', duplicate=0)
|
|
+
|
|
+if env['gamelibs'] != 0:
|
|
+ SConscript('SConscript_cgame', build_dir='build/cgame', duplicate=0)
|
|
+ SConscript('SConscript_game', build_dir='build/game', duplicate=0)
|
|
+ SConscript('SConscript_ui', build_dir='build/ui', duplicate=0)
|