Development Environment Setup

This page will describe how to set a dev env for several OSes. Please note that it is a work in progress and that it will be reliable only once each platform is marked as [TESTED].

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
 * OIS - a cross-platform C++ input handling library
 * MyGUI 3.2.0 - the in-game windows and menus
 * Audiere and OpenAL - for sound support
 * Bullet 2.80 - the physics engine


 * 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: The file you want is Git-1.7.1-preview20100612.exe found HERE.

Libraries

 * Ogre: Choose OGRE v1.8 SDK for Visual Studio 2008 or 2010. Environment variable OGRE_HOME.
 * Boost: Boost lib used by OGRE but perhaps you should set it manually. In OGRE boost system, file_system, and program_options are missing, you should download the mt and mt-gd for vc90 and putt libs and dll in your OgreSDK_vc9_v1-7-1\boost_1_42\lib dir, they are in the boost-binaries\1.42.0 section in sourceforge download page. The boost source included in OGRE is missing filesystem and program_option, you should download them from boost sources and copy the directories in Ogre3D\boost_1_42\boost dir. Environment variable BOOST_ROOT.
 * Freetype: Freetype2, and set the environment variable FREETYPE_DIR to the 
 * OIS
 * OpenAL: OpenAL11CoreSDK, environment variable OPENALDIR.
 * Audiere: Environment variable AUDIERE_DIR.
 * QT. Environment variable QTDIR.
 * GNU C compiler Library
 * libsndfile

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.

Then you should update include dirs of project to add OGRE (\include and \include\OGRE).

Then you should include the correct path to needed libs (OgreSDK\lib & boost\lib) if not done by the CMake script. This may require first setting the OGRE_HOME environment, e.g..

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 Dependencies
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 Dependencies
You have to emerge dev-games/ogre with useflags "boost cg freeimage ois opengl threads zip" and from zugaina overlay, dev-games/mygui with useflag ogre.

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:

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".

Package Installations
First off, we will need to download all of the necessery development libraries from the main Fedora repositories (this is for building OpenMW and later the OGRE plugin):

yum install @development-tools

yum install cmake openal-soft-devel bullet-devel ois-devel ogre-devel libblkid-devel boost-devel qt-devel libsndfile-devel \ zziplib-devel freetype-devel libXaw-devel libXrandr-devel libXxf86vm-devel libGLU-devel freeimage-devel openexr-devel \ glew-devel tinyxml-devel tbb cppunit-devel git

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:

yum install Cg libmpg123-devel

Cg Plugin Setup
As of 0.13.0, we will need to compile a plugin for OGRE that does not come with the default OGRE packages from Fedora. This plugin is the Plugin_CgProgramManager.so file, which needs the Cg package (installed previously) to compile. First, determine which version of OGRE you have installed (as of Fedora 16, this will be 1.8rc1):

rpm -qi ogre-devel

Go to the main OGRE website and download the source tarball for that version. You MUST download the source for the same version you have installed.



Unzip the tarball, and compile the source code with the following:

cmake make

Once the libraries have been compiled, the Plugin_CgProgramManager.so file should be in the lib directory. As root, copy this file to the OGRE lib directory on your system. For 64bit systems, this will be located at:

/usr/lib64/OGRE

For 32bit systems:

/usr/lib/OGRE

Next, run the following command to register the new library:

/sbin/ldconfig

Building OpenMW
Now we can compile OpenMW. Download the source from the main downloads page:, or get the latest git snapshot:  with the following:

git clone git://github.com/zinnschlag/openmw.git

Unzip the tarball or change into the directory that has your cloned git files, and run the following commands to build the source:

cmake make

=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 thoses 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.