mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-25 05:21:05 +00:00
using the QUAKE3DIR env var to locate the output/debug directory
removed the legacy id build files and renamed the sys directory to build the makefiles and intermediate build files are now under the build directory
This commit is contained in:
parent
161f11e40e
commit
32625ef4e2
7 changed files with 33 additions and 2494 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -6,10 +6,8 @@
|
|||
*.ncb
|
||||
*.pdb
|
||||
*.idb
|
||||
code/freetype/objs/
|
||||
code/freetype/builds/
|
||||
code/qcommon/git.h
|
||||
code/win32/msvc*/build/
|
||||
code/win32/msvc*/*user*
|
||||
code/win32/msvc*/*sdf
|
||||
code/win32/winquake.res
|
||||
build/vs*/*sdf
|
||||
build/vs*/*.user
|
||||
build/*/obj
|
732
SConstruct
732
SConstruct
|
@ -1,732 +0,0 @@
|
|||
# -*- mode: python -*-
|
||||
# Quake4 build script
|
||||
# TTimo <ttimo@idsoftware.com>
|
||||
# http://scons.sourceforge.net
|
||||
|
||||
import sys, os, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile, string
|
||||
import SCons
|
||||
|
||||
sys.path.append( 'sys/scons' )
|
||||
import scons_utils
|
||||
|
||||
conf_filename='site.conf'
|
||||
# choose configuration variables which should be saved between runs
|
||||
# ( we handle all those as strings )
|
||||
serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'IDNET_HOST', 'GL_HARDLINK', 'DEDICATED',
|
||||
'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK',
|
||||
'TARGET_CORE', 'TARGET_CORE_SMP', 'TARGET_GAME', 'TARGET_MONO', 'TARGET_DEMO', 'NOCURL',
|
||||
'BUILD_ROOT', 'Q4TEST', 'TARGET_GAMEPAK', 'PATCHLEVEL', 'OSX_BUILDSTYLE', 'SILENT', 'GCC_X86_ASM' ]
|
||||
|
||||
# global build mode ------------------------------
|
||||
|
||||
g_sdk = not os.path.exists( 'sys/scons/SConscript.core' )
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
# help -------------------------------------------
|
||||
|
||||
help_string = """
|
||||
Usage: scons [OPTIONS] [TARGET] [CONFIG]
|
||||
|
||||
[OPTIONS] and [TARGET] are covered in command line options, use scons -H
|
||||
|
||||
[CONFIG]: KEY="VALUE" [...]
|
||||
a number of configuration options saved between runs in the """ + conf_filename + """ file
|
||||
erase """ + conf_filename + """ to start with default settings again
|
||||
|
||||
CC (default gcc)
|
||||
CXX (default g++)
|
||||
Specify C and C++ compilers (defaults gcc and g++)
|
||||
ex: CC="gcc-3.3"
|
||||
You can use ccache and distcc, for instance:
|
||||
CC="ccache distcc gcc" CXX="ccache distcc g++"
|
||||
|
||||
JOBS (default 1)
|
||||
Parallel build
|
||||
|
||||
BUILD (default debug)
|
||||
Use debug-all/debug/release to select build settings
|
||||
ex: BUILD="release"
|
||||
debug-all: no optimisations, debugging symbols
|
||||
debug: -O -g
|
||||
release: all optimisations, including CPU target etc.
|
||||
|
||||
BUILD_ROOT (default 'build')
|
||||
change the build root directory
|
||||
|
||||
NOCONF (default 0, not saved)
|
||||
ignore site configuration and use defaults + command line only
|
||||
|
||||
SILENT ( default 0, saved )
|
||||
hide the compiler output, unless error
|
||||
|
||||
GCC_X86_ASM ( defaul 0, saved )
|
||||
compile in gcc x86 asm optimizations
|
||||
"""
|
||||
|
||||
if ( not g_sdk ):
|
||||
help_string += """
|
||||
DEDICATED (default 0)
|
||||
Control regular / dedicated type of build:
|
||||
0 - client
|
||||
1 - dedicated server
|
||||
2 - both
|
||||
|
||||
TARGET_CORE (default 1)
|
||||
Build the core
|
||||
|
||||
TARGET_CORE_SMP (default 0)
|
||||
Build an SMP-enabled core
|
||||
|
||||
TARGET_GAME (default 1)
|
||||
Build the game code
|
||||
|
||||
TARGET_MONO (default 0)
|
||||
Build a monolithic binary
|
||||
|
||||
TARGET_DEMO (default 0)
|
||||
Build demo client ( both a core and game, no mono )
|
||||
NOTE: if you *only* want the demo client, set TARGET_CORE and TARGET_GAME to 0
|
||||
|
||||
IDNET_HOST (default to source hardcoded)
|
||||
Override builtin IDNET_HOST with your own settings
|
||||
|
||||
GL_HARDLINK (default 0)
|
||||
Instead of dynamically loading the OpenGL libraries, use implicit dependencies
|
||||
NOTE: no GL logging capability and no r_glDriver with GL_HARDLINK 1
|
||||
|
||||
DEBUG_MEMORY (default 0)
|
||||
Enables memory logging to file
|
||||
|
||||
LIBC_MALLOC (default 1)
|
||||
Toggle idHeap memory / libc malloc usage
|
||||
When libc malloc is on, memory size statistics are wrong ( no _msize )
|
||||
|
||||
ID_NOLANADDRESS (default 0)
|
||||
Don't recognize any IP as LAN address. This is useful when debugging network
|
||||
code where LAN / not LAN influences application behaviour
|
||||
|
||||
ID_MCHECK (default 2)
|
||||
Perform heap consistency checking
|
||||
0: on in Debug / off in Release
|
||||
1 forces on, 2 forces off
|
||||
note that idlib has it's own block allocator/checking
|
||||
this should not be considered a replacement, but an additional tool
|
||||
note: this is the same as MALLOC_CHECK_, but different from mtrace
|
||||
|
||||
SETUP_TAGGED (default 0, not saved)
|
||||
build tagged binaries distribution implies release, excludes other setups
|
||||
|
||||
SETUP_DEDICATED (default 0, not saved)
|
||||
build dedicated server setup. implies release
|
||||
|
||||
SETUP_DEMO (default 0, not saved)
|
||||
build demo setup. implies release
|
||||
|
||||
SETUP_FULL (default 0, not saved)
|
||||
build full setup. implies release
|
||||
|
||||
PATCHLEVEL (default 0)
|
||||
setup a patchlevel for si_version and installer name since I work Linux releases from a vendor tree and don't modify AutoVersion.h build numbers
|
||||
|
||||
TARGET_GAMEPAK (default 0, not saved)
|
||||
build a game pak pk4
|
||||
if no setup is scheduled, from whatever game is being compiled ( current configuration )
|
||||
if setups are scheduled, controls gamepak building during setup ( might wanna use a reference one for pure-compatible updates )
|
||||
|
||||
SDK (default 0, not saved)
|
||||
build an SDK release
|
||||
|
||||
NOCURL (default 0)
|
||||
set to 1 to disable usage of libcurl and http/ftp downloads feature
|
||||
|
||||
FIX_INCLUDE (default 0, not saved)
|
||||
fix include paths while compiling
|
||||
wraps around the compiler call to catch and fix include path errors
|
||||
note that since this process modifies files on the fly, it's not a good idea to use it with several jobs
|
||||
|
||||
FIX_SUPER (default 0, not saved)
|
||||
fix usage of __super msvc-ism
|
||||
wraps around gcc to do a search and fix pass
|
||||
|
||||
Q4TEST (default 0)
|
||||
q4test build
|
||||
MP-only gamecode, enables binary tagging
|
||||
|
||||
ASSETS (optional, not saved)
|
||||
point to the setup assets directory
|
||||
|
||||
OSX_BUILDSTYLE (default 0)
|
||||
Styles 1 & 2 will override CC and CXX only if they are left to the defaults
|
||||
0 - Uses the system gcc/include/libs
|
||||
1 - Uses GCC 3.3 + 10.3.9 SDK
|
||||
2 - Uses GCC 4.0 + 10.4u SDK
|
||||
"""
|
||||
|
||||
Help( help_string )
|
||||
|
||||
# end help ---------------------------------------
|
||||
|
||||
# sanity -----------------------------------------
|
||||
|
||||
EnsureSConsVersion( 0, 96 )
|
||||
|
||||
# end sanity -------------------------------------
|
||||
|
||||
# system detection -------------------------------
|
||||
|
||||
# OS and CPU
|
||||
OS = commands.getoutput( 'uname -s' )
|
||||
if ( OS == 'Linux' ):
|
||||
cpu = commands.getoutput( 'uname -m' )
|
||||
if ( cpu == 'i686' ):
|
||||
cpu = 'x86'
|
||||
else:
|
||||
cpu = 'cpu'
|
||||
elif ( OS == 'Darwin' ):
|
||||
cpu = commands.getoutput( 'uname -m' )
|
||||
if ( cpu == 'Power Macintosh' ):
|
||||
cpu = 'ppc'
|
||||
else:
|
||||
cpu = 'cpu'
|
||||
|
||||
# end system detection ---------------------------
|
||||
|
||||
# default settings -------------------------------
|
||||
|
||||
CC = 'gcc'
|
||||
CXX = 'g++'
|
||||
JOBS = '1'
|
||||
BUILD = 'debug'
|
||||
DEDICATED = '0'
|
||||
TARGET_CORE = '0'
|
||||
TARGET_GAME = '1'
|
||||
TARGET_GAMEPAK = '0'
|
||||
TARGET_MONO = '0'
|
||||
TARGET_DEMO = '0'
|
||||
IDNET_HOST = ''
|
||||
GL_HARDLINK = '0'
|
||||
if ( OS == 'Darwin' ):
|
||||
GL_HARDLINK = '1'
|
||||
DEBUG_MEMORY = '0'
|
||||
LIBC_MALLOC = '1'
|
||||
ID_NOLANADDRESS = '0'
|
||||
ID_MCHECK = '2'
|
||||
BUILD_ROOT = 'build'
|
||||
SETUP_TAGGED = '0'
|
||||
SETUP_DEDICATED = '0'
|
||||
SETUP_DEMO = '0'
|
||||
SETUP_FULL = '0'
|
||||
SETUP = '0' # no cmdline control, will be set to 1 if any form of setup is requested
|
||||
SDK = '0'
|
||||
NOCONF = '0'
|
||||
NOCURL = '0'
|
||||
FIX_INCLUDES = '0'
|
||||
FIX_SUPER = '0'
|
||||
Q4TEST = '0'
|
||||
ASSETS = ''
|
||||
PATCHLEVEL = '0'
|
||||
OSX_BUILDSTYLE = '0'
|
||||
SILENT = '0'
|
||||
TARGET_CORE_SMP = '0'
|
||||
GCC_X86_ASM = '0'
|
||||
|
||||
# end default settings ---------------------------
|
||||
|
||||
# site settings ----------------------------------
|
||||
|
||||
if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
|
||||
site_dict = {}
|
||||
if (os.path.exists(conf_filename)):
|
||||
site_file = open(conf_filename, 'r')
|
||||
p = pickle.Unpickler(site_file)
|
||||
site_dict = p.load()
|
||||
print 'Loading build configuration from ' + conf_filename + ':'
|
||||
for k, v in site_dict.items():
|
||||
exec_cmd = k + '=\'' + v + '\''
|
||||
print ' ' + exec_cmd
|
||||
exec(exec_cmd)
|
||||
else:
|
||||
print 'Site settings ignored'
|
||||
|
||||
# end site settings ------------------------------
|
||||
|
||||
# command line settings --------------------------
|
||||
|
||||
for k in ARGUMENTS.keys():
|
||||
exec_cmd = k + '=\'' + ARGUMENTS[k] + '\''
|
||||
print 'Command line: ' + exec_cmd
|
||||
exec( exec_cmd )
|
||||
|
||||
# end command line settings ----------------------
|
||||
|
||||
# save site configuration ----------------------
|
||||
|
||||
if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
|
||||
for k in serialized:
|
||||
exec_cmd = 'site_dict[\'' + k + '\'] = ' + k
|
||||
exec(exec_cmd)
|
||||
|
||||
site_file = open(conf_filename, 'w')
|
||||
p = pickle.Pickler(site_file)
|
||||
p.dump(site_dict)
|
||||
site_file.close()
|
||||
|
||||
# end save site configuration ------------------
|
||||
|
||||
# configuration rules --------------------------
|
||||
|
||||
if ( TARGET_GAMEPAK == '1' ):
|
||||
TARGET_GAME = '1'
|
||||
|
||||
if ( SETUP_TAGGED != '0' or SETUP_DEDICATED != '0' or SETUP_DEMO != '0' or SETUP_FULL != '0' ):
|
||||
DEDICATED = '2'
|
||||
BUILD = 'release'
|
||||
SETUP = '1'
|
||||
TARGET_GAME = '1'
|
||||
TARGET_CORE = '1'
|
||||
TARGET_CORE_SMP = '1'
|
||||
TARGET_GAMEPAK = '0'
|
||||
|
||||
if ( SETUP != '0' ):
|
||||
if ( SETUP_TAGGED != '0' ):
|
||||
SETUP_DEDICATED = '0'
|
||||
SETUP_DEMO = '0'
|
||||
SETUP_FULL = '0'
|
||||
Q4TEST = '1'
|
||||
else:
|
||||
Q4TEST = '0'
|
||||
|
||||
if ( g_sdk or SDK != '0' ):
|
||||
TARGET_CORE = '0'
|
||||
TARGET_GAME = '1'
|
||||
TARGET_MONO = '0'
|
||||
TARGET_DEMO = '0'
|
||||
|
||||
# end configuration rules ----------------------
|
||||
|
||||
# general configuration, target selection --------
|
||||
|
||||
g_build = BUILD_ROOT + '/' + BUILD
|
||||
|
||||
SConsignFile( 'scons.signatures' )
|
||||
|
||||
if ( GL_HARDLINK != '0' ):
|
||||
g_build += '-hardlink'
|
||||
|
||||
if ( DEBUG_MEMORY != '0' ):
|
||||
g_build += '-debugmem'
|
||||
|
||||
if ( LIBC_MALLOC != '1' ):
|
||||
g_build += '-nolibcmalloc'
|
||||
|
||||
if ( Q4TEST != '0' ):
|
||||
g_build += '-q4test'
|
||||
|
||||
SetOption('num_jobs', JOBS)
|
||||
|
||||
LINK = CXX
|
||||
|
||||
# common flags
|
||||
# BASE + CORE + OPT for engine
|
||||
# BASE + GAME + OPT for game
|
||||
# _noopt versions of the environements are built without the OPT
|
||||
|
||||
BASECPPFLAGS = [ ]
|
||||
CORECPPPATH = [ ]
|
||||
CORELIBPATH = [ ]
|
||||
CORECPPFLAGS = [ ]
|
||||
GAMECPPFLAGS = [ ]
|
||||
BASELINKFLAGS = [ ]
|
||||
CORELINKFLAGS = [ ]
|
||||
|
||||
# for release build, further optimisations that may not work on all files
|
||||
OPTCPPFLAGS = [ ]
|
||||
|
||||
BASECPPFLAGS.append( '-pipe' )
|
||||
# warn all
|
||||
BASECPPFLAGS.append( '-w' )
|
||||
# don't wrap gcc messages
|
||||
BASECPPFLAGS.append( '-fmessage-length=0' )
|
||||
|
||||
if ( OS == 'Linux' ):
|
||||
# gcc 4.x option only - only export what we mean to from the game SO
|
||||
BASECPPFLAGS.append( '-fvisibility=hidden' )
|
||||
# get the 64 bits machine on the distcc array to produce 32 bit binaries :)
|
||||
BASECPPFLAGS.append( '-m32' )
|
||||
BASELINKFLAGS.append( '-m32' )
|
||||
BASELINKFLAGS.append( '-ldl' )
|
||||
BASELINKFLAGS.append('-Xlinker')
|
||||
BASELINKFLAGS.append('-Map')
|
||||
BASELINKFLAGS.append('-Xlinker')
|
||||
BASELINKFLAGS.append('linux.map')
|
||||
|
||||
if ( g_sdk or SDK != '0' ):
|
||||
BASECPPFLAGS.append( '-DQ4SDK' )
|
||||
|
||||
if ( Q4TEST == '1' ):
|
||||
# _MPBETA implie ID_TAGGED_BUILD but also disables some single player functionality
|
||||
#BASECPPFLAGS.append( '-D_MPBETA' )
|
||||
BASECPPFLAGS.append( '-DID_TAGGED_BUILD' )
|
||||
|
||||
if ( OS == 'Darwin' ):
|
||||
# a few more common defines
|
||||
BASECPPFLAGS += [ '-Wno-long-double', '-arch', 'ppc', '-fasm-blocks', '-fpascal-strings', '-faltivec', '-mcpu=G5', '-mtune=G5' ]
|
||||
BASECPPFLAGS += [ '-DMACOS_X' ]
|
||||
BASECPPFLAGS += [ '-Wno-unknown-pragmas' ]
|
||||
BASECPPFLAGS += [ '-DMAC_OS_X_VERSION_MIN_REQUIRED=1030' ]
|
||||
# Override CC & CXX only if they contain the default values. Allows for distcc invocations
|
||||
if ( OSX_BUILDSTYLE == '1' ):
|
||||
if ( CC == 'gcc' ):
|
||||
CC = [ '/usr/bin/gcc-3.3' ]
|
||||
if ( CXX == 'g++' ):
|
||||
CXX = [ '/usr/bin/g++-3.3' ]
|
||||
|
||||
BASECPPFLAGS += [ '-isystem', '/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3' ]
|
||||
BASECPPFLAGS += [ '-I/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++' ]
|
||||
BASECPPFLAGS += [ '-I/Developer/SDKs/MacOSX10.3.9.sdk/usr/include/gcc/darwin/3.3/c++/ppc-darwin' ]
|
||||
BASECPPFLAGS += [ '-isystem', '/Developer/SDKs/MacOSX10.3.9.sdk/usr/include' ]
|
||||
BASELINKFLAGS += [ '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk' ]
|
||||
CORELIBPATH += [ '/Developer/SDKs/MacOSX10.3.9.sdk/usr/lib' ]
|
||||
os.environ['NEXT_ROOT'] = '/Developer/SDKs/MacOSX10.3.9.sdk'
|
||||
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
|
||||
elif ( OSX_BUILDSTYLE == '2' ):
|
||||
if ( CC == 'gcc' ):
|
||||
CC = [ '/usr/bin/gcc-4.0' ]
|
||||
if ( CXX == 'g++' ):
|
||||
CXX = [ '/usr/bin/g++-4.0' ]
|
||||
|
||||
BASECPPFLAGS += [ '-isystem', '/Developer/SDKs/MacOSX10.4u.sdk/usr/include/gcc/darwin/4.0' ]
|
||||
BASECPPFLAGS += [ '-mone-byte-bool' ]
|
||||
BASECPPFLAGS += [ '-fvisibility-inlines-hidden' ]
|
||||
BASECPPFLAGS += [ '-fpermissive' ]
|
||||
BASECPPFLAGS += [ '-I/Developer/SDKs/MacOSX10.4u.sdk/usr/include/gcc/darwin/4.0/c++' ]
|
||||
BASECPPFLAGS += [ '-I/Developer/SDKs/MacOSX10.4u.sdk/usr/include/gcc/darwin/4.0/c++/ppc-darwin' ]
|
||||
BASECPPFLAGS += [ '-isystem', '/Developer/SDKs/MacOSX10.4u.sdk/usr/include' ]
|
||||
BASELINKFLAGS += [ '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk' ]
|
||||
CORELIBPATH += [ '/Developer/SDKs/MacOSX10.4u.sdk/usr/lib' ]
|
||||
os.environ['NEXT_ROOT'] = '/Developer/SDKs/MacOSX10.4u.sdk'
|
||||
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.3'
|
||||
|
||||
if ( BUILD == 'debug-all' ):
|
||||
BASECPPFLAGS.append( '-g' )
|
||||
BASECPPFLAGS.append( '-D_DEBUG' )
|
||||
if ( ID_MCHECK == '0' ):
|
||||
ID_MCHECK = '1'
|
||||
elif ( BUILD == 'debug' ):
|
||||
BASECPPFLAGS.append( '-g' )
|
||||
BASECPPFLAGS.append( '-O1' )
|
||||
BASECPPFLAGS.append( '-D_DEBUG' )
|
||||
if ( ID_MCHECK == '0' ):
|
||||
ID_MCHECK = '1'
|
||||
elif ( BUILD == 'release' ):
|
||||
BASECPPFLAGS.append( '-D_FINAL' )
|
||||
if ( OS == 'Linux' ):
|
||||
# -fomit-frame-pointer: "-O also turns on -fomit-frame-pointer on machines where doing so does not interfere with debugging."
|
||||
# on x86 have to set it explicitely
|
||||
# -finline-functions: implicit at -O3
|
||||
# -fschedule-insns2: implicit at -O2
|
||||
# no-unsafe-math-optimizations: that should be on by default really. hit some wonko bugs in physics code because of that
|
||||
# 1.3 OPTCPPFLAGS = [ '-O3', '-march=pentium3', '-Winline', '-ffast-math', '-fno-unsafe-math-optimizations', '-fomit-frame-pointer' ]
|
||||
OPTCPPFLAGS = [ '-O3', '-march=i686', '-Winline', '-ffast-math', '-fomit-frame-pointer', '-finline-functions', '-fschedule-insns2' ]
|
||||
if ( ID_MCHECK == '0' ):
|
||||
ID_MCHECK = '2'
|
||||
elif ( OS == 'Darwin' ):
|
||||
OPTCPPFLAGS = [ '-O3', '-falign-functions=16', '-falign-loops=16', '-finline' ]
|
||||
elif ( BUILD == 'testing' ):
|
||||
BASELINKFLAGS.append( '--export-dynamic' )
|
||||
BASECPPFLAGS.append( '-D_FINAL' )
|
||||
if ( OS == 'Linux' ):
|
||||
OPTCPPFLAGS = [ '-O3', '-march=i686', '-DTIME_LIMITED_TEST', '-Winline', '-ffast-math', '-fomit-frame-pointer', '-finline-functions', '-fschedule-insns2' ]
|
||||
# 1.3 flags OPTCPPFLAGS = [ '-O3', '-march=pentium3', '-DTIME_LIMITED_TEST', '-Winline', '-ffast-math', '-fno-unsafe-math-optimizations', '-fomit-frame-pointer' ]
|
||||
if ( ID_MCHECK == '0' ):
|
||||
ID_MCHECK = '2'
|
||||
elif ( OS == 'Darwin' ):
|
||||
OPTCPPFLAGS = [ '-O3', '-falign-functions=16', '-falign-loops=16', '-finline' ]
|
||||
else:
|
||||
print 'Unknown build configuration ' + BUILD
|
||||
sys.exit(0)
|
||||
|
||||
if ( GL_HARDLINK != '0' ):
|
||||
CORECPPFLAGS.append( '-DID_GL_HARDLINK' )
|
||||
|
||||
if ( DEBUG_MEMORY != '0' ):
|
||||
BASECPPFLAGS += [ '-DID_DEBUG_MEMORY', '-DID_REDIRECT_NEWDELETE' ]
|
||||
|
||||
if ( LIBC_MALLOC != '1' ):
|
||||
BASECPPFLAGS.append( '-DUSE_LIBC_MALLOC=0' )
|
||||
|
||||
if ( len( IDNET_HOST ) ):
|
||||
CORECPPFLAGS.append( '-DIDNET_HOST=\\"%s\\"' % IDNET_HOST )
|
||||
|
||||
if ( ID_NOLANADDRESS != '0' ):
|
||||
CORECPPFLAGS.append( '-DID_NOLANADDRESS' )
|
||||
|
||||
if ( ID_MCHECK == '1' ):
|
||||
BASECPPFLAGS.append( '-DID_MCHECK' )
|
||||
|
||||
CORECPPFLAGS.append( '-DID_PATCHLEVEL=\\".%s\\"' % PATCHLEVEL )
|
||||
|
||||
# create the build environements
|
||||
|
||||
if ( FIX_INCLUDES == '1' ):
|
||||
CC = './sys/scons/fixincludes.py \'' + CC + '\''
|
||||
CXX = './sys/scons/fixincludes.py \'' + CXX + '\''
|
||||
|
||||
if ( FIX_SUPER == '1' ):
|
||||
CC = './sys/scons/fixsuper.py \'' + CC + '\''
|
||||
CXX = './sys/scons/fixsuper.py \'' + CXX + '\''
|
||||
|
||||
g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH, OS = OS )
|
||||
scons_utils.SetupUtils( g_base_env )
|
||||
g_base_env.Append( CXXFLAGS = [ '-Wno-invalid-offsetof' ] )
|
||||
|
||||
g_env = g_base_env.Copy()
|
||||
|
||||
g_env['CPPFLAGS'] += OPTCPPFLAGS
|
||||
g_env['CPPFLAGS'] += CORECPPFLAGS
|
||||
g_env['LINKFLAGS'] += CORELINKFLAGS
|
||||
|
||||
if ( BUILD != 'release' ):
|
||||
g_env_noopt = g_env.Copy()
|
||||
else:
|
||||
g_env_noopt = g_base_env.Copy()
|
||||
g_env_noopt['CPPFLAGS'] += CORECPPFLAGS
|
||||
# g_env_noopt.Append( CPPFLAGS = '-O1' )
|
||||
g_env_noopt['LINKFLAGS'] += CORELINKFLAGS
|
||||
|
||||
g_game_env = g_base_env.Copy()
|
||||
g_game_env['CPPFLAGS'] += OPTCPPFLAGS
|
||||
g_game_env['CPPFLAGS'] += GAMECPPFLAGS
|
||||
|
||||
# maintain this dangerous optimization off at all times
|
||||
g_env.Append( CPPFLAGS = '-fno-strict-aliasing' )
|
||||
g_env_noopt.Append( CPPFLAGS = '-fno-strict-aliasing' )
|
||||
g_game_env.Append( CPPFLAGS = '-fno-strict-aliasing' )
|
||||
|
||||
if ( int(JOBS) > 1 ):
|
||||
print 'Using buffered process output'
|
||||
silent = False
|
||||
if ( SILENT == '1' ):
|
||||
silent = True
|
||||
scons_utils.SetupBufferedOutput( g_env, silent )
|
||||
scons_utils.SetupBufferedOutput( g_game_env, silent )
|
||||
|
||||
# mark the globals
|
||||
|
||||
local_dedicated = 0
|
||||
# 0 for monolithic build
|
||||
local_gamedll = 1
|
||||
# carry around rather than using .a, avoids binutils bugs
|
||||
idlib_objects = []
|
||||
renlib_objects = []
|
||||
game_objects = []
|
||||
local_demo = 0
|
||||
# curl usage. there is a global toggle flag
|
||||
local_curl = 0
|
||||
curl_lib = []
|
||||
# if idlib should produce PIC objects ( depending on core or game inclusion )
|
||||
local_idlibpic = 0
|
||||
eventdefs = None
|
||||
# compile for SMP ( affects idlib and core )
|
||||
local_smp = 0
|
||||
idsdl_info = []
|
||||
|
||||
GLOBALS = 'g_env g_env_noopt g_game_env OS ID_MCHECK idlib_objects renlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic curl_lib local_curl local_smp idsdl_info eventdefs GL_HARDLINK NOCURL Q4TEST OSX_BUILDSTYLE TARGET_CORE_SMP BUILD GCC_X86_ASM'
|
||||
|
||||
# end general configuration ----------------------
|
||||
|
||||
# targets ----------------------------------------
|
||||
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
|
||||
quake4 = None
|
||||
q4ded = None
|
||||
game = None
|
||||
q4_mon = None
|
||||
|
||||
Default( None )
|
||||
|
||||
# build curl if needed
|
||||
if ( NOCURL == '0' and ( TARGET_CORE == '1' or TARGET_MONO == '1' ) ):
|
||||
# 1: debug, 2: release
|
||||
if ( BUILD == 'release' ):
|
||||
local_curl = 2
|
||||
else:
|
||||
local_curl = 1
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
curl_lib = SConscript( 'sys/scons/SConscript.curl' )
|
||||
|
||||
# build our custom SDL library if needed
|
||||
if ( TARGET_CORE_SMP == '1' ):
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
BuildDir( g_build + '/sdl', '.', duplicate = 0 )
|
||||
idsdl_info = SConscript( 'sys/scons/SConscript.idsdl' )
|
||||
|
||||
if ( TARGET_CORE_SMP == '1' ):
|
||||
local_gamedll = 1
|
||||
local_demo = 0
|
||||
local_idlibpic = 0
|
||||
local_dedicated = 0
|
||||
local_smp = 1
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
BuildDir( g_build + '/core-smp/glimp', '.', duplicate = 1 )
|
||||
SConscript( g_build + '/core-smp/glimp/sys/scons/SConscript.gl' )
|
||||
BuildDir( g_build + '/core-smp', '.', duplicate = 0 )
|
||||
idlib_objects = SConscript( g_build + '/core-smp/sys/scons/SConscript.idlib' )
|
||||
Export( 'GLOBALS ' + GLOBALS ) # update idlib_objects
|
||||
quake4smp = SConscript( g_build + '/core-smp/sys/scons/SConscript.core' )
|
||||
|
||||
if ( OS == 'Linux' ):
|
||||
Default( InstallAs( '#quake4smp.%s' % cpu, quake4smp ) )
|
||||
|
||||
if ( TARGET_CORE == '1' ):
|
||||
local_gamedll = 1
|
||||
local_demo = 0
|
||||
local_idlibpic = 0
|
||||
local_smp = 0
|
||||
if ( DEDICATED == '0' or DEDICATED == '2' ):
|
||||
local_dedicated = 0
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
|
||||
BuildDir( g_build + '/core/glimp', '.', duplicate = 1 )
|
||||
SConscript( g_build + '/core/glimp/sys/scons/SConscript.gl' )
|
||||
BuildDir( g_build + '/core', '.', duplicate = 0 )
|
||||
idlib_objects = SConscript( g_build + '/core/sys/scons/SConscript.idlib' )
|
||||
Export( 'GLOBALS ' + GLOBALS ) # update idlib_objects
|
||||
quake4 = SConscript( g_build + '/core/sys/scons/SConscript.core' )
|
||||
|
||||
if ( OS == 'Linux' ):
|
||||
Default( InstallAs( '#quake4.%s' % cpu, quake4 ) )
|
||||
|
||||
if ( DEDICATED == '1' or DEDICATED == '2' ):
|
||||
local_dedicated = 1
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
|
||||
BuildDir( g_build + '/dedicated/glimp', '.', duplicate = 1 )
|
||||
SConscript( g_build + '/dedicated/glimp/sys/scons/SConscript.gl' )
|
||||
BuildDir( g_build + '/dedicated', '.', duplicate = 0 )
|
||||
idlib_objects = SConscript( g_build + '/dedicated/sys/scons/SConscript.idlib' )
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
q4ded = SConscript( g_build + '/dedicated/sys/scons/SConscript.core' )
|
||||
|
||||
if ( OS == 'Linux' ):
|
||||
Default( InstallAs( '#q4ded.%s' % cpu, q4ded ) )
|
||||
|
||||
if ( TARGET_GAME == '1' ):
|
||||
local_gamedll = 1
|
||||
local_demo = 0
|
||||
local_dedicated = 0
|
||||
local_idlibpic = 0
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
dupe = 0
|
||||
if ( SDK == '1' ):
|
||||
# building an SDK, use scons for dependencies walking
|
||||
# clear the build directory to be safe
|
||||
g_env.PreBuildSDK( g_build + '/game', PATCHLEVEL )
|
||||
dupe = 1
|
||||
BuildDir( g_build + '/game', '.', duplicate = dupe )
|
||||
idlib_objects = SConscript( g_build + '/game/sys/scons/SConscript.botlib' )
|
||||
renlib_objects = SConscript( g_build + '/game/sys/scons/SConscript.renderer' )
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
game = SConscript( g_build + '/game/sys/scons/SConscript.quake3' )
|
||||
|
||||
if ( OS == 'Darwin' ):
|
||||
Default( InstallAs( '#game.so' , game ) )
|
||||
else:
|
||||
Default( InstallAs( '#shizzlefoo%s.so' % cpu, game ) )
|
||||
|
||||
if ( TARGET_MONO == '1' ):
|
||||
# the game in a single piece
|
||||
local_gamedll = 0
|
||||
local_dedicated = 0
|
||||
local_demo = 0
|
||||
local_idlibpic = 0
|
||||
if ( DEDICATED == '0' or DEDICATED == '2' ):
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
BuildDir( g_build + '/mono/glimp', '.', duplicate = 1 )
|
||||
SConscript( g_build + '/mono/glimp/sys/scons/SConscript.gl' )
|
||||
BuildDir( g_build + '/mono', '.', duplicate = 0 )
|
||||
idlib_objects = SConscript( g_build + '/mono/sys/scons/SConscript.idlib' )
|
||||
game_objects = SConscript( g_build + '/mono/sys/scons/SConscript.game' )
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
q4_mono = SConscript( g_build + '/mono/sys/scons/SConscript.core' )
|
||||
|
||||
if ( OS == 'Linux' ):
|
||||
Default( InstallAs( '#q4mono.%s' % cpu, q4_mono ) )
|
||||
|
||||
if ( DEDICATED == '1' or DEDICATED == '2' ):
|
||||
local_dedicated = 1
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
BuildDir( g_build + '/monoded/glimp', '.', duplicate = 1 )
|
||||
SConscript( g_build + '/monoded/glimp/sys/scons/SConscript.gl' )
|
||||
BuildDir( g_build + '/monoded', '.', duplicate = 0 )
|
||||
idlib_objects = SConscript( g_build + '/monoded/sys/scons/SConscript.idlib' )
|
||||
game_objects = SConscript( g_build + '/monoded/sys/scons/SConscript.game' )
|
||||
Export( 'GLOBALS ' + GLOBALS )
|
||||
q4_monoded = SConscript( g_build + '/monoded/sys/scons/SConscript.core' )
|
||||
|
||||
if ( OS == 'Linux' ):
|
||||
Default( InstallAs( '#q4monoded.%s' % cpu, q4_monoded ) )
|
||||
|
||||
if ( OS == 'Darwin' ):
|
||||
src = []
|
||||
if ( TARGET_CORE == '1' ):
|
||||
if ( DEDICATED == '0' or DEDICATED == '2' ):
|
||||
src.append( quake4 )
|
||||
if ( DEDICATED == '1' or DEDICATED == '2' ):
|
||||
src.append( q4ded )
|
||||
if ( TARGET_MONO == '1' ):
|
||||
if ( DEDICATED == '0' or DEDICATED == '2' ):
|
||||
src.append( q4_mono )
|
||||
if ( DEDICATED == '1' or DEDICATED == '2' ):
|
||||
src.append( q4_monoded )
|
||||
if ( len( src ) ):
|
||||
q4mac = Command( 'q4mac', src, Action( g_env.BuildBundle ) )
|
||||
Default( q4mac )
|
||||
|
||||
if ( SETUP == '1' ):
|
||||
brandelf = Program( 'brandelf', 'sys/linux/setup/brandelf.c' )
|
||||
setup_source = [ brandelf, quake4, q4ded, game, quake4smp ]
|
||||
do_gamepak = ( TARGET_GAMEPAK != '0' )
|
||||
setups = []
|
||||
if ( SETUP_TAGGED == '1' ):
|
||||
g_env_tagged = g_env.Copy()
|
||||
g_env_tagged.Prepare( do_gamepak, ASSETS, PATCHLEVEL )
|
||||
setup_tagged = Command( 'setup_tagged', setup_source, Action( g_env_tagged.BuildSetup ) )
|
||||
Default( setup_tagged )
|
||||
setups.append( setup_tagged )
|
||||
if ( SETUP_DEMO == '1' ):
|
||||
g_env_demo = g_env.Copy()
|
||||
g_env_demo.Prepare( do_gamepak, ASSETS, PATCHLEVEL )
|
||||
setup_demo = Command( 'setup_demo', setup_source, Action( g_env_demo.BuildSetup ) )
|
||||
Default( setup_demo )
|
||||
setups.append( setup_demo )
|
||||
if ( SETUP_DEDICATED == '1' ):
|
||||
g_env_ded = g_env.Copy()
|
||||
g_env_ded.Prepare( do_gamepak, ASSETS, PATCHLEVEL )
|
||||
setup_ded = Command( 'setup_ded', setup_source, Action( g_env_ded.BuildSetup ) )
|
||||
Default( setup_ded )
|
||||
setups.append( setup_ded )
|
||||
if ( SETUP_FULL == '1' ):
|
||||
g_env_full = g_env.Copy()
|
||||
g_env_full.Prepare( do_gamepak, ASSETS, PATCHLEVEL )
|
||||
setup_full = Command( 'setup_full', setup_source, Action( g_env_full.BuildSetup ) )
|
||||
Default( setup_full )
|
||||
setups.append( setup_full )
|
||||
# setup dependencies so they are built sequentially
|
||||
i = 1
|
||||
while ( i < len( setups ) ):
|
||||
Depends( setups[ i ], setups[ i - 1 ] )
|
||||
i += 1
|
||||
else:
|
||||
if ( TARGET_GAMEPAK == '1' ):
|
||||
game_pak = Command( 'gamepak', game, Action( g_env.BuildGamePak ) )
|
||||
Default( game_pak )
|
||||
|
||||
if ( SDK != '0' ):
|
||||
setup_sdk = Command( 'sdk', [ ], Action( g_env.BuildSDK ) )
|
||||
Default( setup_sdk )
|
||||
g_env.Depends( setup_sdk, game )
|
||||
|
||||
# end targets ------------------------------------
|
|
@ -19,57 +19,41 @@ if not _OPTIONS["quake3dir"] then
|
|||
error "quake3dir must be specified on the command-line"
|
||||
end
|
||||
|
||||
-- relative to the LUA script
|
||||
path_root = "../.."
|
||||
path_src = path_root.."/cnq3/code"
|
||||
path_build = path_root.."/.build"
|
||||
path_build = path_root.."/cnq3/build"
|
||||
path_bin = path_root.."/.bin"
|
||||
os.mkdir(path_bin)
|
||||
|
||||
abs_path_cnq3_repo = os.realpath(path_root.."/cnq3")
|
||||
abs_path_git_scripts = os.realpath(path_root.."/cnq3tools/git")
|
||||
abs_path_git_header = path.getabsolute(path_root.."/cnq3/code/qcommon/git.h") -- may not exist yet
|
||||
abs_path_q3 = os.realpath(_OPTIONS["quake3dir"])
|
||||
abs_path_bin = os.realpath(path_bin)
|
||||
-- relative to the makefile
|
||||
make_path_git_scripts = "../../../cnq3tools/git"
|
||||
make_path_git_header = "../../code/qcommon/git.h"
|
||||
make_path_bin = "../../../.bin"
|
||||
|
||||
local function LIN_CreateGitPreBuildCommand()
|
||||
abs_path_q3 = path.getabsolute(_OPTIONS["quake3dir"]) -- os.realpath won't work if we pass in an env. var. here
|
||||
|
||||
-- os.realpath is problematic on Linux
|
||||
local abs_path_script = path.getabsolute(string.format("%s/create_git_header.sh", abs_path_git_scripts))
|
||||
local function CreateGitPreBuildCommand(scriptExtension)
|
||||
|
||||
return string.format("cd \"%s\" && \"%s\" \"%s\"", abs_path_cnq3_repo, abs_path_script, abs_path_git_header)
|
||||
local make_path_script = string.format("%s/create_git_header%s", make_path_git_scripts, scriptExtension)
|
||||
|
||||
return string.format("\"%s\" \"%s\"", make_path_script, make_path_git_header)
|
||||
|
||||
end
|
||||
|
||||
local function WIN_CreateGitPreBuildCommand()
|
||||
local function CreateExeCopyPostBuildCommand(copyCommand, exeName, exeExtension)
|
||||
|
||||
local abs_path_script = os.realpath(string.format("%s/create_git_header.cmd", abs_path_git_scripts))
|
||||
local make_path_exe = string.format("%s/%s/%s%s", make_path_bin, "%{cfg.buildcfg}", exeName, exeExtension)
|
||||
|
||||
return string.format("cd \"%s\" && \"%s\" \"%s\"", abs_path_cnq3_repo, abs_path_script, abs_path_git_header)
|
||||
|
||||
end
|
||||
|
||||
local function LIN_CreateExeCopyPostBuildCommand(exeName)
|
||||
|
||||
-- os.realpath fails on Linux due to the %{cfg.buildcfg} token
|
||||
local abs_path_exe = path.getabsolute(string.format("%s/%s/%s", abs_path_bin, "%{cfg.buildcfg}", exeName))
|
||||
|
||||
return string.format("cp \"%s\" \"%s\"", abs_path_exe, abs_path_q3)
|
||||
|
||||
end
|
||||
|
||||
local function WIN_CreateExeCopyPostBuildCommand(exeName)
|
||||
|
||||
local abs_path_exe = os.realpath(string.format("%s/%s/%s.exe", abs_path_bin, "%{cfg.buildcfg}", exeName))
|
||||
|
||||
return string.format("copy \"%s\" \"%s\"", abs_path_exe, abs_path_q3)
|
||||
return string.format("%s \"%s\" \"%s\"", copyCommand, make_path_exe, abs_path_q3)
|
||||
|
||||
end
|
||||
|
||||
local function WIN_CreatePdbCopyPostBuildCommand(exeName)
|
||||
|
||||
local abs_path_pdb = string.format("%s\\%s\\%s.pdb", abs_path_bin, "%{cfg.buildcfg}", exeName)
|
||||
local make_path_pdb = string.format("%s/%s/%s.pdb", make_path_bin, "%{cfg.buildcfg}", exeName)
|
||||
|
||||
return string.format("copy \"%s\" \"%s\"", abs_path_pdb, abs_path_q3)
|
||||
return string.format("copy \"%s\" \"%s\"", make_path_pdb, abs_path_q3)
|
||||
|
||||
end
|
||||
|
||||
|
@ -215,6 +199,8 @@ local function ApplyExeProjectSettings(exeName, server)
|
|||
ApplyProjectSettings()
|
||||
|
||||
filter { }
|
||||
|
||||
targetname(exeName)
|
||||
|
||||
local server_sources =
|
||||
{
|
||||
|
@ -379,12 +365,12 @@ local function ApplyExeProjectSettings(exeName, server)
|
|||
-- it seems that "filter" doesn't work with "prebuildcommands", "postbuildcommands"
|
||||
filter { }
|
||||
if os.is("windows") then
|
||||
postbuildcommands { WIN_CreateExeCopyPostBuildCommand(exeName) }
|
||||
postbuildcommands { WIN_CreatePdbCopyPostBuildCommand(exeName) }
|
||||
prebuildcommands { WIN_CreateGitPreBuildCommand() }
|
||||
prebuildcommands { path.translate(CreateGitPreBuildCommand(".cmd"), "\\") }
|
||||
postbuildcommands { path.translate(CreateExeCopyPostBuildCommand("copy", exeName, ".exe"), "\\") }
|
||||
postbuildcommands { path.translate(WIN_CreatePdbCopyPostBuildCommand(exeName), "\\") }
|
||||
else
|
||||
postbuildcommands { LIN_CreateExeCopyPostBuildCommand(exeName) }
|
||||
prebuildcommands { LIN_CreateGitPreBuildCommand() }
|
||||
prebuildcommands { CreateGitPreBuildCommand(".sh") }
|
||||
postbuildcommands { CreateExeCopyPostBuildCommand("cp -u", exeName, "") }
|
||||
end
|
||||
|
||||
-- create VC++ debug settings
|
||||
|
@ -427,6 +413,11 @@ local function ApplyExeProjectSettings(exeName, server)
|
|||
|
||||
end
|
||||
|
||||
exe_suffix = "";
|
||||
if os.is("linux") then
|
||||
exe_suffix = "-x86"
|
||||
end
|
||||
|
||||
solution "cnq3"
|
||||
|
||||
location ( path_build.."/".._ACTION )
|
||||
|
@ -437,14 +428,14 @@ solution "cnq3"
|
|||
|
||||
kind "WindowedApp"
|
||||
language "C++"
|
||||
ApplyExeProjectSettings("cnq3", 0)
|
||||
ApplyExeProjectSettings("cnq3"..exe_suffix, 0)
|
||||
|
||||
project "cnq3-server"
|
||||
|
||||
kind "WindowedApp"
|
||||
language "C++"
|
||||
defines { "DEDICATED" }
|
||||
ApplyExeProjectSettings("cnq3-server", 1)
|
||||
ApplyExeProjectSettings("cnq3-server"..exe_suffix, 1)
|
||||
|
||||
project "botlib"
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
# -*- mode: python -*-
|
||||
# Quake4 build script
|
||||
# TTimo <ttimo@idsoftware.com>
|
||||
# http://scons.sourceforge.net
|
||||
|
||||
import sys, os
|
||||
import scons_utils
|
||||
|
||||
Import( 'GLOBALS' )
|
||||
Import( GLOBALS )
|
||||
|
||||
proj_list = scons_utils.ExtractSource( File( '#game.vcproj' ).abspath )
|
||||
|
||||
for i in range( len( proj_list ) ):
|
||||
proj_list[ i ] = '../../' + proj_list[ i ]
|
||||
|
||||
local_env = g_game_env.Copy()
|
||||
|
||||
if ( local_demo == 1 ):
|
||||
local_env.Append( CPPDEFINES = [ 'ID_DEMO_BUILD' ] )
|
||||
|
||||
if ( local_gamedll == 1 ):
|
||||
local_env.Append( CPPDEFINES = [ 'GAME_DLL' ] )
|
||||
ret = local_env.SharedLibrarySafe( local_env, 'game', proj_list + idlib_objects )
|
||||
if ( OSX_BUILDSTYLE == '2' ):
|
||||
local_env.Append( CPPFLAGS = [ '-fvisibility=hidden' ] )
|
||||
Return( 'ret' )
|
||||
else:
|
||||
local_env.Append( CPPDEFINES = [ 'GAME_MONO' ] )
|
||||
ret_list = []
|
||||
for i in proj_list:
|
||||
ret_list += local_env.StaticObject( source = i )
|
||||
Return( 'ret_list' )
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
# -*- mode: python -*-
|
||||
# Quake4 build script
|
||||
# TTimo <ttimo@idsoftware.com>
|
||||
# http://scons.sourceforge.net
|
||||
|
||||
import os.path, scons_utils
|
||||
|
||||
Import( 'GLOBALS' )
|
||||
Import( GLOBALS )
|
||||
|
||||
idlib_list = scons_utils.ExtractSource( File( '#idlib.vcproj' ).abspath )
|
||||
asm_files = [ 'idlib/math/Simd_MMX.cpp' ]
|
||||
|
||||
for i in asm_files:
|
||||
idlib_list.remove( i )
|
||||
|
||||
local_env = g_env.Copy()
|
||||
if ( local_smp == 1 and local_idlibpic == 0 ):
|
||||
# idlib compiled for SMP engine code needs the define
|
||||
local_env.Append( CPPDEFINES = [ 'ENABLE_INTEL_SMP' ] )
|
||||
if ( GCC_X86_ASM == '1' ):
|
||||
local_env.Append( CPPDEFINES = [ 'ID_GCC_X86_ASM' ] )
|
||||
|
||||
no_unsafe_env = local_env.Copy()
|
||||
no_unsafe_env.Append (CPPFLAGS = [ '-fno-unsafe-math-optimizations' ] )
|
||||
|
||||
with_asm_env = g_env_noopt.Copy()
|
||||
with_asm_env.Append( CPPFLAGS = [ '-masm=intel' ] )
|
||||
|
||||
ret_list = []
|
||||
for f in idlib_list:
|
||||
if ( local_idlibpic == 0 ):
|
||||
ret_list += local_env.StaticObject( source = os.path.join( '../..', f ) )
|
||||
else:
|
||||
ret_list += local_env.SharedObject( source = os.path.join( '../..', f ) )
|
||||
|
||||
if ( GCC_X86_ASM == '1' ):
|
||||
for f in asm_files:
|
||||
if ( local_idlibpic == 0 ):
|
||||
ret_list += with_asm_env.StaticObject( source = os.path.join( '../..', f ) )
|
||||
else:
|
||||
ret_list += with_asm_env.SharedObject( source = os.path.join( '../..', f ) )
|
||||
|
||||
|
||||
if ( local_idlibpic == 0 ):
|
||||
ret_list += no_unsafe_env.StaticObject( source = '../../idlib/math/Matrix_gcc.cpp' )
|
||||
else:
|
||||
ret_list += no_unsafe_env.SharedObject( source = '../../idlib/math/Matrix_gcc.cpp' )
|
||||
|
||||
Return( 'ret_list' )
|
|
@ -1,205 +0,0 @@
|
|||
# -*- mode: python -*-
|
||||
import sys, os, string, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile
|
||||
import SCons
|
||||
|
||||
# need an Environment and a matching buffered_spawn API .. encapsulate
|
||||
class idBuffering:
|
||||
|
||||
def buffered_spawn( self, sh, escape, cmd, args, env ):
|
||||
stderr = StringIO.StringIO()
|
||||
stdout = StringIO.StringIO()
|
||||
command_string = ''
|
||||
for i in args:
|
||||
if ( len( command_string ) ):
|
||||
command_string += ' '
|
||||
command_string += i
|
||||
try:
|
||||
retval = self.env['PSPAWN']( sh, escape, cmd, args, env, stdout, stderr )
|
||||
except OSError, x:
|
||||
if x.errno != 10:
|
||||
raise x
|
||||
print 'OSError ignored on command: %s' % command_string
|
||||
retval = 0
|
||||
print command_string
|
||||
sys.stdout.write( stdout.getvalue() )
|
||||
sys.stderr.write( stderr.getvalue() )
|
||||
return retval
|
||||
|
||||
class idSetupBase:
|
||||
|
||||
def SimpleCommand( self, cmd ):
|
||||
print cmd
|
||||
ret = commands.getstatusoutput( cmd )
|
||||
if ( len( ret[ 1 ] ) ):
|
||||
sys.stdout.write( ret[ 1 ] )
|
||||
sys.stdout.write( '\n' )
|
||||
if ( ret[ 0 ] != 0 ):
|
||||
raise 'command failed'
|
||||
return ret[ 1 ]
|
||||
|
||||
def TrySimpleCommand( self, cmd ):
|
||||
print cmd
|
||||
ret = commands.getstatusoutput( cmd )
|
||||
sys.stdout.write( ret[ 1 ] )
|
||||
|
||||
def M4Processing( self, file, d ):
|
||||
file_out = file[:-3]
|
||||
cmd = 'm4 '
|
||||
for ( key, val ) in d.items():
|
||||
cmd += '--define=%s="%s" ' % ( key, val )
|
||||
cmd += '%s > %s' % ( file, file_out )
|
||||
self.SimpleCommand( cmd )
|
||||
|
||||
def ExtractProtocolVersion( self ):
|
||||
f = open( 'framework/Licensee.h' )
|
||||
l = f.readlines()
|
||||
f.close()
|
||||
|
||||
major = 'X'
|
||||
p = re.compile( '^#define ASYNC_PROTOCOL_MAJOR\t*(.*)' )
|
||||
for i in l:
|
||||
if ( p.match( i ) ):
|
||||
major = p.match( i ).group(1)
|
||||
break
|
||||
|
||||
f = open( 'framework/async/AsyncNetwork.h' )
|
||||
l = f.readlines()
|
||||
f.close()
|
||||
|
||||
minor = 'X'
|
||||
p = re.compile( '^const int ASYNC_PROTOCOL_MINOR\t*= (.*);' )
|
||||
for i in l:
|
||||
if ( p.match( i ) ):
|
||||
minor = p.match( i ).group(1)
|
||||
break
|
||||
|
||||
return '%s.%s' % ( major, minor )
|
||||
|
||||
def ExtractEngineVersion( self ):
|
||||
f = open( 'framework/Licensee.h' )
|
||||
l = f.readlines()
|
||||
f.close()
|
||||
|
||||
version = 'X'
|
||||
p = re.compile( '^#define.*ENGINE_VERSION\t*"DOOM (.*)"' )
|
||||
for i in l:
|
||||
if ( p.match( i ) ):
|
||||
version = p.match( i ).group(1)
|
||||
break
|
||||
|
||||
return version
|
||||
|
||||
def ExtractBuildVersion( self ):
|
||||
f = open( 'framework/BuildVersion.h' )
|
||||
l = f.readlines()[ 4 ]
|
||||
f.close()
|
||||
pat = re.compile( '.* = (.*);\n' )
|
||||
return pat.split( l )[ 1 ]
|
||||
|
||||
def checkLDD( target, source, env ):
|
||||
file = target[0]
|
||||
if (not os.path.isfile(file.abspath)):
|
||||
print('ERROR: CheckLDD: target %s not found\n' % target[0])
|
||||
Exit(1)
|
||||
( status, output ) = commands.getstatusoutput( 'ldd -r %s' % file )
|
||||
if ( status != 0 ):
|
||||
print 'ERROR: ldd command returned with exit code %d' % ldd_ret
|
||||
os.system( 'rm %s' % target[ 0 ] )
|
||||
sys.exit(1)
|
||||
lines = string.split( output, '\n' )
|
||||
have_undef = 0
|
||||
for i_line in lines:
|
||||
#print repr(i_line)
|
||||
regex = re.compile('undefined symbol: (.*)\t\\((.*)\\)')
|
||||
if ( regex.match(i_line) ):
|
||||
symbol = regex.sub('\\1', i_line)
|
||||
try:
|
||||
env['ALLOWED_SYMBOLS'].index(symbol)
|
||||
except:
|
||||
have_undef = 1
|
||||
if ( have_undef ):
|
||||
print output
|
||||
print "ERROR: undefined symbols"
|
||||
os.system('rm %s' % target[0])
|
||||
sys.exit(1)
|
||||
|
||||
def SharedLibrarySafe( env, target, source ):
|
||||
ret = env.SharedLibrary( target, source )
|
||||
if ( env['OS'] != 'Darwin' ):
|
||||
env.AddPostAction( ret, checkLDD )
|
||||
return ret
|
||||
|
||||
def NotImplementedStub( *whatever ):
|
||||
print 'Not Implemented'
|
||||
sys.exit( 1 )
|
||||
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
# get a clean error output when running multiple jobs
|
||||
def SetupBufferedOutput( env ):
|
||||
buf = idBuffering()
|
||||
buf.env = env
|
||||
env['SPAWN'] = buf.buffered_spawn
|
||||
|
||||
# setup utilities on an environement
|
||||
def SetupUtils( env ):
|
||||
env.SharedLibrarySafe = SharedLibrarySafe
|
||||
if ( os.path.exists( 'sys/scons/SDK.py' ) ):
|
||||
import SDK
|
||||
sdk = SDK.idSDK()
|
||||
env.PreBuildSDK = sdk.PreBuildSDK
|
||||
env.BuildSDK = sdk.BuildSDK
|
||||
else:
|
||||
env.PreBuildSDK = NotImplementedStub
|
||||
env.BuildSDK = NotImplementedStub
|
||||
|
||||
if ( os.path.exists( 'sys/scons/Setup.py' ) ):
|
||||
import Setup
|
||||
setup = Setup.idSetup()
|
||||
env.Prepare = setup.Prepare
|
||||
env.BuildSetup = setup.BuildSetup
|
||||
env.BuildGamePak = setup.BuildGamePak
|
||||
else:
|
||||
env.Prepare = NotImplementedStub
|
||||
env.BuildSetup = NotImplementedStub
|
||||
env.BuildGamePak = NotImplementedStub
|
||||
|
||||
if ( os.path.exists( 'sys/scons/OSX.py' ) ):
|
||||
import OSX
|
||||
OSX = OSX.idOSX()
|
||||
env.BuildBundle = OSX.BuildBundle
|
||||
else:
|
||||
env.BuildBundle = NotImplementedStub
|
||||
|
||||
def BuildList( s_prefix, s_string ):
|
||||
s_list = string.split( s_string )
|
||||
for i in range( len( s_list ) ):
|
||||
s_list[ i ] = s_prefix + '/' + s_list[ i ]
|
||||
return s_list
|
||||
|
||||
def ExtractSource( file ):
|
||||
from xml.dom.minidom import parse
|
||||
dom = parse( file )
|
||||
files = dom.getElementsByTagName( 'File' )
|
||||
l = []
|
||||
for i in files:
|
||||
s = i.getAttribute( 'RelativePath' )
|
||||
s = s.encode('ascii', 'ignore')
|
||||
s = re.sub( '\\\\', '/', s )
|
||||
s = re.sub( '^\./', '', s )
|
||||
|
||||
# this is a bit of a hack, and should probably be thought about more.
|
||||
# if the file is excluded from the Release|win32 config it will be excluded in linux.
|
||||
# Not necessarily correct, but thats how it will be for now. Could add a linux config
|
||||
# if we get files that only want to exclude in one and not the other.
|
||||
exclude = 0
|
||||
configs = i.getElementsByTagName( 'FileConfiguration')
|
||||
for thisConfig in configs:
|
||||
if (string.lower(thisConfig.getAttribute('ExcludedFromBuild')) == 'true' and
|
||||
string.lower(thisConfig.getAttribute('Name')) == 'release|win32'):
|
||||
exclude = 1
|
||||
|
||||
if (exclude == 0) and (( string.lower( s[-4:] ) == '.cpp' or string.lower( s[-2:] ) == '.c' )):
|
||||
l.append( s )
|
||||
|
||||
return l
|
Loading…
Reference in a new issue