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 - normal or free express versions.
 * CMake: CMake v2.8
 * Git - Our version control software: Git v1.8.x

Libraries

 * Ogre: Choose OGRE v1.8 SDK for Visual Studio 2008 or 2010. Environment variable OGRE_HOME.
 * Boost: The lib shipped with OGRE are old and shouldn't be used. Replace those with Boost v1.50.0 binaries and headers. Headers go to "OGRE_ROOT\boost\boost" and libs go to "OGRE_ROOT\boost\lib" . Environment variable BOOST_ROOT. Download the headers and the binary mt and mt-gd for vc90 or vc100 files:
 * boost_1_50_headers.zip
 * chrono
 * date_time
 * filesystem
 * program_options
 * system
 * thread
 * wave
 * Bullet 2.8.1 Download and build bullet, and make sure the libraries are put into the  folder, strip the ending off (like _vs2010) and set the environment variables BULLET_ROOT , and  BULLET_INCLUDE_DIR   folder.
 * Freetype: Freetype2, and set the environment variable FREETYPE_DIR and MYGUI_DEPENDENCIES_DIR to the 
 * MyGUI: Download and build following compilation instructions and set the MYGUI_HOME environment variable. In vs90 or vs100, set the mygui.ogreplatform properties->c/c++->general->additional includes to have 'c:\BOOST_ROOT\' as well.
 * OpenAL: Download OpenAL11CoreSDK and set the environment variable OPENALDIR.
 * QT. Download the vs90 or vs100 version and install the environment variable QTDIR. Example: qt-win-opensource-4.8.4-vs2010.exe
 * msinttypes Download and extract to your vs90 or vs100 'install_root\VC\include' directory and overwrite the files there. This will give you C99 compliant inttypes.
 * FFmpeg Download and extract the dev and exe 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.
 * 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. (Coming soon)

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.

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 are two AUR packages available for OpenMW, a stable and a development version. They can be found at https://aur.archlinux.org.

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

Gentoo
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. TODO: You also need SDL2

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/build 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:

TODO: Add SDL2

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.

Normally you can just run 'make' 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 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= Create a data folder anywhere, then edit your openmw.cfg file to point to that folder.

Then you have to copy the game data from your disc or installation into that data folder. The datafiles are inside data1.cab/data1.hdr and data2.cab on the disc.

You can use unshield to extract data from your Morrowind CD. Create a temporary folder first, then copy the three files over and use the command unshield x data1.hdr data2.cab inside that folder.

You just need to copy these files to your data folder, the other files can be deleted after unshielding: * Video (found on the disc) * Music (found where you unshielded the cabs) * Sound (found where you unshielded the cabs) * Splash (found where you unshielded the cabs) * Morrowind.esm (found in Data_Files after unshielding) * Morrowind.bsa (found in Data_Files after unshielding)

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