Development Environment Setup

This page will describe how to set a dev env for several OSes.

You might also want to read the GitHub FAQ first.

=Third-Party Libraries and Tools=


 * OpenMW currently uses the following libraries:
 * OGRE 1.8 - the main graphic engine
 * SDL2 - input and windowing
 * MyGUI 3.2.0 - GUI toolkit
 * Bullet 2.80 - the physics engine
 * OpenAL or OpenAL soft - for sound playback
 * FFmpeg For sound decoding and BINK video playback. Alternatively, you could use Audiere or mpg123 for sound decoding, but videos won't work then.


 * OpenMW additionally uses the following tools:
 * CMake - used to manage the build process
 * Git - used as the source control management system

For those unfamiliar with Git, the Sphere RPG Engine group has a fairly useful short wiki page entitled "Git for the lazy". Make sure to also check out the GitHub FAQ.

=Windows=

Tools

 * Visual Studio 2008/2010/2012/2013 - normal or free (C++) express versions. Note that if you use Visual Studio 2012 or newer you will have to build Qt yourself.
 * CMake: CMake at least v2.8, but grab the latest stable release.
 * Git - Our version control software: Git at least v1.8.x, but grab the latest stable release.

Libraries

 * Ogre: Choose OGRE v1.9 SDK for your Visual Studio version. Environment variable OGRE_HOME.
 * Boost: Use the installer for your Visual Studio version and set the environment variable BOOST_ROOT to the .
 * Bullet Download bullet and build the BulletCollision, BulletDynamics and LinearMath projects. Make sure the Runtime library is set to "Multi-threaded Debug DLL (/MDd)" or "Multi-threaded DLL (/MD)" for the debug and the release configuration, respectively. Also "Enable Run-Time Type Information" has to be set to "Yes (/GR)". Afterwards put the libraries into the  folder, strip the ending off (like _vs2010) and set the environment variables BULLET_ROOT to the , and  BULLET_INCLUDE_DIR to the  folder.
 * Freetype: Freetype2, and set the environment variables FREETYPE_DIR and MYGUI_DEPENDENCIES_DIR to the .
 * MyGUI: Download and build following compilation instructions and set the MYGUI_HOME environment variable. Set the mygui.ogreplatform properties->c/c++->general->additional includes to have BOOST_ROOT as well.
 * OpenAL: Download OpenAL11CoreSDK and set the environment variable OPENALDIR.
 * Qt. Download the latest Qt4 version for your Visual Studio version and install the environment variable QTDIR. Example: qt-win-opensource-4.8.4-vs2010.exe
 * msinttypes Download and extract to your visual studio 'install_root\VC\include' directory and overwrite the files there. This will give you C99 compliant inttypes. This is only required for building FFmpeg and not required for Visual Studio 2012 or later.
 * FFmpeg Download and extract the dev and shared of ffmpeg. The latest builds don't work. A known working version is commit 1eabd71, available in the "previous versions" links on that page. The environment variable is FFMPEG_HOME. (Note: A later build e.g. ffmpeg-20140221-git-8c55ff3-win64 appears to work ok with openmw-29 branch)
 * SDL2 Download and extract the SDL2 VS "Development Libraries". SDL2-devel-2.0.1-VC.zip Then set the SDL2_LIBRARY variable to the location of the SDL2.dll file.

Once this is done, you're ready to get the source code.


 * Get the OpenMW Source code using GIT or Tortoise Git

Download and install all of these and make sure the environment (the system and Cmake) knows where they are. If you develop under a non-admin account, use System variables rather than User variables (in Control Panel->System and Security->System->System Properties->Advanced (tab)->Environment Variables). Add the following, adjusted to the paths in your system:

Check that PATH includes the path to git.exe for CMakeGUI to find it.

Bullet libraries won't be found by CMake if you didn't put the built libraries manually into \lib\Release\ as indicated above. Alternatively modify cmake\FindBullet.cmake to look for ${BULLET_ROOT}/lib.

Similarly, either set MYGUI_INCLUDE_DIRS and MYGUI_PLATFORM_INCLUDE_DIRS manually in CMakeGUI or modify cmake\FindMyGUI.cmake to look for ${MYGUISDK}/include/MYGUI.

