Obtaining and Compiling Exodus Source

The compilation process for Exodus has been designed to be as simple as possible. There are however a few steps involved in getting up and running the first time, especially if you don't currently have the required tools installed. The following article will walk you through the steps for obtaining the source code for Exodus, and compiling it on your own computer.

Please note that Windows is the only supported platform for compilation. Feel free to experiment with other platforms if you wish, but no support is currently provided for this.

 

Obtaining the Exodus Source Code

The sourcecode for Exodus is hosted Bitbucket at https://bitbucket.org/exodusemulator/exodus. You have two different options for downloading it to your computer: the quick and dirty way that'll get you the code in one step, but without any of the code revision history, and make it hard to pull in updates or contribute changes, or the slightly longer but proper way. I'd strongly recommend the latter. If you really just want the latest files with no fuss, the quick and dirty way is to grab the latest zip snapshot of the current development mainline from the downloads page of the Bitbucket repo.

As for the proper way, you need to have a Mercurial client installed, and clone the repository from Bitbucket. The steps below walk you through installing my recommended Mercurial client for Windows, and cloning the Exodus repository. If you already have a Mercurial client installed, and you're familiar with its use, you can perform this step in the way you're most comfortable with. Here's the step by step guide:

  1. Download and install the latest version of TortoiseHG
  2. Open "TortoiseHG Workbench" from the "TortoiseHG" folder in the start menu
  3. Select the "File -> Clone Repository" menu item
  4. In the "Source" field, enter the following address: https://bitbucket.org/exodusemulator/exodus
  5. In the "Destination" field, browse to the folder where you want the source files to be placed. You'll probably want to make a new folder and select that (IE, "Exodus").
  6. Press the "Clone" button to download the repository

With the source repository now properly cloned, you'll have access to the revision history for files in the repository, and you can pull in new changes to the repository as they are added. For information on how to do this, refer to the TortoiseHG Documentation.

 

Setting Up the Development Environment

Exodus currently uses Visual Studio 2013 as its development environment. Theoretically other IDE's could be used, as long as support exists for compiling MSBuild projects, but the only officially supported IDE is Visual Studio 2013. With the recently released Visual Studio 2013 Community Edition (note: This is different from the previous Visual Studio 2013 Express Edition), you get effectively the same IDE as Visual Studio 2013 Professional, but it's free for private and open-source development. If you don't have a license for a commercial version of Visual Studio 2013, I recommend using the Community Edition.

