Development Environment Setup: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
(updated build instructions for OS X)
Line 228: Line 228:
=Mac OS X=
=Mac OS X=


===Dependencies===
== Initial setup ==


Make sure you set the following variables
First of all, clone OpenMW repo.


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
 
$ git clone github.com/zinnschlag/openmw
  export CFLAGS="-arch i386"
  export CXXFLAGS="-arch i386"
  export LDFLAGS="-arch i386"
 
</syntaxhighlight>
 
====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
 
<syntaxhighlight lang="bash">
 
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
 
</syntaxhighlight>
</syntaxhighlight>
Or use your github url if you forked.


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


Using MacPort, install cmake. Cmake is what will be used to compile all the source files
It's useful to create env var for lib install prefix:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
 
$ export OMW_LIB_PREFIX=$HOME/path/libs/root
sudo port install cmake
 
</syntaxhighlight>
</syntaxhighlight>
Most of libs can be installed from [https://github.com/mxcl/homebrew 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.


====Boost====
As OpenMW currently only supports i386 architecture on OS X, denendencies also should support it. Set some env vars in current terminal:
 
Boost is a collection of c++ libraries that is required for Open Morrowind


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
 
$ export CFLAGS="-arch i386"
sudo port install boost +universal
$ export CXXFLAGS="-arch i386"
 
$ export LDFLAGS="-arch i386"
</syntaxhighlight>
</syntaxhighlight>
If you close your terminal, you should set env vars again before pcoceeding to next steps!


====OIS====
== Boost ==
 
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
Download [http://www.boost.org boost] and install it with the following command:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
 
$ cd /path/to/boost/source
cd Mac
$ ./bootstrap.sh --prefix=$OMW_LIB_PREFIX
cd XCode-2.2
$ ./bjam --build-dir=build --layout=versioned \
 
    --toolset=darwin architecture=x86 address-model=32 \
    --link-shared,static --prefix=$OMW_LIB_PREFIX install
</syntaxhighlight>
</syntaxhighlight>
Alternatively you can install boost with homebrew:


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
<syntaxhighlight lang="bash">$ brew install boost --universal</syntaxhighlight>
 
I think MacPorts also should support universal build for boost.
Copy OIS.dylib and libOIS.a to /opt/local/lib/ Copy the folder OIS.framework to /Library/Frameworks
 
<syntaxhighlight lang="bash">


cp -rp ./Mac/XCode-2.2/build/Debug/OIS.dylib /opt/local/lib/
== Ogre ==
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/


</syntaxhighlight>
Download [http://www.ogre3d.org Ogre] SDK (tested with 1.7.3), unpack it somewhere and move <tt>lib/Release/Ogre.framework</tt> into <tt>/Library/Frameworks</tt>.


====Ogre====
== OIS ==


Download the SDK from http://www.ogre3d.org/download/sdk
Download patched [https://github.com/corristo/ois-fork OIS] and use the XCode project provided. Be sure to set your build architecture to <tt>i386</tt>. Once it built, locate built OIS.framework with Xcode and move it to <tt>/Library/Frameworks</tt>.


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)
== mpg123 ==
Copy the folder <sdk area>/lib/release/OGRE.framework to /Library/Frameworks


====Mpg123====
Download [http://www.mpg123.de MPG 123] and build it:
 
Download the source from http://sourceforge.net/projects/mpg123/files/mpg123/


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
 
$ cd /path/to/mpg123/source
./configure --cpu_type=i386
$ ./configure --prefix=$OMW_LIB_PREFIX --disable-debug \
make
  --disable-dependency-tracking \
sudo make install
  --with-optimization=4 \
 
  --with-audio=dummy \
  --with-default-audio=dummy \
  --with-cpu=sse_alone \
$ make install
</syntaxhighlight>
</syntaxhighlight>


====SND====
== libsndfile ==


Download the source from http://www.mega-nerd.com/libsndfile/#Download
Download [http://www.mega-nerd.com/libsndfile libsndfile] and build it:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
 
$ cd /path/to/libsndfile/source
./configure
$ ./configure --prefix=$OMW_LIB_PREFIX \
./make
  --disable-dependency-tracking
sudo make install
$ make install
 
</syntaxhighlight>
</syntaxhighlight>
or install with homebrew:


===Build===
<syntaxhighlight lang="bash">$ brew install libsndfile --universal</syntaxhighlight>
 
====Fetching the source====
 
<syntaxhighlight lang="bash">
 
mkdir OpenMW
cd OpenMW
git clone git://github.com/zinnschlag/openmw.git
cd openmw
git submodule update --init
cd ..


</syntaxhighlight>
== Bullet ==


====Building====
Download [http://bulletphysics.org Bullet] and build it:
 
Note that this is an out-of-source build. Generally this is the preferred method when working with cmake.


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
$ cd /path/to/bullet/source
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=$OMW_LIB_PREFIX \
  -DBUILD_EXTRAS=OFF \
  -DBUILD_DEMOS=OFF \
  -DCMAKE_OSX_ARCHITECTURES=i386 \
  -DCMAKE_INSTALL_NAME_DIR=$OMW_LIB_RPEFIX/lib \
  -G"Unix Makefiles" ../
$ make install</syntaxhighlight>


mkdir Build
or install with homebrew:
<syntaxhighlight lang="bash">$ brew install bullet --HEAD --universal</syntaxhighlight>
cd Build
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.
cmake ../openmw/
make


</syntaxhighlight>
== Qt ==


This creates a regular makefile.
Install [http://qt.nokia.com/ 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:


====Test====
<syntaxhighlight lang="bash">$ brew install qt --universal</syntaxhighlight>
== Run CMake ==


Set up the environment. From the OpenMW directory
Generate the Makefile for OpenMW as follows and build OpenMW:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
 
$ mkdir /path/to/openmw/build/dir
mkdir Game
$ cd /path/to/open/build/dir
cd Game
$ cmake \
mkdir Contents
  -D CMAKE_OSX_ARCHITECTURES=i386 \
mkdir Contents/Resources
  -D OGRE_SDK=/path/to/ogre/sdk \
mkdir Contents/Plugins
  -D BOOST_INCLUDEDIR=$OMW_LIB_PREFIX/include/boost-1_45 \
 
  -D BOOST_LIBRARYDIR=$OMW_LIB_PREFIX/lib \
</syntaxhighlight>
  -D SNDFILE_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
 
  -D SNDFILE_LIBRARY=$OMW_LIB_PREFIX/lib/libsndfile.a \
Copy Ogre plugins from Ogre SDK to Plugins subdir:
  -D MPG123_LIBRARY=$OMW_LIB_PREFIX/lib/libmpg123.a \
 
  -D MPG123_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
<syntaxhighlight lang="bash">
  -D BULLET_DYNAMICS_LIBRARY=$OMW_LIB_PREFIX/lib/libBulletDynamics.a \
 
  -D BULLET_COLLISION_LIBRARY=$OMW_LIB_PREFIX/lib/libBulletCollision.a \
cp /path/to/ogre/sdk/lib/*.dylib Contents/Plugins
  -D BULLET_MATH_LIBRARY=$OMW_LIB_PREFIX/lib/libLinearMath.a \
 
  -D BULLET_SOFTBODY_LIBRARY=$OMW_LIB_PREFIX/lib/libBulletSoftBody.a \
</syntaxhighlight>
  -D BULLET_INCLUDE_DIR=$OMW_LIB_PREFIX/include/bullet/ \
 
  -G "Unix Makefiles" /path/to/openmw/source/dir
Create symlink to resources subdirectory:
$ make
 
<syntaxhighlight lang="bash">
 
ln -s ../../../Build/resources Contents/Resources/resources
 
</syntaxhighlight>
</syntaxhighlight>
You can use <tt>-G&quot;Xcode&quot;</tt> if you prefer Xcode, or -G&quot;Eclipse CDT4 - Unix Makefiles&quot; if you prefer Eclipse. You also can specify <tt>-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.


Create symlinks for *.cfg files:
If all libs installed via homebrew (excluding mpg123), then command would be even simplier:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
 
$ cmake \
mkdir Contents/MacOS
  -D CMAKE_OSX_ARCHITECTURES=&quot;i386&quot; \
ln -s ../../../Build/plugins.cfg Contents/MacOS/plugins.cfg
  -D OGRE_SDK=/path/to/ogre/sdk \
  -D MPG123_LIBRARY=$OMW_LIB_PREFIX/lib/libmpg123.a \
ln -s ../../../Build/openmw.cfg Contents/MacOS/openmw.cfg
  -D MPG123_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
 
  -G "Unix Makefiles" /path/to/openmw/source/dir
$ make
</syntaxhighlight>
</syntaxhighlight>
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: <tt>-D CMAKE_C_COMPILER=/usr/bin/clang</tt> and <tt>-D CMAKE_CXX_COMPILER=/usr/bin/clang</tt>


Create symbolic links to the executable
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:


<syntaxhighlight lang="bash">
<pre>-D CMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"</pre>
== Run ==


ln -s ../Build/openmw openmw
From your build directory run:


</syntaxhighlight>
<syntaxhighlight lang="bash">$ OpenMW.app/Contents/MacOS/openmw</syntaxhighlight>
 
or:
Link the data from the morrowind installation
<syntaxhighlight lang="bash">$ open OpenMW.app</syntaxhighlight>
 
Enjoy!
<syntaxhighlight lang="bash">
 
ln -s /path/to/morrowind/data/files Contents/Resources/data
 
</syntaxhighlight>
 
 
Edit the file
 
/Build/openmw.cfg Contents/MacOS/openmw.cfg
 
with data and resource location
 
<syntaxhighlight lang="bash">
 
data=<path_to>/OpenMW/Game/Contents/Resources/data
resources=<path_to>/OpenMW/Game/Contents/Resources/resources
 
</syntaxhighlight>
 
 
Run the game
 
<syntaxhighlight lang="bash">
 
<path_to>/OpenMW/Game/openmw
 
</syntaxhighlight>


=Data=
=Data=

Revision as of 11:27, 15 March 2012

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

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.

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

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

To setup a build environment and install all dependencies type:

 sudo apt-get install git libois-dev libopenal-dev libmpg123-dev libpng-dev libogre-dev \
 libsndfile1-dev libblkid-dev libfreeimage-dev libboost-filesystem-dev libboost-thread-dev \
 libboost-program-options-dev libboost-system-dev uuid-dev libqt4-opengl libqt4-dev \
 cmake build-essential

If there is a missing package, then it does not exist in your distribution's repository. This can happen with older versions. You will need to either find another source or build it yourself. Examples can be seen below.

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. You can install from source which can be found at http://www.bulletphysics.com or you can get the GetDeb version at http://www.playdeb.net .

It also uses the cmake build system and can be installed like:

 cmake .
 make
 sudo make install

Or the GetDeb version:

wget -q -O - http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
sudo sh -c 'echo "deb http://archive.getdeb.net/ubuntu oneiric-getdeb games" >> /etc/apt/sources.list.d/getdeb.list'
apt-get update
apt-get install libbullet-dev

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/

This creates a regular makefile.

Normally you can just run 'make' but if you have multiple cores, you can increase your compile time by doing this:

make -j`getconf _NPROCESSORS_ONLN`

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

Initial setup

First of all, clone OpenMW repo.

$ git clone github.com/zinnschlag/openmw

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:

$ export OMW_LIB_PREFIX=$HOME/path/libs/root

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:

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

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:

$ cd /path/to/boost/source
$ ./bootstrap.sh --prefix=$OMW_LIB_PREFIX
$ ./bjam --build-dir=build --layout=versioned \
    --toolset=darwin architecture=x86 address-model=32 \
    --link-shared,static --prefix=$OMW_LIB_PREFIX install

Alternatively you can install boost with homebrew:

$ brew install boost --universal

I think MacPorts also should support universal build for boost.

Ogre

Download Ogre SDK (tested with 1.7.3), 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:

$ cd /path/to/mpg123/source
$ ./configure --prefix=$OMW_LIB_PREFIX --disable-debug \
  --disable-dependency-tracking \
  --with-optimization=4 \
  --with-audio=dummy \
  --with-default-audio=dummy \
  --with-cpu=sse_alone \
$ make install

libsndfile

Download libsndfile and build it:

$ cd /path/to/libsndfile/source
$ ./configure --prefix=$OMW_LIB_PREFIX \
  --disable-dependency-tracking
$ make install

or install with homebrew:

$ brew install libsndfile --universal

Bullet

Download Bullet and build it:

$ cd /path/to/bullet/source
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=$OMW_LIB_PREFIX \
  -DBUILD_EXTRAS=OFF \
  -DBUILD_DEMOS=OFF \
  -DCMAKE_OSX_ARCHITECTURES=i386 \
  -DCMAKE_INSTALL_NAME_DIR=$OMW_LIB_RPEFIX/lib \
  -G"Unix Makefiles" ../
$ make install

or install with homebrew:

$ brew install bullet --HEAD --universal

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:

$ brew install qt --universal

Run CMake

Generate the Makefile for OpenMW as follows and build OpenMW:

$ mkdir /path/to/openmw/build/dir
$ cd /path/to/open/build/dir
$ cmake \
  -D CMAKE_OSX_ARCHITECTURES=i386 \
  -D OGRE_SDK=/path/to/ogre/sdk \
  -D BOOST_INCLUDEDIR=$OMW_LIB_PREFIX/include/boost-1_45 \
  -D BOOST_LIBRARYDIR=$OMW_LIB_PREFIX/lib \
  -D SNDFILE_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
  -D SNDFILE_LIBRARY=$OMW_LIB_PREFIX/lib/libsndfile.a \
  -D MPG123_LIBRARY=$OMW_LIB_PREFIX/lib/libmpg123.a \
  -D MPG123_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
  -D BULLET_DYNAMICS_LIBRARY=$OMW_LIB_PREFIX/lib/libBulletDynamics.a \
  -D BULLET_COLLISION_LIBRARY=$OMW_LIB_PREFIX/lib/libBulletCollision.a \
  -D BULLET_MATH_LIBRARY=$OMW_LIB_PREFIX/lib/libLinearMath.a \
  -D BULLET_SOFTBODY_LIBRARY=$OMW_LIB_PREFIX/lib/libBulletSoftBody.a \
  -D BULLET_INCLUDE_DIR=$OMW_LIB_PREFIX/include/bullet/ \
  -G "Unix Makefiles" /path/to/openmw/source/dir
$ make

You can use -G"Xcode" if you prefer Xcode, or -G"Eclipse CDT4 - Unix Makefiles" 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:

$ cmake \
  -D CMAKE_OSX_ARCHITECTURES=&quot;i386&quot; \
  -D OGRE_SDK=/path/to/ogre/sdk \
  -D MPG123_LIBRARY=$OMW_LIB_PREFIX/lib/libmpg123.a \
  -D MPG123_INCLUDE_DIR=$OMW_LIB_PREFIX/include \
  -G "Unix Makefiles" /path/to/openmw/source/dir
$ make

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 and -D CMAKE_CXX_COMPILER=/usr/bin/clang

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:

$ OpenMW.app/Contents/MacOS/openmw

or:

$ open OpenMW.app

Enjoy!

Data

You can use unshield to extract data from your Morrowind CD.

Datafiles are inside data1.cab and data2.cab. You just need to copy thoses files to you data folder :

* Sound
* Music
* Video
* Splash
* Morrowind.esm
* Morrowind.bsa

Edit your openmw.cfg file, and you are ready !