#!SCons
""" qwh - Enemy Territory: Quake Wars hack for linux """
__author__ = "*nixCoders team"
__url__ = "http://www.nixcoders.org/"
__copyright__ = "Copyright (C) 2008 - *nixCoders team"
__license__ = """
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""
import os, sys
# Command line options
options = Options()
options.AddOptions(
BoolOption('DEBUG', 'Debug build.', False),
BoolOption('DEMO', 'Build for demo version.', False),
PathOption('HEADER_PATH', 'Custom path for headers.', None),
BoolOption('QUIET', 'Quiet Output', True),
PathOption('LIB_PATH', 'Custom path for libraries.', None),
PathOption('SDK_PATH', 'Path to Quake Wars SDK.', 'sdk')
)
env = Environment(
ENV = os.environ,
QWH_VERSION = open('version.def').read(),
options = options
)
Help(options.GenerateHelpText(env))
# Make build path
buildPath = 'build'
if env['DEMO']:
buildPath = os.path.join(buildPath, 'demo')
else:
buildPath = os.path.join(buildPath, 'retail')
if env['DEBUG']:
buildPath = os.path.join(buildPath, 'debug')
else:
buildPath = os.path.join(buildPath, 'release')
if env ['QUIET']:
env.Append(CPPFLAGS=['-w'])
def print_cmd_line(s, target, src, env):
if env ['QUIET']:
sys.stdout.write(" Compiling [\033[1;32m%s\033[0m]\n"%(' and '.join([str(x) for x in src])))
#open(env['CMD_LOGFILE'], 'a').write("%s\n"%s);
env['PRINT_CMD_LINE_FUNC'] = print_cmd_line
Export('env')
SConscript(
['SConscript.cflags', 'SConscript.configure'],
duplicate = False
)
idLib = SConscript(
'SConscript.idLib',
build_dir = os.path.join(buildPath, 'sdk'),
duplicate = False
)
SConscript(
dirs = 'src',
build_dir = buildPath,
duplicate = False,
exports = 'idLib'
)