Development Environment Setup

From OpenMW Wiki
Revision as of 19:18, 7 August 2011 by Lgromanowski (talk | contribs) (Created page with "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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.7.x - the main graphic engine
    • OIS - a cross-platform C++ input handling library
    • MyGUI - the in-game windows and menus
    • Audiere and OpenAL - for sound support
    • Bullet - 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

Visual Studio 2008/2010

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.7.1 SDK for Visual Studio 2008 or 2010]
  • 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.
  • Freetype: Freetype2 and set the environment variable FREETYPE_DIR to the <install_path>
  • OIS
  • OpenAL
  • Audiere
  • GNU C compiler Library
  • libsndfile

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

Download and install all of these and make sure the environment (the system and Cmake) knows where they are. (Coming soon) Once everything is installed properly, run the following command in the directory that you installed OpenMW's source to:

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.

 "<Cmake's Install Directory>\bin\cmake.exe" ..\openmw -G "Visual Studio 9 2008"

Then you should update include dirs of project to add OGRE (<path_to_ogre>\include and <path_to_ogre>\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. set OGRE_HOME=C:\OgreSDK.

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:

 C:\dev\omw\build>mklink /D data "c:\Program Files\Bethesda Softworks\Morrowind\Data Files"
 symbolic link created for data <<===>> c:\Program Files\Bethesda Softworks\Morrowind\Data Files

Git on Windows

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

Ubuntu Dependencies

Key requirement

In order to install Ogre, you need to add ubuntu's packager for Ogre (Andrew Fenn) as trusted:

 sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 6F7E2F0B

note: "6F7E2F0B" is the id of Andrew Fenn.

In synaptic, go to settings -> Repositories -> add copy this into the field and click add source.

 ppa:andrewfenn/ogredev

within synaptic search for ogre and mark 1.7.1 for installation. click apply.

Packages

 git
 libois-dev
 libopenal-dev
 libaudiere-dev
 libmpg123-dev
 libogre-dev
 libsndfile1-dev
 libblkid-dev
 libfreeimage-dev
 uuid-dev

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

To install all dependencies type:

 sudo apt-get install git libois-dev libopenal-dev libaudiere-dev libmpg123-dev libogre-dev \
 libsndfile1-dev libblkid-dev libfreeimage-dev libboost-filesystem-dev libboost-thread-dev \
 libboost-program-options-dev libboost-system-dev uuid-dev
Ogre
Boost libraries not included within the libogre-dev custom package.

Note: libboost-system-dev will be autoincluded in at least the filesystem package.

 libboost-filesystem-dev
 libboost-thread-dev
 libboost-program-options-dev

Install the development files for libogre-dev 1.7.1

Check

Do you have the 1.7.1 version?

 pkg-config --modversion --cflags OGRE

More information is available here on the custom libogre-dev package. https://launchpad.net/~andrewfenn/+archive/ogredev

Bullet

You will also need to install bullet package which can be found at http://www.bulletphysics.com. It also uses the cmake build system and can be installed like:

 cmake .
 make
 sudo make install

Fetching the source

 mkdir OpenMW
 
 cd OpenMW
 git clone git://github.com/zinnschlag/openmw.git
 cd openmw
 git submodule update --init
 cd ..

Building

With make

Note that this is an out-of-source build. Generally, this is the preferred method when working with cmake.

 mkdir Build
 cd Build
 cmake ../openmw/
 
 make

This creates a regular makefile.

With codeblocks

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

 mkdir Build
 cd Build
 cmake -G "CodeBlocks - Unix Makefiles" ../openmw/

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

Mac OS X

Dependencies

Make sure you set the following variables

  export CFLAGS="-arch i386"
 
  export CXXFLAGS="-arch i386"
  export LDFLAGS="-arch i386"

MacPort

To download many of the required packages for building Open Morrowind you can use the MacPorts utility for the Mac OSX

http://www.macports.org/

Generic libraries required

You may have these installed but just incase run this to install a lot of generic libraries required for the build

 sudo port install libpng jpeg libxml2 +universal
 sudo port install pkgconfig xmlto autoconf automake libtool +no_x11 +quartz
 
 sudo port install freetype freeimage libzzip +universal

Cmake

Using MacPort, install cmake. Cmake is what will be used to compile all the source files

 sudo port install cmake

Boost

Boost is a collection of c++ libraries that is required for Open Morrowind

 sudo port install boost +universal

OIS

OIS is required to control input form the keyboard and mouse in the game

Download the latest code from

http://sourceforge.net/projects/wgois

Download and install the latest version

Go to the install directory

 cd Mac
 cd XCode-2.2

Load the project file in XCODE Build the project and copy the files, this assumes you are in the root directory of the OIS project

Copy OIS.dylib and libOIS.a to /opt/local/lib/ Copy the folder OIS.framework to /Library/Frameworks

 cp -rp ./Mac/XCode-2.2/build/Debug/OIS.dylib /opt/local/lib/
 
 cp -rp ./Mac/XCode-2.2/build/Debug/libOIS.a /opt/local/lib/
 
 cp -rp ./Mac/XCode-2.2/build/Debug/OIS.framework /Library/Frameworks/

Ogre

Download the SDK from http://www.ogre3d.org/download/sdk

In the OgreSDK directory of the download, copy the <sdk area>/lib and <sdk area>/include directory to /opt/local/lib/ and /opt/local/include (respectively) Copy the folder <sdk area>/lib/release/OGRE.framework to /Library/Frameworks

Mpg123

Download the source from http://sourceforge.net/projects/mpg123/files/mpg123/

 ./configure --cpu_type=i386
 make
 sudo make install

SND

Download the source from http://www.mega-nerd.com/libsndfile/#Download

 ./configure
 ./make 
 sudo make install

Build

Fetching the source

 mkdir OpenMW
 cd OpenMW
 git clone git://github.com/zinnschlag/openmw.git
 
 cd openmw
 git submodule update --init
 cd ..

Building

Note that this is an out-of-source build. Generally this is the preferred method when working with cmake.

 mkdir Build
 
 cd Build
 cmake ../openmw/
 make

This creates a regular makefile.

Test

Set up the environment. From the OpenMW directory

 mkdir Game
 cd Game
 mkdir Contents
 mkdir Contents/Resources
 mkdir Contents/Plugins

Copy Ogre plugins from Ogre SDK to Plugins subdir:

 cp /path/to/ogre/sdk/lib/*.dylib Contents/Plugins

Create symlink to resources subdirectory:

 ln -s ../../../Build/resources Contents/Resources/resources

Create symlinks for *.cfg files:

 mkdir Contents/MacOS
 ln -s ../../../Build/plugins.cfg Contents/MacOS/plugins.cfg
 
 ln -s ../../../Build/openmw.cfg Contents/MacOS/openmw.cfg

Create symbolic links to the executable

 ln -s ../Build/openmw openmw

Link the data from the morrowind installation

 ln -s /path/to/morrowind/data/files Contents/Resources/data


Edit the file

/Build/openmw.cfg Contents/MacOS/openmw.cfg

with data and resource location

 data=<path_to>/OpenMW/Game/Contents/Resources/data
 
 resources=<path_to>/OpenMW/Game/Contents/Resources/resources


Run the game

 <path_to>/OpenMW/Game/openmw