Castle Game Engine
← Users Developers →
 
Intro
 
News
 
view3dscene
 
The Castle
 
All Programs
 
Forum
 
Donate
 
Engine
 
VRML/X3D
 
Blender
 

Dependencies of our programs on Mac OS X

Contents:

  1. Mac OS X Carbon applications (new)
    1. Developers: Technical details
    2. Console
  2. Mac OS X GTK2 applications (old)
    1. Dependencies to install
    2. Developers: additional stuff to install/configure
  3. Developers: help wanted

1. Mac OS X Carbon applications (new)

Since engine version 4.1.0 (view3dscene 3.13.0), our applications have a native look on Mac OS X, and do not need any extra dependencies (like X11 and GTK).

1.1. Developers: Technical details

We did it by using the LCL backend of CastleWindow. This uses Lazarus LCL under the hood, wrapping Lazarus TForm and TOpenGLControl inside a TCastleWindow. Although it still has some issues (see below), it gives us native look and a lot of stuff "for free".

Developers: When compiling programs under Mac OS X, remember to add castle_components Lazarus package to the requirements of the castle_window package. This is a necessary manual step, as Lazarus does not allow (yet) to define a package requirement that is specific to given OS.

This change allows CastleWindow-based programs, like view3dscene, to have native look on Mac OS X. Of course in your own programs you can also use Lazarus forms directly (with our TCastleControl) — this was always possible, and gives you the same native look through Lazarus.

On Mac OS X, the default LCL widgetset is Carbon right now.

1.2. Console

view3dscene uses a standard OS console for some stuff (e.g. for Console -> Print Current Camera...). You will not see this console if you run the program using the bundle (by double-clicking on the app in Finder, or in dock...).

To see the console output, run view3dscene from terminal:

cd directory-where-you-installed-view3dscene/
./view3dscene.app/Contents/MacOS/view3dscene

2. Mac OS X GTK2 applications (old)

2.1. Dependencies to install

Before you run our programs on Mac OS X, you may need to install some additional software:

For libs installed by fink, you may have to add them to your libs path by command like

  export LD_LIBRARY_PATH=/sw/lib:"$LD_LIBRARY_PATH"
before executing programs. (you can add this to your .bashrc or similar file for comfort).

2.2. Developers: additional stuff to install/configure

To actually compile our programs on Mac OS X, developers may need to install a little more stuff. Of course FreePascal Compiler is required. For comfortable RAD development, you may also consider Lazarus (FPC is already included inside Lazarus installations, if you choose normal packages).

As of fink 0.29.21 (on Mac OS X 10.6.7), you should additionally install the fink "pango1-xft2-shlibs" package. Simple "fink install pango1-xft2-shlibs" should do the trick. This is necessary for successful linking.

The linker must know the location of fink and X11 libraries. If you have installed fink and X11 in standard locations, you can simply add these lines to your /etc/fpc.cfg file:

-Fl/sw/lib/
-Fl/usr/X11/lib/

3. Developers: help wanted

The plan:

  1. Make "Mac OS X bundle" (it's basically a directory pretending to be an application). You can find view3dscene SVG icon in the sources.

    Actually, this step is already somewhat done at least for view3dscene. A script create_macosx_bundle.sh will make a nice view3dscene.app, that you should be able to execute. Unfortunately, it doesn't really work yet.

    You can also just try using Lazarus bundle creator.

  2. Optionally, add libpng and vorbisfile libraries to the bundle. We will still be able to link to them dynamically, as far as I know. libpng is required for PNG reading (unless new Mac OS X already includes it?). vorbisfile is required for OggVorbis playing (used by some castle music tracks, used by view3dscene Sound demos).

    See Mac OS X Libraries on FPC wiki for instructions how to include library inside a bundle.

  3. Finally, prepare a script to pack a nice .dmg (instead of current .tar.gz) distribution (of view3dscene, or castle — doesn't matter, I'll adjust it to be more general).

    See http://el-tramo.be/guides/fancy-dmg/ Note: we do not need .pkg (package manager), http://wiki.freepascal.org/Deploying_Your_Application#Using_PackageMaker_on_Mac_OS_X