To setup your development environment, do the following:

  1. Download and install Visual Studio 2013 Community Edition (ISO Image: http://go.microsoft.com/?linkid=9863609)
  2. Download and install the Windows SDK (Web installer only)
  3. Download and install the VisualHG plugin for Visual Studio
  4. Open Visual Studio and select the "Tools -> Options" menu item
  5. Select "Source Control -> Plug-in Selection" from the tree control on the panel
  6. Choose "VisualHG" from the combobox as the current source control plugin, and press ok. 

 

Obtaining Third Party Libraries

There are a few third party libraries that are currently required in order to build the Exodus repository. In order to obtain the required third party libraries, navigate to the "Third" directory in your local copy of the Exodus repository, and download the following files into the subdirectories that exist in that folder.

  1. Under the "expat" directory, expat 2.1.0 (Direct Link: http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz)
  2. Under the "libjpeg" directory, libjpeg 9a (Direct Link: http://ijg.org/files/jpegsr9a.zip)
  3. Under the "libpng" directory, libpng 1.6.12 (Direct Link: http://download.sourceforge.net/libpng/lpng1612.zip)
  4. Under the "libtiff" directory, libtiff 4.0.3 (Direct Link: http://download.osgeo.org/libtiff/tiff-4.0.3.zip)
  5. Under the "zlib" directory, zlib 1.2.8 (Direct Link: http://zlib.net/zlib128.zip)
  6. If you want to build the documentation, under the "htmlhelp" directory, Microsoft HTML Help Workshop (Direct Link: http://go.microsoft.com/fwlink/?LinkId=14188)
  7. If you want to build the unit tests, under the "catch" directory, Catch (Direct link - https://github.com/philsquared/Catch/archive/master.zip)

For each compressed file you've downloaded, you now need to extract each one directly into the folder it's in. IE, if the archive name was "SomeArchive.zip", and it contained a compressed folder called "SomeFolder", after you extract, you should have SomeFolder sitting in the same directory as SomeArchive.zip. (Note: Catch and htmlhelp are exceptions to this rule. Catch must appear in a subdirectory called "Catch", and htmlhelp must appear in a subdirectory called "htmlhelp".). Ensure that you fully extract ".tar.gz" files. You need to extract the contents of the .tar file within the .gz file too.

 

Compiling Exodus

With your development environment setup, you're ready to compile Exodus. This can be done on the command line with MSBuild, but the easiest way is within Visual Studio. To compile Exodus, do the following.

  1. Open "ThirdPartyLibraries.sln" from the root of the Exodus repository in Visual Studio
  2. Select "Build -> Batch Build" from the main menu
  3. Click "Select All", then "Build". This will build all the different platform and build configuration variations of the third libraries, which makes things simpler.
  4. Open "Exodus.sln" from the root of the Exodus repository in Visual Studio
  5. Select "Build -> Configuration Manager" from the main menu
  6. Pick the configuration and platform you want to build. Usually that'll be the "Release" configuration and the "x64" platform
  7. Select "Build -> Build Solution" to compile Exodus
  8. Press Ctrl+F5 or select "Debug -> Start Without Debugging" to launch Exodus

Note that you can compile individual plugins under the "Debug" configuration and leave everything else as a release build. This is usually the way you'll want to work if you're developing a plugin. A full debug build runs very slowly, so you would generally compile just the individual components you want as debug, such as one or two plugins, and possibly the system itself, while leaving unrelated plugins as release builds.

 

Optional: Running Profile Guided Optimization

Official release builds of Exodus are given a speed boost through the use of Profile Guided Optimization. This technique involves instrumenting the code during compilation, and manually running the program with that instrumentation through a series of tasks, to gather information about what areas of the code are actually bottlenecks and runtime, then feeding that information back into the linker so that it can do a smarter optimization step. This has shown to increase average performance in Exodus by a modest 15% over a standard release build. If you do a normal build of Exodus on your local machine however, this optimization will not have been applied, so you can expect to see around a 15% performance degradation compared to the official release builds. If you want to optimize your own builds, you can do the following:

  1. Switch to the "Release - PGORebuildOptimized" solution configuration
  2. Do a full clean and build of the solution
  3. Switch to the "Release - PGOInstrument" solution configuration
  4. For each project you want to instrument, right click on that project in the solution explorer and select "Build".
  5. Right click on the "Exodus" project and select "Profile Guided Optimization -> Run Instrumented/Optimized Application". If the compiler asks you if you want to rebuild out of date projects, say no.
  6. Run the program through a series of test cases. These should be designed to stress-test the particular projects you're instrumenting.
  7. Close Exodus when your test cases are complete
  8. Switch to the "Release - PGOOptimize" solution configuration
  9. For each project you instrumented, right click on that project and select "Project Only -> Link Only <ProjectName>".
  10. If any projects fail with a message about timestamps not matching, switch to the "Release - PGOUpdate" solution configuration and attempt the link step on them again, and they should succeed.

As you can see, this is a fairly manual process, and takes some time to run through. I wouldn't recommend trying to instrument everything at once, because the performance will be heavily degraded and the performance profile of the emulation cores will change due to bottlenecks in the system and other cores, which will affect the usefulness of the profile data. The selection of the actual test runs is important too. If you're instrumenting a graphics core, you need to run a program which uses the features of that core, so that the various code paths can be explored and profiled at runtime. You should ideally only instrument individual assemblies, or small batches of assemblies, together in the same run. This allows you to make shorter, more focused test runs, and produces a better performance profile.

 

Optional: Building SDK Documentation

The Exodus SDK support documentation is build from XML documentation files within the repository itself. To build it yourself locally, do the following:

  1. Open "ExodusDocumentation.sln" from the root of the Exodus repository in Visual Studio
  2. Select "Build -> Build Solution" to create the documentation

The created documentation files will be in the "Documentation" folder in the root of the Exodus repository

 

Optional: Building Unit Tests

To compile the unit test projects for Exodus (only one right now), do the following:

  1. Open "ExodusTests.sln" from the root of the Exodus repository in Visual Studio
  2. Set the configuration and platform you want to build, and compile.

If you wish to make a donation to show your appreciation for this project, you can do so here. Your donation may go towards the hosting costs of the website, or equipment or reference hardware to assist in the development of Exodus. It may also go towards a bunch of flowers for my beautiful wife, to say thanks for your support and patience all those nights I stayed up late working on this project.