Building your own SlimDX binary from SVN

I’m a big fan of this free DX managed wrapped called SlimDX. I used to use Managed DX but MS abandoned that which meant I was limited to DirectX version 9. SlimDX makes it possible to still use C# but also to have access to the latest DX10 and DX11 classes. The official releases of SlimDX are good but the SVN repository has the very latest changes to it. That just gives you access to the source, you still have to build your own dll to include in your SlimDX projects. I figured that some people may have trouble with this so I thought I’d write this simple guide.

Prequisites

  • Download and install Microsofts C++ Express IDE.
  • Download and install Microsoft DirectX SDK.
  • Download the SlimDX SDK. I’d really recommend installing a SVN client and downloading their latest SVN version. At the time of writing this was revision 1297. The rest of this guide has changed slightly over the past few hundred revisions so I’ll try to keep it up to date.
  • If you downloaded the zip then unzip it.

Now it’s time to actually build your new DLL. Why isn’t this just a case of opening the sln file and hitting build? Well it seems SlimDX uses a few config options that don’t carry across to the Express IDE. We need to go through and change these plus there are a couple of prequisite steps we need to take to get all the files we need ready to build SlimDX.

In the latest (August 2009) DX SDK they moved some of the effect source code into its own directory. You need to first build that project go get yourself a “d3dx11effects.lib” file.

  • Go into the Effects11 directory:
    C:\Program Files (x86)\Microsoft DirectX SDK (August 2009)\Utilities\Source\Effects11
  • Open Effects11_2008.sln and change the Solution Config dropdown from Debug to Release
  • Hit Build and wait for it to finish. Hopefully that succeeded for you as well and you now have a new d3dx11effects.lib in the Release directory.

Building SlimDX

  • Head into the SlimDX directory and find the build directory.
  • Open SlimDXDocs.sln. You’ll get an error about how it’s for the wrong version. Just click OK to get past that.
  • If you try doing a build at this point you’ll see that it can’t find any of the DX header files.
  • Right click the SlimDX project and choose properties.
  • Choose Configuration Properties->C/C++->General
  • Double click the Additional Include Directories field.
  • Leave the field that says:
    $(ProjectDir)\..\externalBoost
  • Double click the field that says:
    $(DXSDK_DIR)\Utilities\Source\Effects11\Inc
  • Browse to this directory yourself, for me it was:
    C:\Program Files (x86)\Microsoft DirectX SDK (August 2009)\Utilities\Source\Effects11\Inc
    Not that I’m using the x86 libs here. You need to change that if you want a x64 build.
  • Select Configuration Properties/Linker and then click the edit button for the Additional Library Directories field.
  • Change the line that says:
    "$(SolutionDir)\..\externalEffects11x86"
  • To:
    C:\Program Files (x86)\Microsoft DirectX SDK (August 2009)\Utilities\Source\Effects11\Release
    Not that I’m using the x86 libs here. You need to change that if you want a x64 build.
  • Now head to Linker/Advanced and delete the Key File value. It reads as “D\:slimdxKey.snk” as default for me. That should now be blank.
  • Finally, go to Build Events/Post-Build Event and remove the Command Line value.
  • Now do a Rebuild. You should now hopefully have a new SlimDX.dll file inside the buildx86Public directory.

Note about the file paths
I use Vista x64 so I have both a C:\Program Files (x86) and a C:\Program Files directory. On a x32 system you would only have the latter. Some of the include paths use a DXSDK_DIR variable, that doesn’t get automatically created for the Express IDE when you install the DX SDK which is why I change it to use a hard coded path.

What about the included D3DX11Effects.lib file?
The SlimDX folks included this in the external\Effects11\x86 directory but there isn’t any debug information and you’ll get a bunch of warnings about that during the compilation process. That’s why we compile our own version instead as the debug files get included with that version.

Share Article

Comments: 2

Leave a reply

Please fill in the form fields and improve Skynet by completing the captcha!

Thank you! All comments are moderated so yours will appear shortly.
  • Josh Petrie
    Josh Petrie

    Hi there!

    Building Effects11 yourself should not be necessary you want to incorporate unofficial changes to the library (as described here http://forums.xna.com/forums/p/38767/225483.aspx after the initial discussion of how to find the Effects11 library). You should not be getting warnings about missing debug information, that’s happening because one of the other developers forgot to add Effects11 correctly and will be remedied soon.

    I’m curious why you’re using the SlimDXDocs.sln, as well, that’s mainly for us to compile the documentation. You should also be able to build SlimDX from the command-line using MSBuild without modifying any properties in the .sln or .vcprojs, even with the express edition. If that isn’t working out for you, please let us know on our issues page at Google Code!

  • Anonymous
    Anonymous

    Hi, great to hear from another SlimDXer 🙂

    At the time of writing I was getting the debug errors about the Effects11 lib file which is why I compiled my own version. I haven’t done an update to my SlimDX directory since just before Christmas so if that’s been remedied I’ll edit my post. I just got really stuck with porting over the NVidia shader boning/instancing demo so the whole thing is sitting in limbo for now until I have more free time and patience!

    I know that using the SlimDXDocs solution file seems a bit crazy but it actually works. When I use the SlimDX.sln file it gives me a load of errors (6) about “Solution Folders are not supported in this version of the application” as well as a few similar errors about the project type not being supported (3). At the end I also get a single error that says some of the properties are not supported. With the SlimDXDocs.sln file I only get a single error about the DocSite project type not being supported.

    It honestly hadn’t ever crossed my mind to use the command line compiler. I already had the C++ Express IDE installed so it was just natural in my mind to try and get that working. I’m probably going to stick with using the IDE as it’s very quick to get it setup. I mean I can go from the SVN update finishing to having a shiney new dll within two minutes.

    Thanks for SlimDX, I’m really enjoying using it. I hope you didn’t think my post was a slap in the face or anything. I just wanted to help other people use it and figured they’d be a few other Express IDE users out there.

    Sorry for the delay in posting back as well. Seems my blog has decided to stop emailing me when I receive new posts which means they sit in the moderation queue until I happen to log in. Going to look into that now.

So, if there are no wars to fight, then why are we here?

— Edmund Pevensie the Just, King of Narnia