Ticket #32: scons_1.patch

File scons_1.patch, 27.6 KB (added by Carsten, 22 months ago)
  • CompilerSetup.py.tmpl

     
     1# -*- coding: utf-8 -*- 
     2from SCons.Script import * 
     3 
    14# Edit the settings and paths in this file as required for your system. 
    25 
    3 # The default compiler to be used for each platform. 
    4 # Note that this can easily be overridden at the command-line 
    5 # by the "cmp" parameter. Example: scons -Q cmp=vc8 
    6 defaultCompilerWin32="vc9";     # Valid values are "vc8" and "vc9". 
    7 defaultCompilerLinux="g++";     # Currently, only "g++" is a valid value. 
    86 
     7# envCommon is the common base environment for constructing all Cafu programs. 
     8# The base environment defines the target platform and architecture and the 
     9# compiler and other tools for the built. It is normally initialized without 
     10# any parameters, which means that the installed compiler and other details 
     11# are automatically detected. 
     12# 
     13# MSVC_VERSION sets the version of Visual C/C++ to use. 
     14#   Set it to an unexpected value (e.g. "XXX") to see the valid values for 
     15#   your system, such as "8.0", "8.0Exp", "9.0", "9.0Exp", "10.0", "10.0Exp". 
     16#   If not set, SCons will select the latest version of Visual C/C++ installed 
     17#   on your system. 
     18# 
     19# TARGET_ARCH sets the target architecture for the Visual C/C++ compiler. 
     20#   It it currently unused under Linux, where the host architecture determines 
     21#   the target architecture. Valid values are: 
     22#         "x86" or "i386" for 32 bit builds, 
     23#         "x86_64" or "amd64" for 64 bit builds, 
     24#         "ia64" for Itanium builds. 
     25# 
     26# Examples: 
     27#   # Print all valid values for MSVC_VERSION on your system. 
     28#   envCommon=Environment(MSVC_VERSION="XXX"); 
     29#      
     30#   # Use Visual C/C++ version 9 (2008), Express Edition. 
     31#   envCommon=Environment(MSVC_VERSION="9.0Exp"); 
     32#      
     33#   # Use the latest Visual C/C++ version for creating 32 bit binaries. 
     34#   envCommon=Environment(TARGET_ARCH="x86"); 
     35#      
     36#   # Use Visual C/C++ version 9 (2008) for creating 32 bit binaries. 
     37#   envCommon=Environment(MSVC_VERSION="9.0", TARGET_ARCH="x86"); 
     38# 
     39# See the SCons man page at 
     40# <http://www.scons.org/doc/2.0.0.final.0/HTML/scons-man.html> for full 
     41# details about possible parameters to Environment(). 
     42envCommon=Environment(); 
    943 
     44 
    1045# This string describes all program variants that should be built: 
    1146# Insert a "d" for having all code being built in the debug   variant. 
    1247# Insert a "p" for having all code being built in the profile variant. 
  • SConscript

     
    154154    #   Note that we only (want to) determine the right library path matching the used compiler here. 
    155155    #   The specific wx-version used (e.g. latest stable vs. trunk) is still determined locally (here), 
    156156    #   BUT if this is moved into the SConstruct file, also the wx-version (wxPath above) must be fixed there. 
    157     LibPath="/lib/"+compiler+"_lib" 
     157    LibPath="/lib/"+compiler 
     158    if wxEnv["TARGET_ARCH"]: LibPath += "_"+wxEnv["TARGET_ARCH"]; 
     159    LibPath += "_lib" 
    158160 
    159161    wxEnv.Append(CPPPATH=['ExtLibs/freetype/include'])      # Linux builds (must) use the systems freetype library instead. 
    160162    wxEnv.Append(LIBPATH = [wxPath+LibPath]) 
  • SConstruct

     
    1 import os, sys 
    2 import CompilerSetup 
     1import os, shutil, sys 
    32 
    43 
    54# See the SCons manual, http://www.scons.org/wiki/GoFastButton and the man page for more information about the next two lines. 
     
    109print "" 
    1110 
    1211 
    13 # Set the default compiler (platform dependent). 
    14 if sys.platform=="win32": 
    15     compiler=ARGUMENTS.get("cmp", CompilerSetup.defaultCompilerWin32) 
    16 elif sys.platform=="linux2": 
    17     compiler=ARGUMENTS.get("cmp", CompilerSetup.defaultCompilerLinux) 
    18 else: 
    19     print "Unknown platform '" + sys.platform + "'." 
    20     exit 
     12try: 
     13    import CompilerSetup 
     14except ImportError: 
     15    # In order to make getting started with the Cafu source code more convenient, install the 
     16    # CompilerSetup.py file from the related template file (which is under version control) automatically. 
     17    shutil.copy("CompilerSetup.py.tmpl", "CompilerSetup.py") 
     18    import CompilerSetup 
    2119 
    22 # Set the list of variants (debug, profile, release) that should be built. 
    23 BVs=ARGUMENTS.get("bv", CompilerSetup.buildVariants) 
     20# Import the (user-configured) base environment from the setup file. 
     21# The base environment is evaluated and further refined (e.g. with compiler-specific settings) below. 
     22envCommon=CompilerSetup.envCommon; 
    2423 
    2524 
    26 # Set the build directories. 
    27 my_build_dir="build/"+sys.platform+"/"+compiler 
    28 my_build_dir_dbg=my_build_dir+"/debug" 
    29 my_build_dir_rel=my_build_dir+"/release" 
    30 my_build_dir_prf=my_build_dir+"/profile" 
    31  
    32 CommonLibPaths=["#/ExtLibs/bullet/", 
    33                 "#/ExtLibs/freealut/", 
    34                 "#/ExtLibs/jpeg/", 
    35                 "#/ExtLibs/libogg/", 
    36                 "#/ExtLibs/libpng/", 
    37                 "#/ExtLibs/libvorbis/", 
    38                 "#/ExtLibs/lwo/", 
    39                 "#/ExtLibs/lua/", 
    40                 "#/ExtLibs/mpg123/", 
    41                 "#/ExtLibs/noise/", 
    42                 "#/ExtLibs/openal-soft/", 
    43                 "#/ExtLibs/zlib/", 
    44                 "#/Libs/"]; 
    45  
    46 if sys.platform=="win32": 
    47     # Only for Windows, as under Linux we must link to the systems freetype library. 
    48     CommonLibPaths.append("#/ExtLibs/freetype/"); 
    49  
    50 CommonLibPaths_dbg=[x+my_build_dir_dbg for x in CommonLibPaths]; 
    51 CommonLibPaths_rel=[x+my_build_dir_rel for x in CommonLibPaths]; 
    52 CommonLibPaths_prf=[x+my_build_dir_prf for x in CommonLibPaths]; 
    53  
    54  
    5525# This big if-else tree has a branch for each supported platform and each supported compiler. 
    5626# For the chosen combination of platform and compiler, it prepares the environments envDebug, envRelease and envProfile. 
    5727if sys.platform=="win32": 
    58     if compiler=="vc8": 
    59         ################################################ 
    60         ### Win32, Visual C++ 2005 (Express Edition) ### 
    61         ################################################ 
     28    if envCommon["MSVC_VERSION"] in ["8.0", "8.0Exp"]: 
     29        ############################## 
     30        ### Win32, Visual C++ 2005 ### 
     31        ############################## 
    6232 
     33        compiler="vc8" 
     34 
    6335        # Reference of commonly used compiler switches: 
    64         # /EHsc    Enable exception handling. 
    65         # /GR      Enable RTTI. 
    66         # /J       Treat char as unsigned char. 
    67         # /MT      Use multi-threaded run-time libraries (statically linked into the exe). Defines _MT. 
    68         # /MTd     Use multi-threaded debug run-time libraries (statically linked into the exe). Defines _DEBUG and _MT. 
    69         # /nologo  No version and name banner. 
    70         # /Od      Disable optimizations. 
    71         # /O2      Fastest possible code. 
    72         # /Ob2     Inline expansion at compilers discretion. 
    73         # /RTC1    Run-Time Error Checks: Catch release-build errors in debug build. 
    74         # /W3      Warning level. 
    75         # /WX      Treat warnings as errors. 
    76         # /Z7      Include full debug info. 
     36        # /EHsc  Enable exception handling. 
     37        # /GR    Enable RTTI. 
     38        # /J     Treat char as unsigned char. 
     39        # /MT    Use multi-threaded run-time libraries (statically linked into the exe). Defines _MT. 
     40        # /MTd   Use multi-threaded debug run-time libraries (statically linked into the exe). Defines _DEBUG and _MT. 
     41        # /Od    Disable optimizations. 
     42        # /O2    Fastest possible code. 
     43        # /Ob2   Inline expansion at compilers discretion. 
     44        # /RTC1  Run-Time Error Checks: Catch release-build errors in debug build. 
     45        # /W3    Warning level. 
     46        # /WX    Treat warnings as errors. 
     47        # /Z7    Include full debug info. 
    7748 
    7849        # Begin with an environment with settings that are common for debug, release and profile builds. 
    79         envCommon=Environment( 
    80             CCFLAGS = Split("/nologo /GR /EHsc"),   # CCFLAGS is also taken as the default value for CXXFLAGS. 
    81             CPPDEFINES = ["_CRT_SECURE_NO_DEPRECATE", "_CRT_NONSTDC_NO_DEPRECATE"], 
    82             LINKFLAGS = Split("/nologo /incremental:no")) 
     50        envCommon.Append(CCFLAGS = Split("/GR /EHsc"))   # CCFLAGS is also taken as the default value for CXXFLAGS. 
     51        envCommon.Append(CPPDEFINES = ["_CRT_SECURE_NO_DEPRECATE", "_CRT_NONSTDC_NO_DEPRECATE"]) 
     52        envCommon.Append(LINKFLAGS = Split("/incremental:no")) 
    8353 
    8454        # Explicitly instruct SCons to detect and use the Microsoft Platform SDK, as it is not among the default tools. 
    8555        # See thread "Scons 2010/01/17 doesn't look for MS SDK?" at <http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=2455554> 
     
    10070        envProfile.Append(CCFLAGS=Split("/MT /O2 /Ob2 /Z7")); 
    10171        envProfile.Append(LINKFLAGS=["/fixed:no", "/debug"]); 
    10272 
    103     elif compiler=="vc9": 
    104         ################################################ 
    105         ### Win32, Visual C++ 2008 (Express Edition) ### 
    106         ################################################ 
     73    elif envCommon["MSVC_VERSION"] in ["9.0", "9.0Exp"]: 
     74        ############################## 
     75        ### Win32, Visual C++ 2008 ### 
     76        ############################## 
    10777 
     78        compiler="vc9" 
     79 
    10880        # Reference of commonly used compiler switches: 
    10981        # Identical to the compiler switches for Visual C++ 2005, see there for more details. 
    11082 
    11183        # Begin with an environment with settings that are common for debug, release and profile builds. 
    112         envCommon=Environment( 
    113             CCFLAGS = Split("/nologo /GR /EHsc"),   # CCFLAGS is also taken as the default value for CXXFLAGS. 
    114             CPPDEFINES = ["_CRT_SECURE_NO_DEPRECATE", "_CRT_NONSTDC_NO_DEPRECATE"], 
    115             LINKFLAGS = Split("/nologo /incremental:no")) 
     84        envCommon.Append(CCFLAGS = Split("/GR /EHsc"))   # CCFLAGS is also taken as the default value for CXXFLAGS. 
     85        envCommon.Append(CPPDEFINES = ["_CRT_SECURE_NO_DEPRECATE", "_CRT_NONSTDC_NO_DEPRECATE"]) 
     86        envCommon.Append(LINKFLAGS = Split("/incremental:no")) 
    11687 
    11788        # Explicitly instruct SCons to detect and use the Microsoft Platform SDK, as it is not among the default tools. 
    11889        # See thread "Scons 2010/01/17 doesn't look for MS SDK?" at <http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=2455554> 
     
    133104        envProfile.Append(CCFLAGS=Split("/MT /O2 /Ob2 /Z7")); 
    134105        envProfile.Append(LINKFLAGS=["/fixed:no", "/debug"]); 
    135106 
    136     elif compiler=="ow": 
    137         ######################### 
    138         ### Win32, OpenWatcom ### 
    139         ######################### 
     107    elif envCommon["MSVC_VERSION"] in ["10.0", "10.0Exp"]: 
     108        ############################## 
     109        ### Win32, Visual C++ 2010 ### 
     110        ############################## 
    140111 
     112        compiler="vc10" 
     113 
    141114        # Reference of commonly used compiler switches: 
    142         # -5r     Pentium register based calling. 
    143         # -bt=nt  Compile for NT. 
    144         # -d2     Full debug info (required for wdw and wprof). 
    145         # -e25    Stop compilation after 25 errors. 
    146         # -od     No optimizations. 
    147         # -otexan Fastest possible code. 
    148         # -w8     Enable all warnings. 
    149         # -we     Treat warnings as errors. 
    150         # -zp8    8-byte structure alignment. 
    151         # -zq     Quiet operation. 
    152         # -xr     Enable Run-time type information. According to docs, comes with no execution (speed) penalty at all, except for the use of dynamic_cast. 
    153         # -xs     Enable exceptions. 
     115        # Identical to the compiler switches for Visual C++ 2005, see there for more details. 
    154116 
    155117        # Begin with an environment with settings that are common for debug, release and profile builds. 
    156         envCommon=Environment( 
    157             CXX = "wpp386", 
    158             CCFLAGS = Split("-e25 -zq -5r -bt=nt -xr -xs"),     # CCFLAGS is also taken as the default value for CXXFLAGS. 
    159             LINK = "wlink", 
    160             LINKFLAGS = ["option quiet"]) 
     118        envCommon.Append(CCFLAGS = Split("/GR /EHsc"))   # CCFLAGS is also taken as the default value for CXXFLAGS. 
     119        envCommon.Append(CPPDEFINES = ["_CRT_SECURE_NO_DEPRECATE", "_CRT_NONSTDC_NO_DEPRECATE"]) 
     120        envCommon.Append(LINKFLAGS = Split("/incremental:no")) 
    161121 
    162         # Compiler system environment paths. 
    163         watcom_base="D:\\Programme\\OpenWatcom\\OW13RC3" 
     122        # Explicitly instruct SCons to detect and use the Microsoft Platform SDK, as it is not among the default tools. 
     123        # See thread "Scons 2010/01/17 doesn't look for MS SDK?" at <http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=2455554> 
     124        # for further information. 
     125        envCommon.Tool('mssdk') 
    164126 
    165         envCommon['ENV']['PATH'   ]="%s\\binnt;%s\\binw" % (watcom_base, watcom_base) 
    166         envCommon['ENV']['INCLUDE']="%s\\h;%s\\h\\nt" % (watcom_base, watcom_base) 
    167         envCommon['ENV']['LIB'    ]="%s\\lib386;%s\\lib386\\nt" % (watcom_base, watcom_base) 
    168  
    169  
    170127        # Environment for debug builds: 
    171128        envDebug=envCommon.Clone(); 
    172         envDebug.Append(CCFLAGS=Split("-d2 -od")); 
    173         envDebug.Append(LINKFLAGS=["debug all"]); 
     129        envDebug.Append(CCFLAGS=Split("/MTd /Od /Z7 /RTC1")); 
     130        envDebug.Append(LINKFLAGS=["/debug"]); 
    174131 
    175132        # Environment for release builds: 
    176133        envRelease=envCommon.Clone(); 
    177         envRelease.Append(CCFLAGS=Split("-zp8 -otexan")); 
     134        envRelease.Append(CCFLAGS=Split("/MT /O2 /Ob2")); 
    178135 
    179136        # Environment for profile builds: 
    180137        envProfile=envCommon.Clone(); 
    181         envProfile.Append(CCFLAGS=Split("-zp8 -otexan -d2")); 
    182         envProfile.Append(LINKFLAGS=["debug all"]); 
     138        envProfile.Append(CCFLAGS=Split("/MT /O2 /Ob2 /Z7")); 
     139        envProfile.Append(LINKFLAGS=["/fixed:no", "/debug"]); 
    183140 
    184141    else: 
    185142        ############################### 
    186143        ### Win32, unknown compiler ### 
    187144        ############################### 
    188145 
    189         print "Unknown compiler " + compiler + " on platform " + sys.platform + "." 
     146        print "Unknown compiler on platform " + sys.platform + "." 
    190147        exit 
    191148 
    192149elif sys.platform=="linux2": 
    193     if compiler=="g++": 
     150    if envCommon["CXX"]=="g++": 
    194151        ################## 
    195152        ### Linux, g++ ### 
    196153        ################## 
    197154 
     155        compiler="g++" 
     156 
    198157        # Begin with an environment with settings that are common for debug, release and profile builds. 
    199         envCommon=Environment( 
    200             CCFLAGS = Split(""))     # CCFLAGS is also taken as the default value for CXXFLAGS. 
     158        envCommon.Append(CCFLAGS = Split(""))   # CCFLAGS is also taken as the default value for CXXFLAGS. 
    201159 
    202160        # Environment for debug builds: 
    203161        envDebug=envCommon.Clone(); 
     
    217175        ### Linux, unknown compiler ### 
    218176        ############################### 
    219177 
    220         print "Unknown compiler " + compiler + " on platform " + sys.platform + "." 
     178        print "Unknown compiler " + envCommon["CXX"] + " on platform " + sys.platform + "." 
    221179        exit 
    222180 
    223181else: 
     
    233191### Build all external libraries ### 
    234192#################################### 
    235193 
    236 if "d" in BVs: SConscript('ExtLibs/bullet/src/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/bullet/"+my_build_dir_dbg, duplicate=0) 
    237 if "r" in BVs: SConscript('ExtLibs/bullet/src/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/bullet/"+my_build_dir_rel, duplicate=0) 
    238 if "p" in BVs: SConscript('ExtLibs/bullet/src/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/bullet/"+my_build_dir_prf, duplicate=0) 
     194# Set the list of variants (debug, profile, release) that should be built. 
     195BVs=ARGUMENTS.get("bv", CompilerSetup.buildVariants) 
    239196 
    240 if "d" in BVs: SConscript('ExtLibs/freealut/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/freealut/"+my_build_dir_dbg, duplicate=0) 
    241 if "r" in BVs: SConscript('ExtLibs/freealut/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/freealut/"+my_build_dir_rel, duplicate=0) 
    242 if "p" in BVs: SConscript('ExtLibs/freealut/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/freealut/"+my_build_dir_prf, duplicate=0) 
     197# Set the build directories. 
     198my_build_dir="build/"+sys.platform+"/"+compiler 
     199if envCommon["TARGET_ARCH"]: my_build_dir += "/"+envCommon["TARGET_ARCH"]; 
    243200 
    244 if "d" in BVs: SConscript('ExtLibs/freetype/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/freetype/"+my_build_dir_dbg, duplicate=0) 
    245 if "r" in BVs: SConscript('ExtLibs/freetype/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/freetype/"+my_build_dir_rel, duplicate=0) 
    246 if "p" in BVs: SConscript('ExtLibs/freetype/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/freetype/"+my_build_dir_prf, duplicate=0) 
     201my_build_dir_dbg=my_build_dir+"/debug" 
     202my_build_dir_rel=my_build_dir+"/release" 
     203my_build_dir_prf=my_build_dir+"/profile" 
    247204 
    248 if "d" in BVs: SConscript('ExtLibs/jpeg/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/jpeg/"+my_build_dir_dbg, duplicate=0) 
    249 if "r" in BVs: SConscript('ExtLibs/jpeg/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/jpeg/"+my_build_dir_rel, duplicate=0) 
    250 if "p" in BVs: SConscript('ExtLibs/jpeg/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/jpeg/"+my_build_dir_prf, duplicate=0) 
    251205 
    252 if "d" in BVs: SConscript('ExtLibs/libogg/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/libogg/"+my_build_dir_dbg, duplicate=0) 
    253 if "r" in BVs: SConscript('ExtLibs/libogg/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/libogg/"+my_build_dir_rel, duplicate=0) 
    254 if "p" in BVs: SConscript('ExtLibs/libogg/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/libogg/"+my_build_dir_prf, duplicate=0) 
     206for lib_name in ["bullet", "freealut", "freetype", "jpeg", "libogg", "libpng", "libvorbis", "lwo", "lua", "mpg123", "noise", "openal-soft", "zlib"]: 
     207    s_name=lib_name 
    255208 
    256 if "d" in BVs: SConscript('ExtLibs/libpng/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/libpng/"+my_build_dir_dbg, duplicate=0) 
    257 if "r" in BVs: SConscript('ExtLibs/libpng/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/libpng/"+my_build_dir_rel, duplicate=0) 
    258 if "p" in BVs: SConscript('ExtLibs/libpng/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/libpng/"+my_build_dir_prf, duplicate=0) 
     209    if lib_name=="openal-soft" and sys.platform=="win32": continue;     # OpenAL-Soft is not built on Windows, use the OpenAL Windows SDK there. 
     210    if lib_name=="bullet": s_name+="/src"; 
     211    if lib_name=="lua":    s_name+="/src"; 
     212    if lib_name=="mpg123": s_name+="/src/libmpg123"; 
    259213 
    260 if "d" in BVs: SConscript('ExtLibs/libvorbis/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/libvorbis/"+my_build_dir_dbg, duplicate=0) 
    261 if "r" in BVs: SConscript('ExtLibs/libvorbis/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/libvorbis/"+my_build_dir_rel, duplicate=0) 
    262 if "p" in BVs: SConscript('ExtLibs/libvorbis/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/libvorbis/"+my_build_dir_prf, duplicate=0) 
     214    if "d" in BVs: SConscript("ExtLibs/"+s_name+"/SConscript", exports={ "env": envDebug },   variant_dir="ExtLibs/"+lib_name+"/"+my_build_dir_dbg, duplicate=0) 
     215    if "r" in BVs: SConscript("ExtLibs/"+s_name+"/SConscript", exports={ "env": envRelease }, variant_dir="ExtLibs/"+lib_name+"/"+my_build_dir_rel, duplicate=0) 
     216    if "p" in BVs: SConscript("ExtLibs/"+s_name+"/SConscript", exports={ "env": envProfile }, variant_dir="ExtLibs/"+lib_name+"/"+my_build_dir_prf, duplicate=0) 
    263217 
    264 if "d" in BVs: SConscript('ExtLibs/lwo/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/lwo/"+my_build_dir_dbg, duplicate=0) 
    265 if "r" in BVs: SConscript('ExtLibs/lwo/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/lwo/"+my_build_dir_rel, duplicate=0) 
    266 if "p" in BVs: SConscript('ExtLibs/lwo/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/lwo/"+my_build_dir_prf, duplicate=0) 
    267218 
    268 if "d" in BVs: SConscript('ExtLibs/lua/src/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/lua/"+my_build_dir_dbg, duplicate=0) 
    269 if "r" in BVs: SConscript('ExtLibs/lua/src/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/lua/"+my_build_dir_rel, duplicate=0) 
    270 if "p" in BVs: SConscript('ExtLibs/lua/src/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/lua/"+my_build_dir_prf, duplicate=0) 
    271  
    272 if "d" in BVs: SConscript('ExtLibs/mpg123/src/libmpg123/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/mpg123/"+my_build_dir_dbg, duplicate=0) 
    273 if "r" in BVs: SConscript('ExtLibs/mpg123/src/libmpg123/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/mpg123/"+my_build_dir_rel, duplicate=0) 
    274 if "p" in BVs: SConscript('ExtLibs/mpg123/src/libmpg123/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/mpg123/"+my_build_dir_prf, duplicate=0) 
    275  
    276 if "d" in BVs: SConscript('ExtLibs/noise/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/noise/"+my_build_dir_dbg, duplicate=0) 
    277 if "r" in BVs: SConscript('ExtLibs/noise/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/noise/"+my_build_dir_rel, duplicate=0) 
    278 if "p" in BVs: SConscript('ExtLibs/noise/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/noise/"+my_build_dir_prf, duplicate=0) 
    279  
    280 if sys.platform!="win32": 
    281     # OpenAL-Soft is not built on Windows, use the OpenAL Windows SDK there. 
    282     if "d" in BVs: SConscript('ExtLibs/openal-soft/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/openal-soft/"+my_build_dir_dbg, duplicate=0) 
    283     if "r" in BVs: SConscript('ExtLibs/openal-soft/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/openal-soft/"+my_build_dir_rel, duplicate=0) 
    284     if "p" in BVs: SConscript('ExtLibs/openal-soft/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/openal-soft/"+my_build_dir_prf, duplicate=0) 
    285  
    286 if "d" in BVs: SConscript('ExtLibs/zlib/SConscript', exports={'env':envDebug},   variant_dir="ExtLibs/zlib/"+my_build_dir_dbg, duplicate=0) 
    287 if "r" in BVs: SConscript('ExtLibs/zlib/SConscript', exports={'env':envRelease}, variant_dir="ExtLibs/zlib/"+my_build_dir_rel, duplicate=0) 
    288 if "p" in BVs: SConscript('ExtLibs/zlib/SConscript', exports={'env':envProfile}, variant_dir="ExtLibs/zlib/"+my_build_dir_prf, duplicate=0) 
    289  
    290219# Compile wxWidgets for the current platform. 
    291220if sys.platform=="win32": 
    292     # Make sure the "compiler" string begins with "vc" and is three characters long. 
    293     if compiler[0]=='v' and compiler[1]=='c' and len(compiler)==3: 
    294         result=envDebug.  Execute("nmake /nologo /f makefile.vc BUILD=debug   SHARED=0 USE_OPENGL=1 RUNTIME_LIBS=static COMPILER_PREFIX="+compiler, chdir="ExtLibs/wxWidgets/build/msw"); 
     221    if compiler.startswith("vc"): 
     222        c_prefix="COMPILER_PREFIX="+compiler 
     223        if envCommon["TARGET_ARCH"]: c_prefix += "_"+envCommon["TARGET_ARCH"]; 
     224 
     225        if   envCommon["TARGET_ARCH"] in ["x86_64", "amd64", "emt64"]: target_cpu=" TARGET_CPU=AMD64" 
     226        elif envCommon["TARGET_ARCH"] in ["ia64"]:                     target_cpu=" TARGET_CPU=IA64" 
     227        else:                                                          target_cpu="" 
     228 
     229        result=envDebug.  Execute("nmake /nologo /f makefile.vc BUILD=debug   SHARED=0 USE_OPENGL=1 RUNTIME_LIBS=static "+c_prefix+target_cpu, chdir="ExtLibs/wxWidgets/build/msw"); 
    295230        if (result!=0): envDebug.  Exit(result); 
    296         result=envRelease.Execute("nmake /nologo /f makefile.vc BUILD=release SHARED=0 USE_OPENGL=1 RUNTIME_LIBS=static COMPILER_PREFIX="+compiler, chdir="ExtLibs/wxWidgets/build/msw"); 
     231        result=envRelease.Execute("nmake /nologo /f makefile.vc BUILD=release SHARED=0 USE_OPENGL=1 RUNTIME_LIBS=static "+c_prefix+target_cpu, chdir="ExtLibs/wxWidgets/build/msw"); 
    297232        if (result!=0): envRelease.Exit(result); 
    298233        print "";   # Print just another empty line for better visual separation. 
    299234 
     
    335270    envRelease.Install(".", ["#/ExtLibs/Cg/bin/cg.dll", "#/ExtLibs/Cg/bin/cgGL.dll"]); 
    336271    envRelease.Install(".", ["#/ExtLibs/fmod/api/fmod.dll"]); 
    337272    envRelease.Install(".", ["#/ExtLibs/openal-win/OpenAL32.dll", "#/ExtLibs/openal-win/wrap_oal.dll"]); 
     273 
    338274    if "r" in BVs: 
    339275        envRelease.Install(".", ["#/ExtLibs/freealut/"+my_build_dir_rel+"/alut.dll"]); 
    340276        envRelease.Install(".", ["#/ExtLibs/mpg123/"+my_build_dir_rel+"/mpg123.dll"]); 
     277 
    341278    else: 
    342279        envRelease.Install(".", ["#/ExtLibs/freealut/"+my_build_dir_dbg+"/alut.dll"]); 
    343280        envRelease.Install(".", ["#/ExtLibs/mpg123/"+my_build_dir_dbg+"/mpg123.dll"]); 
     
    345282elif sys.platform=="linux2": 
    346283    envRelease.Install(".", ["#/ExtLibs/Cg/lib/libCg.so", "#/ExtLibs/Cg/lib/libCgGL.so"]); 
    347284    envRelease.Install(".", ["#/ExtLibs/fmod/api/libfmod-3.75.so"]); 
     285 
    348286    if "r" in BVs: 
    349287        envRelease.Install(".", ["#/ExtLibs/freealut/"+my_build_dir_rel+"/libalut.so"]); 
    350288        envRelease.Install(".", ["#/ExtLibs/mpg123/"+my_build_dir_rel+"/libmpg123.so"]); 
    351289        envRelease.Install(".", ["#/ExtLibs/openal-soft/"+my_build_dir_rel+"/libopenal.so"]); 
     290 
    352291    else: 
    353292        envRelease.Install(".", ["#/ExtLibs/freealut/"+my_build_dir_dbg+"/libalut.so"]); 
    354293        envRelease.Install(".", ["#/ExtLibs/mpg123/"+my_build_dir_dbg+"/libmpg123.so"]); 
     
    359298### Update the construction environments ### 
    360299############################################ 
    361300 
     301CommonLibPaths=["#/ExtLibs/bullet/", 
     302                "#/ExtLibs/freealut/", 
     303                "#/ExtLibs/jpeg/", 
     304                "#/ExtLibs/libogg/", 
     305                "#/ExtLibs/libpng/", 
     306                "#/ExtLibs/libvorbis/", 
     307                "#/ExtLibs/lwo/", 
     308                "#/ExtLibs/lua/", 
     309                "#/ExtLibs/mpg123/", 
     310                "#/ExtLibs/noise/", 
     311                "#/ExtLibs/openal-soft/", 
     312                "#/ExtLibs/zlib/", 
     313                "#/Libs/"]; 
     314 
     315if sys.platform=="win32": 
     316    # Only for Windows, as under Linux we must link to the systems freetype library. 
     317    CommonLibPaths.append("#/ExtLibs/freetype/"); 
     318 
     319CommonLibPaths_dbg=[x+my_build_dir_dbg for x in CommonLibPaths]; 
     320CommonLibPaths_rel=[x+my_build_dir_rel for x in CommonLibPaths]; 
     321CommonLibPaths_prf=[x+my_build_dir_prf for x in CommonLibPaths]; 
     322 
     323 
    362324# Note that modifying the original environments here affects the build of the external libraries above! 
    363325envDebug_Cafu  =envDebug.Clone(); 
    364326envRelease_Cafu=envRelease.Clone(); 
     
    380342    envDebug_Cafu  .Append(CCFLAGS=Split("/J /W3 /WX")); 
    381343    envRelease_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
    382344    envProfile_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
     345 
    383346elif compiler=="vc9": 
    384347    envDebug_Cafu  .Append(CCFLAGS=Split("/J /W3 /WX")); 
    385348    envRelease_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
    386349    envProfile_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
    387 elif compiler=="ow": 
    388     envDebug_Cafu  .Append(CCFLAGS=Split("-w8 -we")); 
    389     envRelease_Cafu.Append(CCFLAGS=Split("-w8 -we")); 
    390     envProfile_Cafu.Append(CCFLAGS=Split("-w8 -we")); 
     350 
     351elif compiler=="vc10": 
     352    envDebug_Cafu  .Append(CCFLAGS=Split("/J /W3 /WX")); 
     353    envRelease_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
     354    envProfile_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
     355 
    391356elif compiler=="g++": 
    392357    envDebug_Cafu  .Append(CCFLAGS=Split("-funsigned-char -Wall -Werror -Wno-char-subscripts")); 
    393358    envRelease_Cafu.Append(CCFLAGS=Split("-funsigned-char -Wall -Werror -Wno-char-subscripts -fno-strict-aliasing"));