Skip to content

Developing on Mac OS X

mogemimi edited this page Jan 26, 2018 · 11 revisions

⚠️ TODO: This is the documentation for older version. These sections needs updating for the latest version of the engine.

Build requirements

  • Git
  • Python 2.7+
  • Mac OS X 10.11+
  • Xcode 9.2+ (Apple LLVM version 9.0.0)

Prerequisites

Cloning

git clone https://github.com/mogemimi/pomdog.git

Pulling all dependencies using Git

Make sure git is installed. From the root of your engine directory, run:

cd pomdog
git clone https://github.com/mogemimi/pomdog-third-party.git third-party
git clone --depth=1 https://chromium.googlesource.com/external/gyp.git tools/gyp

Updating all dependencies

cd pomdog
cd third-party && git pull origin master && cd ..
cd tools/gyp && git pull origin master && cd ../..

How to build

Building under Mac OS X and Xcode

1. Generating the Xcode project file

python tools/gyp/gyp_main.py test/TestApp/TestApp.gyp --depth=. -f xcode --generator-output=build.xcodefiles

You can also use gyp instead of python tools/gyp/gyp_main.py:

gyp test/TestApp/TestApp.gyp --depth=. -f xcode --generator-output=build.xcodefiles

For information on how to install gyp, see How to Install GYP on the wiki.

2. Building (Release/Debug)

xcodebuild -project build.xcodefiles/test/TestApp/TestApp.xcodeproj

To build in release mode, use -configuration option:

xcodebuild -project build.xcodefiles/test/TestApp/TestApp.xcodeproj -configuration Release

3. Running app

open test/TestApp/build/Release/TestApp.app

How to deploy your app on Mac

First, build in release mode:

xcodebuild -project build.xcodefiles/test/TestApp/TestApp.xcodeproj -configuration Release

Second, bundle frameworks with application. Copy Pomdog.framework into your application (.app):

cd test/TestApp/build/Release
mkdir TestApp.app/Contents/Frameworks
cp -R Pomdog.framework TestApp.app/Contents/Frameworks

To replace dynamic library path with a new location, use install_name_tool:

export POMDOG_DYLIB_OLD=@executable_path/../../../Pomdog.framework/Versions/A/Pomdog
export POMDOG_DYLIB_NEW=@executable_path/../Frameworks/Pomdog.framework/Versions/A/Pomdog
export POMDOG_EXECUTABLE=TestApp.app/Contents/MacOS/TestApp

install_name_tool -change $POMDOG_DYLIB_OLD $POMDOG_DYLIB_NEW $POMDOG_EXECUTABLE

Finally, run your application:

open TestApp.app