Skip to content

Mac xcode4 build notes

Shawn Roske edited this page Aug 27, 2013 · 9 revisions

1.9.0 RC1

Compilation of Cing.framework with the downloaded SDK

A framework library project was created, the stub source was removed and replaced with the Cing classes. The following project settings were added:

USER-DEFINED VARIABLES:

CING_HOME = ../../../
CING_LIBRARIES = $(CING_HOME)libraries/mac/xcode/

HEADER SEARCH PATHS:

$(CING_LIBRARIES)/OpenCV/include
$(CING_LIBRARIES)/PTypes/include
$(CING_LIBRARIES)/TinyXML/include
$(CING_LIBRARIES)
$(CING_HOME)/src
$(CING_LIBRARIES)/OgreSDK/include/OGRE/RenderSystems/GL
$(CING_LIBRARIES)/OgreSDK/include/OGRE/Plugins/CgProgramManager
$(CING_LIBRARIES)/OgreSDK/include/OGRE/OSX
$(CING_LIBRARIES)/OgreSDK/include/OGRE
$(CING_LIBRARIES)/OIS/include/OIS
$(CING_LIBRARIES)/OgreSDK/include
$(CING_LIBRARIES)/OgreSDK/boost
$(CING_LIBRARIES)/OgreSDK

LIBRARY SEARCH PATHS:

$(CING_LIBRARIES)/OpenCV/lib
$(CING_LIBRARIES)/PTypes/lib
$(CING_LIBRARIES)/TinyXML/lib
$(CING_LIBRARIES)/OpenCV/share/OpenCV/3rdparty/lib
$(CING_LIBRARIES)/OgreSDK/boost/lib
$(CING_LIBRARIES)/OgreDependencies/lib
$(CING_LIBRARIES)/OIS/lib

OTHER LDFLAGS:

-lboost_thread-mt
-lboost_date_time-mt
-lboost_chrono-mt
-lboost_system-mt
-lTinyXML
-lptypes
-lopencv_highgui
-lopencv_core
-lopencv_video
-lopencv_contrib
-lopencv_imgproc
-lopencv_ml
-llibjasper
-lFreeImage
-lfreetype
-lOIS

Compilation of projects consuming Cing.framework:

A cocoa project was created, the Cing.framework project was added as a sub-project and target dependency. The Cing.framework as well as all the Ogre SDK provided frameworks and Cg.framework were added to the linking step and a new copy files (to frameworks) step was added.

HEADER SEARCH PATHS:

$(SRCROOT)/../../../cing/libraries/mac/xcode/OgreSDK/include
$(SRCROOT)/../../../cing/libraries/mac/xcode/OgreSDK/include/OGRE
$(SRCROOT)/../../../cing/libraries/mac/xcode/OgreSDK/include/OGRE/OSX
$(SRCROOT)/../../../cing/libraries/mac/xcode/OgreSDK/include/OGRE/Plugins/CgProgramManager
$(SRCROOT)/../../../cing/libraries/mac/xcode/OgreSDK/include/OGRE/RenderSystems/GL

MACPORTS LIBRARIES

Note: I had to use macports to install these dynamic libraries as the downloaded Ogre SDK currently expects these libraries to exist in /usr/local/lib. In the future this should be changed so that it uses the staticly built dependencies.

Note: XCode command line tools will need to be installed in order to build/install these libraries using macports.

sudo port install freeimage +universal
sudo port install libzzip +universal
sudo port install freetype +universal

DYNAMIC LIBRARIES BUNDLES IN APP

To prevent the need for macports installed, the OgreSDK release was modified to instead search for the freeimage, freetype and libzzip dynamic libraries within the app bundle Resources directory:

First the macport dylibs required a id change:

$ install_name_tool -id @executable_path/../Frameworks/libbz2.1.0.dylib libbz2.1.0.dylib
$ install_name_tool -id @executable_path/../Frameworks/libfreeimage.3.dylib libfreeimage.3.dylib
$ install_name_tool -id @executable_path/../Frameworks/libfreetype.6.dylib libfreetype.6.dylib
$ install_name_tool -id @executable_path/../Frameworks/libpng15.15.dylib libpng15.15.dylib
$ install_name_tool -id @executable_path/../Frameworks/libz.1.dylib libz.1.dylib
$ install_name_tool -id @executable_path/../Frameworks/libzzip-0.13.dylib libzzip-0.13.dylib

And the interdependencies need to be fixed:

$ install_name_tool -change /opt/local/lib/libz.1.dylib @executable_path/../Frameworks/libz.1.dylib libfreetype.6.dylib
$ install_name_tool -change /opt/local/lib/libbz2.1.0.dylib @executable_path/../Frameworks/libbz2.1.0.dylib libfreetype.6.dylib
$ install_name_tool -change /opt/local/lib/libpng15.15.dylib @executable_path/../Frameworks/libpng15.15.dylib libfreetype.6.dylib
$ install_name_tool -change /opt/local/lib/libz.1.dylib @executable_path/../Frameworks/libz.1.dylib libpng15.15.dylib
$ install_name_tool -change /opt/local/lib/libz.1.dylib @executable_path/../Frameworks/libz.1.dylib libzzip-0.13.dylib

And the Ogre framework paths must be fixed as well:

$ install_name_tool -change /opt/local/lib/libzzip-0.13.dylib @executable_path/../Frameworks/libzzip-0.13.dylib Ogre.framework/Ogre
$ install_name_tool -change /opt/local/lib/libfreeimage.3.dylib @executable_path/../Frameworks/libfreeimage.3.dylib Ogre.framework/Ogre

$ install_name_tool -change /opt/local/lib/libfreetype.6.dylib @executable_path/../Frameworks/libfreetype.6.dylib OgreOverlay.framework/OgreOverlay
$ install_name_tool -change /opt/local/lib/libzzip-0.13.dylib @executable_path/../Frameworks/libzzip-0.13.dylib OgreOverlay.framework/OgreOverlay
$ install_name_tool -change /opt/local/lib/libfreeimage.3.dylib @executable_path/../Frameworks/libfreeimage.3.dylib OgreOverlay.framework/OgreOverlay

$ install_name_tool -change /opt/local/lib/libzzip-0.13.dylib @executable_path/../Frameworks/libzzip-0.13.dylib Plugin_CgProgramManager.framework/Plugin_CgProgramManager
$ install_name_tool -change /opt/local/lib/libfreeimage.3.dylib @executable_path/../Frameworks/libfreeimage.3.dylib Plugin_CgProgramManager.framework/Plugin_CgProgramManager

$ install_name_tool -change /opt/local/lib/libzzip-0.13.dylib @executable_path/../Frameworks/libzzip-0.13.dylib Plugin_ParticleFX.framework/Plugin_ParticleFX
$ install_name_tool -change /opt/local/lib/libfreeimage.3.dylib @executable_path/../Frameworks/libfreeimage.3.dylib Plugin_ParticleFX.framework/Plugin_ParticleFX

$ install_name_tool -change /opt/local/lib/libzzip-0.13.dylib @executable_path/../Frameworks/libzzip-0.13.dylib RenderSystem_GL.framework/RenderSystem_GL
$ install_name_tool -change /opt/local/lib/libfreeimage.3.dylib @executable_path/../Frameworks/libfreeimage.3.dylib RenderSystem_GL.framework/RenderSystem_GL

Clone this wiki locally