x86 on a 64-bit system with SCons and MSVC

As stated previously, I’m trying to get into DirectX 11. For a change I’m not using Visual Studio, but Sublime Text and Scons, with the MSVC compiler because of the DX11 header incompatibility with MinGW.

Link time, d3d11.lib et al... Link error. Unresolved symbol for D3D11CreateDeviceAndSwapChain. What? I did set the library path (to the x86 binaries) and linked to the lib file...

Sure. But by default, Scons uses the MSVC version matching your system: 64-bit for me. The solution is to add TARGET_ARCH='x86' in the Environment constructor call. Adding it afterwards by using Append doesn’t work.

Sublime Text 2 and SCons

Well, might as well post it somewhere in case it helps someone and so as not to forget it.

To the point. A friend of mine (a demoscener known as xtrium, already mentionned here) is working on a 3D engine, and as I'll lend a hand I needed to build the project. He uses SConscript, I wanted to get started with Sublime Text and not have to use the "wonderful" Windows command line. So, custom build in Sublime Text.

To anyone saying, "just install Linux", I'm more comfortable with Windows and love my usual software. So no penguin here ;)

Anyway, here is the sublime-build file I added in the Packages/Users directory to get a SCons build system. The encoding might not work on your system, I got it to work on my machine and did not look further.

    "cmd": ["scons.bat"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${project_path:${folder}}",
    "encoding": "cp1252"

The first line calls the SCons executable, it assumes that the containing directory is in your path.
The second one allows you to go to the error line in the source file when clicking on the error message.
This one works for GCC (MinGW at least), I've posted one for Visual C++ below.
Working dir sets the... working directory - no kidding - and assumes you have the SConscripts in the Sublime Text project directory.
And the encoding part removes the [Decode error - output is not utf-8] error, at least on my machine (French Win7 64). No guarantee about yours.

Hope it helps someone!

Edit: Due to the DX11 headers not compiling with GCC, I had to switch my SCons environment back to Visual C++. Of course that changes the error message format. Here's the (maybe not very rigid) regular expression I used instead:

"file_regex": "^([^(]+)\\(([0-9]+)\\)() : (.*)$"