Need to remove SDL2main.lib from VS->Properties->Configuration Properties->Linker->Additional Dependencies if you run into linking errors building owmlauncher. One way is to edit CMakeLists.txt so that SDL2_BUILDING_LIBRARY is set before running CMakeGUI. Another way is to set the SDL2_LIBRARY env variable instead of SDL2DIR as indicated above.

Running and using CMake
First, before opening Cmake, create a sibling directory called "OpenMW - build" next to the root "openmw" so that an out-of-source build can be done. This step is not needed if you're using CMakeGUI, as a separate build directory can be specified at the start.

This will create a Visual Studio solution which you can use to compile OpenMW. (Hint: If you are building a debug version, add /bigobj to openmw project in VS->Properties->Configuration Properties->C/C++->Command Line->Additional Options)

At this point, you've got an exe generated, it needed OGRE dll to be run, the lazy way is to copy the OpenMW in OgreSDK\bin\debug that contains all needed files (dll en .cfg). In the same directory than the .exe, you should have the data directory of the Morrowind game - or alternatively, on Windows Vista or Windows 7, you can create a symbolic link to the data directory:

via Cygwin
Git is available on Windows via cygwin. Git can be used directly on Windows instead of grabbing source zip files from Github. The cygwin environment will allow you to use the same git command line commands as are recommended for the Linux environment. Note however that the cygwin version of CMake does not appear to support VS2008 as a valid target; therefore, cygwin can only be used for Git commands and a standard Windows command prompt should be used for invoking CMake.

via msysGit
There is also a stand-alone compiled package called msysgit. This will give you a Cygwin-like console with the git command, which you may find easier than via Cygwin.

via TortoiseGit
There is also a GUI git client for the one used to TortoiseSVN or TortoiseCVS which is called TortoiseGIT. It will give you a nice GUI inside the Windows explorer. This is the easy way.

via Eclipse
First of all, you need the egit plugin. Install it, restart eclipse, "file -> import -> git -> clone"

=Linux=

Arch
There is a development package available for OpenMW on the AUR. It can be found at.

Information about building packages from the Arch User Repository (AUR) can be found at the Arch wiki.

Gentoo
'''Instructions broken - missing SDL2 and ffmpeg ''' You have to emerge dev-games/ogre with useflags "boost freeimage opengl threads zip" and dev-games/mygui with useflag ogre. The mygui package might need to be unmasked, see Gentoo handbook and is available in portage since 2012-11-01.

Key requirements
Because some dependencies of OpenMW are not in the Ubuntu repositories we made a development repository on Launchpad which provides packages for the missing dependencies.

To be able to install these packages you need to add the openmw Launchpad PPA by running:

and to make sure that the ppa will be used run:

Packages
You will need g++ in order to compile OpenMW.

To setup a build environment and install all dependencies type:

Package Installations
First off, we will need to download all of the necessery development libraries from the main Fedora repositories:

'''Instructions broken - missing SDL2 and ffmpeg. libsndfile and libmpg123 can be removed'''.

Next, we will need to enable the RPMFusion repositories on our system if it isn't already done so, per the instructions found here:

Once the RPMFusion repositories (both free and non-free) have been installed, we will also need the following packages:

Fetching the source
Download the source from the main downloads page:, or get the latest git snapshot:

With make
Note that this is an out-of-source build. Generally, this is the preferred method when working with cmake. This creates a regular makefile.

Now we can start compiling. Normally you can just run

but if you have multiple cores, you can decrease your compile time by doing this:

With codeblocks
If you want to create a Code::Blocks project instead, use these lines:

Please note, that the Code::Blocks generator only generates a makefile with a Code::Blocks wrapper.

With Kdevelop
Kdevelop4 is very nice, easy-to-use and modern IDE. After getting source, just open Kdevelop and click "Project -> Open/Import Project..." and show path to code (.../OpenMW/openmw). You will have to choose build folder.

For building click on button "Build Selection". For running click "Execute". Running first time "Launch Configurations" will pop up. You have to set executable file by selecting "openmw", clicking "+" and choosing "openmw/apps/openmw/openmw" as "Project Target".

=Mac OS X=

Initial setup
First of all, clone OpenMW repo.

Or use your github url if you forked.

