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:
 * OpenSceneGraph 3.4 - OpenGL rendering toolkit
 * SDL2 - input and windowing
 * MyGUI 3.2.1 - GUI toolkit
 * Bullet 2.83 - the physics engine
 * OpenAL or OpenAL soft - for sound playback
 * FFmpeg For sound decoding and BINK video playback.


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

MyGUI
By default, MyGUI will build with the Ogre3D platform enabled, but Ogre3D is not a hard dependency. If you do not want to have Ogre installed, then configure MyGUI with the dummy platform, and disable tools & demos:

OpenSceneGraph
It is recommended to use the OpenMW/osg fork of OpenSceneGraph. OpenMW still works with "vanilla" OpenSceneGraph, but may run at slightly lower frame rate.

OSG plugins
OSG comes with numerous plugins, most of which are not required by OpenMW. If you install OSG from a package manager, then you will have tons of bloat on your system that OpenMW does not need (another reason to build your own).

Only the following plugins are required for OpenMW to function properly:

Texture formats:
 * osgdb_dds
 * osgdb_tga
 * osgdb_bmp
 * osgdb_jpeg
 * osgdb_png

.osg format support:
 * osgdb_osg.so
 * osgdb_serializers_osg.so

Note, the jpeg/png plugins will not be built unless you have 'libpng' and 'libjpeg' headers installed on your system.

If you are creating a release package, the library files for the plugins need to go in  /osgPlugins-.

S3TC texture compression support
OpenMW requires S3TC texture compression support. If you are using a proprietary video driver, you will usually have S3TC support out of the box. With open-source drivers on Linux, you may need to install S3TC support separately. An indicator for missing S3TC support are white textures.

On Ubuntu: sudo apt-get install libtxc-dxtn-s2tc0

=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
(Needs updating, +osg)
 * 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 variable BULLET_ROOT to the .
 * Freetype: Freetype2, and set the environment variable FREETYPE_DIR to the .
 * MyGUI: Download and build following compilation instructions and set the MYGUI_HOME environment variable.
 * 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 ffmpeg-20120914-git-8bdba0b-win64 appears to work ok with openmw-0.30 without crashing)
 * 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)

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.

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:

Debian Stretch
Debian Stretch has all the packages necessary to build OpenMW except OpenSceneGraph(OSG), which you must build.

Install OpenMW dependencies
sudo apt-get install git libopenal-dev \ libsdl2-dev libqt4-dev libboost-filesystem-dev libboost-thread-dev \ libboost-program-options-dev libboost-system-dev \ libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev \ libbullet-dev libmygui-dev libunshield-dev cmake build-essential \ libqt4-opengl-dev

Build and install OSG
Note: You may have to install some OSG dependencies. OSG has a lot of optional modules, many of which are not needed, and are not built if you do not have the correct development headers installed. You must at least install the package libjpeg-dev, to allow for screenshot functionality (including the reading and writing of savegame pictures).

This guide uses the out-of-source build method for OSG since it makes it easier to rebuild a (new) version without retaining old incorrect configurations. git clone https://github.com/openscenegraph/OpenSceneGraph/tree/OpenSceneGraph-3.4.0 osg/src mkdir osg/build cd osg/build cmake ../src make sudo make install

In case of Debian-native older OSG version
It is possible that you have installed the openscenegraph package (which provides version 3.2.3 at the time of writing) from the Debian repositories. You need not remove this. It can peacefully coexist with the higher version you installed manually, because they are installed in separate locations.

However you must point CMake to the correct version. If you don't, CMake will detect that you have the correct version, but will still point the compilation process to the files for 3.2.3, which gives a confusing situation.

To fix this, point CMake to the correct version by running: export OSG_DIR=/usr/local/lib64 Note: If you are compiling on a 32-bit system, the location is most likely /usr/local/lib

Gentoo
All required dependencies, as well as an ebuild for OpenMW (games-engine/openmw) are available in the Portage tree. However to setup a development environment without emerging the OpenMW package, follow the steps below. Please note that this is a setup that worked, in other words: some use flags may be optional.

