Changeset 104

Show
Ignore:
Timestamp:
07/25/10 00:16:13 (22 months ago)
Author:
Carsten
Message:

The change improves the build system:

  • With MS Visual C/C++, the compiler is now auto-detected (or properly user specified) and subsequent compiler detail settings evaluate and refine the previously detected or specified compiler. Previously, the user was forced to specify the compiler and then the auto-detection could detect and inadvertently use a different compiler version.
  • With MS Visual C/C++, the target architecture (x86, x86_64 or ia64) is now taken into account. Parallel builds for different architectures are now possible, as each gets a separate directory tree.
  • Preliminary support for MS Visual C/C++ 10.0 (2010) has been added. It's currently not very useful though --  SCons itself does not yet support the 10.0 version.

The attached patch has been successfully tested on various systems as described in ticket #32.
Closes #32.

Update notice: Stale files CompilerSetup.py and CompilerSetup.pyc should be deleted when this changeset is first checked out on a previously used repository.

Location:
cafu/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/CompilerSetup.py.tmpl

    r41 r104  
     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. 
     6 
     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(); 
    843 
    944 
  • cafu/trunk/SConscript

    r59 r104  
    157157    LibPath="/lib/"+compiler+"_lib" 
    158158 
     159    # Append wxWidgets-specific suffixes matching the TARGET_CPU setting for the Makefiles. 
     160    if   wxEnv["TARGET_ARCH"] in ["x86_64", "amd64", "emt64"]: LibPath += "_amd64" 
     161    elif wxEnv["TARGET_ARCH"] in ["ia64"]:                     LibPath += "_ia64" 
     162 
    159163    wxEnv.Append(CPPPATH=['ExtLibs/freetype/include'])      # Linux builds (must) use the systems freetype library instead. 
    160164    wxEnv.Append(LIBPATH = [wxPath+LibPath]) 
  • cafu/trunk/SConstruct

    r85 r104  
    1 import os, sys 
    2 import CompilerSetup 
     1import os, shutil, sys 
    32 
    43 
     
    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 
    21  
    22 # Set the list of variants (debug, profile, release) that should be built. 
    23 BVs=ARGUMENTS.get("bv", CompilerSetup.buildVariants) 
    24  
    25  
    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]; 
     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 
     19 
     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; 
    5323 
    5424 
     
    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        ############################## 
     32 
     33        compiler="vc8" 
    6234 
    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. 
     
    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        ############################## 
     77 
     78        compiler="vc9" 
    10779 
    10880        # Reference of commonly used compiler switches: 
     
    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. 
     
    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        ############################## 
     111 
     112        compiler="vc10" 
    140113 
    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"]) 
    161  
    162         # Compiler system environment paths. 
    163         watcom_base="D:\\Programme\\OpenWatcom\\OW13RC3" 
    164  
    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  
     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")) 
     121 
     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') 
    169126 
    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: 
     
    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: 
     
    218176        ############################### 
    219177 
    220         print "Unknown compiler " + compiler + " on platform " + sys.platform + "." 
     178        print "Unknown compiler " + envCommon["CXX"] + " on platform " + sys.platform + "." 
    221179        exit 
    222180 
     
    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) 
    239  
    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) 
    243  
    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) 
    247  
    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) 
    251  
    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) 
    255  
    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) 
    259  
    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) 
    263  
    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) 
    267  
    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) 
     194# Set the list of variants (debug, profile, release) that should be built. 
     195BVs=ARGUMENTS.get("bv", CompilerSetup.buildVariants) 
     196 
     197# Set the build directories. 
     198my_build_dir="build/"+sys.platform+"/"+compiler 
     199if envCommon["TARGET_ARCH"]: my_build_dir += "/"+envCommon["TARGET_ARCH"]; 
     200 
     201my_build_dir_dbg=my_build_dir+"/debug" 
     202my_build_dir_rel=my_build_dir+"/release" 
     203my_build_dir_prf=my_build_dir+"/profile" 
     204 
     205 
     206for lib_name in ["bullet", "freealut", "freetype", "jpeg", "libogg", "libpng", "libvorbis", "lwo", "lua", "mpg123", "noise", "openal-soft", "zlib"]: 
     207    s_name=lib_name 
     208 
     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"; 
     213 
     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) 
     217 
    289218 
    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        # If we target a non-x86 architecture, the Makefiles automatically append a suffix to the directory names (no need to tweak COMPILER_PREFIX). 
     223        if   envCommon["TARGET_ARCH"] in ["x86_64", "amd64", "emt64"]: target_cpu=" TARGET_CPU=AMD64" 
     224        elif envCommon["TARGET_ARCH"] in ["ia64"]:                     target_cpu=" TARGET_CPU=IA64" 
     225        else:                                                          target_cpu="" 
     226 
     227        result=envDebug.  Execute("nmake /nologo /f makefile.vc BUILD=debug   SHARED=0 USE_OPENGL=1 RUNTIME_LIBS=static COMPILER_PREFIX="+compiler+target_cpu, chdir="ExtLibs/wxWidgets/build/msw"); 
    295228        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"); 
     229        result=envRelease.Execute("nmake /nologo /f makefile.vc BUILD=release SHARED=0 USE_OPENGL=1 RUNTIME_LIBS=static COMPILER_PREFIX="+compiler+target_cpu, chdir="ExtLibs/wxWidgets/build/msw"); 
    297230        if (result!=0): envRelease.Exit(result); 
    298231        print "";   # Print just another empty line for better visual separation. 
     
    336269    envRelease.Install(".", ["#/ExtLibs/fmod/api/fmod.dll"]); 
    337270    envRelease.Install(".", ["#/ExtLibs/openal-win/OpenAL32.dll", "#/ExtLibs/openal-win/wrap_oal.dll"]); 
     271 
    338272    if "r" in BVs: 
    339273        envRelease.Install(".", ["#/ExtLibs/freealut/"+my_build_dir_rel+"/alut.dll"]); 
    340274        envRelease.Install(".", ["#/ExtLibs/mpg123/"+my_build_dir_rel+"/mpg123.dll"]); 
     275 
    341276    else: 
    342277        envRelease.Install(".", ["#/ExtLibs/freealut/"+my_build_dir_dbg+"/alut.dll"]); 
     
    346281    envRelease.Install(".", ["#/ExtLibs/Cg/lib/libCg.so", "#/ExtLibs/Cg/lib/libCgGL.so"]); 
    347282    envRelease.Install(".", ["#/ExtLibs/fmod/api/libfmod-3.75.so"]); 
     283 
    348284    if "r" in BVs: 
    349285        envRelease.Install(".", ["#/ExtLibs/freealut/"+my_build_dir_rel+"/libalut.so"]); 
    350286        envRelease.Install(".", ["#/ExtLibs/mpg123/"+my_build_dir_rel+"/libmpg123.so"]); 
    351287        envRelease.Install(".", ["#/ExtLibs/openal-soft/"+my_build_dir_rel+"/libopenal.so"]); 
     288 
    352289    else: 
    353290        envRelease.Install(".", ["#/ExtLibs/freealut/"+my_build_dir_dbg+"/libalut.so"]); 
     
    360297############################################ 
    361298 
     299CommonLibPaths=["#/ExtLibs/bullet/", 
     300                "#/ExtLibs/freealut/", 
     301                "#/ExtLibs/jpeg/", 
     302                "#/ExtLibs/libogg/", 
     303                "#/ExtLibs/libpng/", 
     304                "#/ExtLibs/libvorbis/", 
     305                "#/ExtLibs/lwo/", 
     306                "#/ExtLibs/lua/", 
     307                "#/ExtLibs/mpg123/", 
     308                "#/ExtLibs/noise/", 
     309                "#/ExtLibs/openal-soft/", 
     310                "#/ExtLibs/zlib/", 
     311                "#/Libs/"]; 
     312 
     313if sys.platform=="win32": 
     314    # Only for Windows, as under Linux we must link to the systems freetype library. 
     315    CommonLibPaths.append("#/ExtLibs/freetype/"); 
     316 
     317CommonLibPaths_dbg=[x+my_build_dir_dbg for x in CommonLibPaths]; 
     318CommonLibPaths_rel=[x+my_build_dir_rel for x in CommonLibPaths]; 
     319CommonLibPaths_prf=[x+my_build_dir_prf for x in CommonLibPaths]; 
     320 
     321 
    362322# Note that modifying the original environments here affects the build of the external libraries above! 
    363323envDebug_Cafu  =envDebug.Clone(); 
     
    381341    envRelease_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
    382342    envProfile_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
     343 
    383344elif compiler=="vc9": 
    384345    envDebug_Cafu  .Append(CCFLAGS=Split("/J /W3 /WX")); 
    385346    envRelease_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
    386347    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")); 
     348 
     349elif compiler=="vc10": 
     350    envDebug_Cafu  .Append(CCFLAGS=Split("/J /W3 /WX")); 
     351    envRelease_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
     352    envProfile_Cafu.Append(CCFLAGS=Split("/J /W3 /WX")); 
     353 
    391354elif compiler=="g++": 
    392355    envDebug_Cafu  .Append(CCFLAGS=Split("-funsigned-char -Wall -Werror -Wno-char-subscripts"));