About dependencies: I prefer not to install them globally (i. e. in /usr/local/), so I'm installing them in directory in my home directory. If OpenMW sources is in $HOME/path/openmw, I'm using $HOME/path/libs/root as prefix for boost and other libs.

It's useful to create env var for lib install prefix:

Most of libs can be installed from Homebrew. Only mpg123 needs to be installed from source (due to lack of universal compilation support). I think that some of libs can be installed from MacPorts or Fink too.

As OpenMW currently only supports i386 architecture on OS X, denendencies also should support it. Set some env vars in current terminal:

If you close your terminal, you should set env vars again before pcoceeding to next steps!

Boost
Download boost and install it with the following command:

Alternatively you can install boost with homebrew:

I think MacPorts also should support universal build for boost.

Ogre
Download Ogre SDK (tested with 1.8rc1), unpack it somewhere and move lib/Release/Ogre.framework into /Library/Frameworks.

OIS
Download patched OIS and use the XCode project provided. Be sure to set your build architecture to i386. Once it built, locate built OIS.framework with Xcode and move it to /Library/Frameworks.

mpg123
Download MPG 123 and build it:

libsndfile
Download libsndfile and build it:

or install with homebrew:

Bullet
Download Bullet and build it:

or install with homebrew: I prefer head because 2.79 has some issue which causes OpenMW to lag. Also you can edit formula and install 2.77, which is stable and haven't mentioned issue.

Qt
Install Qt. Qt SDK distributed by Nokia is not an option because it's 64 bit only, and OpenMW currently doesn't build for 64 bit on OS X. I'm installing it from Homebrew:

Run CMake
Generate the Makefile for OpenMW as follows and build OpenMW:

You can use -G&quot;Xcode&quot; if you prefer Xcode, or -G&quot;Eclipse CDT4 - Unix Makefiles&quot; if you prefer Eclipse. You also can specify -D CMAKE_BUILD_TYPE=Debug</tt> for debug build. As for CMake 2.8.7 and Xcode 4.3, Xcode generator is broken. Sadly Eclipse CDT also cannot import generated project at least on my machine.

If all libs installed via homebrew (excluding mpg123), then command would be even simplier:

Note for users with recent Xcode versions: you must explicitly specify what set of compilers do you use! If not, gcc will be used for C and Clang for C++. Just add this two -D's to command: -D CMAKE_C_COMPILER=/usr/bin/clang</tt> and -D CMAKE_CXX_COMPILER=/usr/bin/clang</tt>

Note for Xcode 4.3 users: you should specify full path to used SDK, because current CMake (2.8.7) couldn't find SDKs inside Xcode app bundle:

-D CMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"

Run
From your build directory run:

or: Enjoy!

=Eclipse= You have to use the C/C++ version of Eclipse, that you can download here

Git within Eclipse
If you want to use Eclipse as Git explorer:
 * 1) From the project explorer, right click, and select "Import..."
 * 2) Select "Git / Projects from Git"
 * 3) Click "Next"
 * 4) Select "Local"
 * 5) Click "Next"
 * 6) "Add..." / "Browse", and select openmw's directory
 * 7) Click "Next"
 * 8) Select "Use the new project wizard", and "Finish".

Import the project
Select "C/C++ / Makefile project with existing code" as project type. In "Existing code location", click browse, and again,select openmw's folder. Also select "Linux GCC" as toolchain, then click "Finish".

Now right-click on your project, and select "Properties". Go to "C/C++ build", uncheck "use default build command", and specify your command, like

make -j 4 -C ${ProjDirPath}../build

Now you should be able to build openmw.

Fix includes
To fix includes (Eclipse complaining about Ogre and Bullet), go to project properties, "C/C++ General", "Paths and symbols", select "GNU C++".

Click the "add" button to add the following paths :

/usr/include/OGRE

/usr/include/bullet

Run
To run it, create a new Run configuration. Select openmw as project, and click "search project" to find the executable (../build/openmw). Then go to the Arguments panel and uncheck "Use default" for working directory, and type in : "${workspace_loc:openmw}../build"

Apply, and you should now be able to run openmw !

=Data=

For a detailed description of how to obtain the data files check Getting_Data_Files_for_Linux_Install.