Mountain Lion Guide for OpenMW through XCode 4.5

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Locked
User avatar
drpaneas
Posts: 10
Joined: 17 Sep 2012, 19:43
Location: Thessaloniki,GR
Contact:

Mountain Lion Guide for OpenMW through XCode 4.5

Post by drpaneas »

I found problems using brew, problems during compiling OIS and mpg123 and then problems using unixfiles instead of XCode recommended settings. So, this is my way of installing OpenMW into Macbook Air.

Step 1: Install XCode
Update to 4.5 version

Step 2: Register as Appl Develop
and install the Command Line Tools for Xcode (at Downloads)

Also

Xcode 4.5 changed the layout of developer tools on disk which can cause some serious problems for CMake. The issue has been fixed but is not yet publicly released. CMake 2.8.9 will include Xcode 4.5 support. At the time of writing, a release candidate is available that includes this support.

Assuming that Xcode is installed in /Applications,

Code: Select all

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Step 3: Install macports
Link: http://www.macports.org/install.php use the pkg package
edit your .bash_profile. Add the following lines:
if there is no such file, then create one: touch ~/.bash_profile
edit: open -a TextEdit ~/.bash_profile

Code: Select all

export CPPFLAGS="-I/opt/local/include"
export LDFLAGS="-L/opt/local/lib"
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
Step 4: Install cmake
Link: http://www.cmake.org/files/v2.8/cmake-2 ... versal.dmg (if you have 64bit which is most likely)

Step 6: Apply in order to compile OIS
Xcode 4 and later users need to first accept the Xcode EULA by either launching Xcode or running

Code: Select all

sudo xcodebuild -license
Step 7: Install dependencies using MacPorts

Code: Select all

sudo port install libpng +universal jpeg +universal libxml2 +universal pkgconfig xmlto autoconf automake libtool freetype +universal freeimage +universal libzzip +universal boost +universal ois +universal libsndfile +universal bullet +universal
Ogre3D requires a 32 bit build due to use of Carbon interfaces via OIS. Thus the +universal specifications to ensure 32 and 64 bit builds for libraries.
You need the first line even if you already have libpng/jpeg/xml2 installed because they will be re-installed within the package system and we need to ensure universal build. You may need --enforce-variants if you have already installed these packages. The build dependencies of libzzip, they do not need to be universal, but use +no_x11 +quartz to avoid unnecessary additional packages

Step 8: Install mpg123 using macports
mpg123: update to 1.14.4; disable SSE optimizations on i386 because they fail to build

Code: Select all

sudo ports install mpg123 +universal
Step 9: Install nVIDIA CG
Link: http://developer.nvidia.com/cg-toolkit-download
it automatically add the framework to system's /Library/Frameworks

Step 10: Install Qt4 and qt4-creator

Code: Select all

sudo port install qt4-mac +universal qt4-x11+universal qt4-creator-mac +universal
Step 11: Compile OGRE from source
Download: http://www.ogre3d.org/download/source

Code: Select all

tar xjf ogre_src_v1-8-0.tar.bz2
cd ogre_src_v1-8-0
mkdir build
cd build
cmake -GXcode ..
Use the OGRE.xcodeproj and build within Xcode. Then try to launch the SampleBrowser to see for OGRE's examples.

Go into the build folder and move lib/Release/Ogre.framework into /Library/Frameworks

Step 12: Get the CD files ready

Code: Select all

cd /openmw_path
mkdir data
Copy n Paste the following folders and files
* 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)
Step 13: configure for XCode

Code: Select all

cd /openmw_path/
mkdir Build
cd Build
cmake -GXcode ..

Step 14: Use XCode 4.5 for Build and Compile
Open the *.xcodeproj with XCode. Wait to index the fails, apply the warnings into recommended settings (it will save a new snapshot). Build and Compile within XCode.

Step 15: Run
rom your build directory run:
$ OpenMW.app/Contents/MacOS/openmw
or:
$ open OpenMW.app
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

Re: Mountain Lion Guide for OpenMW through XCode 4.5

Post by lgromanowski »

Nice guide, would you put it in our wiki?
corristo
Posts: 495
Joined: 12 Aug 2011, 08:29

Re: Mountain Lion Guide for OpenMW through XCode 4.5

Post by corristo »

Good work, man!

I've been too lazy to update current OS X manuals on wiki. Can you add this one there?

Also we should mention in manual that now OpenMW only meant to be built with Ogre version built by hand and installed into /usr/local for example (like you did). SDK wouldn't work. If you have desire & time — we can discuss it and try to fix.

Another note: one can use Homebrew instead of Macports (personally I prefer Homebrew). If you'll add this manual to wiki, I'll add alternative Homebrew commands here. Anyway, Macports way seems easier for beginner because Homebrew lacks some dependencies and one has to install them by hand.

32-bit requirement is not only due to OIS's lack of 64 bit support (OIS distributed with Ogre actually has 64-bit support and uses Cocoa), but because some code should be written to make OpenMW true 64-bit Cocoa app. I tried simple approach (eventloop reading NSEvents), but it had some very strange glitches. Code is here: https://github.com/corristo/openmw/tree/osx_x64

If you still had any question regarding OpenMW on OS X feel free to contact me.

P.S. Actually I haven't any problems with CMake & Xcode 4.5 on ML, latest release is built with it.
P.P.S Why not install CMake through MacPorts too?
Locked