Starting with OpenMW-0.37 (including current git builds) openscenegraph is required.

It should be possible now to build OpenMW using cmake or other tools.

In order to be able to build the documentation, execute

Key requirements
Because some dependencies of OpenMW are not in the Fedora Workstation repositories, you need to enable RPMFusion free and non-free repositories which provide packages for the missing dependencies.

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

To setup a build environment and install all dependencies type:

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

= OS X =

Prerequisites
You must have recent version (4.6.3 or higher) of Xcode & Xcode command line tools. Xcode command line tools can be enough but I'm not sure. Older versions are untested.

Miminal OS X version is determined by minimal Xcode version.

If you're planning to use our homebrew repo for installing dependencies, homebrew is required too, obviously.

Note: this manual assumes that you're using default homebrew prefix (/usr/local). Fix paths where appropriate if you don't.

Dependencies
You will need the following libraries to build OpenMW (Semantic Versioning is used for version numbers):

(Needs updating, +osg)


 * boost ??? (1.48-1.55 are all fine though)
 * Bullet ~> 2.80 (earlier versions could work, but I haven't tested it myself)
 * ffmpeg ~> 1.2.4
 * MyGUI ~> 3.2.0
 * SDL ~> 2.0
 * unshield ~> 0.6

Build tools:


 * CMake. Not sure about version, 2.8.12.2 is fine
 * pkg-config. Recent version from homebrew is okay.

Most of the dependencies can be installed from our homebrew repo. Here we go:

boost will be installed as dependency.

Keep in mind that if you have already installed boost, bullet, sdl2 or ffmpeg from homebrew default repo, you'll have conflicts. I don't have any solution for that yet, sorry.

Qt
Note that you can install Qt from homebrew too but we previously had some issues with deploying OpenMW binaries built against homebrewed Qt.

It's recommended to use Qt SDK from Qt Project site, especially if you're planning to deploy your builds to users since homebrewed Qt has some issues when deployed on older OS X versions. Just download package and install.

Build
First of all you'll need to clone OpenMW source code, either from our main repository or from your fork:

Then you can cd into source directory and look around. Please note that out-of-source build is recommended:

I assume that openmw & build directories are siblings. Call CMake:

Linker flags & CMake framework path should be tuned because Ogre.framework is located in /usr/local/lib/macosx/Release</tt>, not just in /usr/local/lib</tt>.

Compiler flags should be tuned to set required C++ standard library explicitly, because otherwise compiler will assume libc++ (if deployment target >= 10.9 and OS X version is >= 10.9) and libstdc++ (on older OS X version or if deployment target < 10.9). Alternatively you can specify deployment target (like in release build later), but I don't see any point in setting deployment target for local debug build.

Then build:

And try:

Or run binaries directly to see their output:

Deployment
If you want to make a release build and deploy it, you must set CMake variable OPENMW_OSX_DEPLOYMENT</tt> to TRUE</tt>:

Please note that esmtool is not needed in release builds.

Build & package:

After this command completes, you'll have a *.dmg file in current directory. You can publish this file as OpenMW release, send it to your friend, etc.

Note that if you'll try to launch release versions of OpenMW.app or OpenMW-CS.app directrly from build directory they won't work, because they're built in deployment configuration when all dependencies are expected to be inside application bundle, but they're not until everything is packed in *.dmg.

Troubleshooting
If you experiencing configuration or build errors, or just in doubt, please refer to our Travis CI build script, it's proven to be working and should help you setup build environment on almost any compatible Mac with OS X 10.9 or higher (older versions could work too, but we're unable to test on them).

Umbrella script: https://github.com/OpenMW/openmw/blob/master/.travis.yml

Dependency setup: https://github.com/OpenMW/openmw/blob/master/CI/before_install.osx.sh

Build: https://github.com/OpenMW/openmw/blob/master/CI/before_script.osx.sh

=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

''Note: Replace this example with your actual build command! Choose the -j flag based on the amount of effective CPU cores your system has available.''

Now you should be able to build openmw.

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

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

/usr/include/bullet

/usr/include/SDL2

/usr/include/MyGUI

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.