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:
- Download and install the latest version of TortoiseHG
- Open "TortoiseHG Workbench" from the "TortoiseHG" folder in the start menu
- Select the "File -> Clone Repository" menu item
- In the "Source" field, enter the following address: https://bitbucket.org/exodusemulator/exodus
- 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").
- 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:
- Download and install Visual Studio 2013 Community Edition (ISO Image: http://go.microsoft.com/?linkid=9863609)
- Download and install the Windows SDK (Web installer only)
- Download and install the VisualHG plugin for Visual Studio
- Open Visual Studio and select the "Tools -> Options" menu item
- Select "Source Control -> Plug-in Selection" from the tree control on the panel
- 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.
- 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)
- Under the "libjpeg" directory, libjpeg 9a (Direct Link: http://ijg.org/files/jpegsr9a.zip)
- Under the "libpng" directory, libpng 1.6.12 (Direct Link: http://download.sourceforge.net/libpng/lpng1612.zip)
- Under the "libtiff" directory, libtiff 4.0.3 (Direct Link: http://download.osgeo.org/libtiff/tiff-4.0.3.zip)
- Under the "zlib" directory, zlib 1.2.8 (Direct Link: http://zlib.net/zlib128.zip)
- If you want to build the documentation, under the "htmlhelp" directory, Microsoft HTML Help Workshop (Direct Link: http://go.microsoft.com/fwlink/?LinkId=14188)
- 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.
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.
- Open "ThirdPartyLibraries.sln" from the root of the Exodus repository in Visual Studio
- Select "Build -> Batch Build" from the main menu
- Click "Select All", then "Build". This will build all the different platform and build configuration variations of the third libraries, which makes things simpler.
- Open "Exodus.sln" from the root of the Exodus repository in Visual Studio
- Select "Build -> Configuration Manager" from the main menu
- Pick the configuration and platform you want to build. Usually that'll be the "Release" configuration and the "x64" platform
- Select "Build -> Build Solution" to compile Exodus
- 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:
- Switch to the "Release - PGORebuildOptimized" solution configuration
- Do a full clean and build of the solution
- Switch to the "Release - PGOInstrument" solution configuration
- For each project you want to instrument, right click on that project in the solution explorer and select "Build".
- 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.
- Run the program through a series of test cases. These should be designed to stress-test the particular projects you're instrumenting.
- Close Exodus when your test cases are complete
- Switch to the "Release - PGOOptimize" solution configuration
- For each project you instrumented, right click on that project and select "Project Only -> Link Only <ProjectName>".
- 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:
- Open "ExodusDocumentation.sln" from the root of the Exodus repository in Visual Studio
- 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:
- Open "ExodusTests.sln" from the root of the Exodus repository in Visual Studio
- Set the configuration and platform you want to build, and compile.