Development: Compiling the code

From OpenMPT Wiki
Jump to: navigation, search

If you want to get involved with OpenMPT development, or just want to compile your own version of the tracker, here are some hints on how to get started.

Prerequisites[edit]

  • Visual Studio 2013 or later (Express will not work as it does not include MFC, but the Community Edition will). You may also require the ANSI MFC legacy pack - a compiler error message will give you instructions if this is missing.
  • Optional TortoiseSVN or any other SVN client. You will need this to get the latest code revision via the SVN system. The description below is written for TortoiseSVN. You can also download a code snapshot if you do not want to install a SVN client (see below).

Getting the code[edit]

Using TortoiseSVN: First, you have to create a directory on your hard drive in which you want to place the source code. Right-click on the directory and choose the context menu entry “SVN Checkout...”. The “Repository URL” to fill in is https://source.openmpt.org/svn/openmpt/trunk/OpenMPT/. After clicking the OK button, all files will be downloaded.

- or -

Tarball: If you do not want to use an SVN client, simply get the GNU tarball from the web interface - click the “Download” link next to the OpenMPT folder to retrieve it.

Once you have checked out, you can always right-click on the directory and choose “SVN Update...” to get the most recent revision of the code. This will of course not work with the tarball method, you will have to download a new tarball after every commit in that case.

For legal reasons, the ASIO and VST SDKs are not included in the OpenMPT code repository, but they are required to compile OpenMPT with ASIO and VST support. The required packages can be downloaded automatically by running the file build/download_externals.cmd. Using this script requires PowerShell, so only works out of the box on Windows 7 or newer. Alternatively, you can retrieve them manually:

  • Download the respective SDKs from the Steinberg website.
  • VST: Simply copy all files from VST3 SDK/pluginterfaces/vst2.x to include/vstsdk2.4/pluginterfaces/vst2.x and the content of VST3 SDK/public.sdk/source/vst2.x to include/vstsdk2.4/public.sdk/source/vst2.x.
  • ASIO: Copy the ASIOSDK2 folder into the include directory of OpenMPT.

Compiling the code[edit]

Open the file build/vs20xx/OpenMPT.sln (where xx matches your Visual Studio version) in Visual Studio and click on the menu item BuildBuild solution to compile the code. Note that this process may take quite a while!

Depending on the version of Visual Studio used, the code might not compile out of the box. Some known reasons for that are:

  • You forgot to download the VST 2.4 and ASIO SDKs. Read the previous section to find out which files you need. Alternatively, if you do not want to compile OpenMPT with VST and ASIO support, you can define the constants NO_VST and NO_ASIO in the file common/BuildSettings.h (appropriate #define statements are already present but commented out).
  • File dsound.h / dmoreg.h not found: You need the DirectX SDK. Alternatively, you can remove the #define MPT_WITH_DSOUND and uncomment #define NO_DMO in the file common/BuildSettings.h. Installing this before installing Visual Studio could spare you some work with setting up the paths. If that is not possible anymore, go to ToolsOptions in Visual Studio and then ProjectsVC++ Directories and add the required paths. Apparently, this is already installed with VS2010, depending on what components you install.

Staying up to date[edit]

If you want to be notified of new code commits, you can subscribe to the SVN mailing list or import the RSS feed into your favourite RSS reader.