Building Panda3d 1.5.4 on Mac OSX

By John "asceth" Long on 20 Mar 2009

Panda3d is an open source, cross-platform game engine. It is written in C++ but includes a first-class Python interface. This means very, very few things actually require you to go down to C++ to use the all of the features of the engine. Panda3d is distributed as packages for Windows and *nix based distro's along with the source code. However compiling for Mac OSX isn't as straight forward as it sounds. These are the steps I took to build Panda3d on my Macbook Pro (OSX 10.5.6).

Most of this tutorial comes from http://art.bitbop.net/2008/08/building-panda3d-on-mac-os-x/.

Update 3/23/09: Added more instructions for sample model building and common shaders.


Steps

1) Download Panda3d 1.5.4 and extract it

$ wget http://panda3d.org/download/panda3d-1.5.4/panda3d-1.5.4.tar.gz
$ tar xvzf panda3d-1.5.4.tar.gz
$ cd panda3d-1.5.4

2) Install dependencies with MacPorts

$ sudo port install jpeg tiff libpng
$ sudo port install libtar ode fftw
$ sudo port install freetype

3) Install NVIDIA Cg Tookit


4) Build ppremake

$ cd ppremake
$ aclocal
$ autoheader
$ automake --foreign -a
$ autoconf
$ ./configure
$ make
$ sudo make install

5) Configure your .bash_profile (open ~/.bash_profile in your favorite editor and add these lines)

export PATH=/usr/local/panda/bin:$PATH
export PYTHONPATH=/usr/local/panda/lib:/usr/local/panda/lib/direct:$PYTHONPATH
export DYLD_LIBRARY_PATH=/usr/local/panda/lib:$DYLD_LIBRARY_PATH

6) Set ownership of /usr/local/panda to yourself (optional otherwise some commands below need to be prefixed with sudo)

$ sudo chown -R user:group /usr/local/panda

7) Create the Config.pp file in /usr/local/panda

#define PYTHON_IPATH /usr/include/python2.5
#define PYTHON_LPATH /usr/lib/python2.5
#define JPEG_IPATH /opt/local/include
#define JPEG_LPATH /opt/local/lib
#define PNG_IPATH /usr/X11/include/libpng
#define PNG_LPATH /usr/X11/lib/
#define TIFF_IPATH /opt/local/include
#define TIFF_LPATH /opt/local/lib
#define TAR_IPATH /opt/local/include
#define TAR_LPATH /opt/local/lib
#define HAVE_FFTW 1
#define FFTW_IPATH /opt/local/include
#define FFTW_LPATH /opt/local/lib
#define FFTW_LIBS dfftw drfftw
#define CG_IPATH /Library/Frameworks/Cg.framework/Headers
#define CG_LPATH /Library/Frameworks/Cg.framework
#define CG_LIBS
#define CG_FRAMEWORK Cg
#define HAVE_CG 1
#define CGGL_LIBS
#define CGGL_FRAMEWORK Cg
#define HAVE_CGGL 1
#define ZLIB_IPATH /opt/local/include
#define ZLIB_LPATH /opt/local/lib
#define ODE_IPATH /opt/local/include
#define ODE_LPATH /opt/local/lib

8) Build dtool

$ cd dtool
$ ppremake
$ make
$ make install

9) Build panda

$ cd panda
$ ppremake
$ make
$ make install

10) Build direct

$ cd direct
$ ppremake
$ make
$ make install

11) Build pandatool

$ cd pandatool
$ ppremake
$ make
$ make install

12) Build dmodels

$ cd dmodels
$ ppremake
$ make
$ make install

13) Copy sample models and filters (change /usr/local/panda to where you installed panda3d)

$ cd models
$ cp -r ./* /usr/local/panda/models/
$ cd ../direct/src/filter
$ cp -r ./*sha /usr/local/panda/lib/direct/filter/

14) Run genPyCode

$ genPyCode

15) Create the Config.prc file in /usr/local/panda/etc (More details here)

plugin-path /usr/local/panda/lib
default-model-extension .egg.pz
model-path .
model-path /usr/local/panda/models

15a) If you set your model extension to .egg.pz above then run these commands for panda3d's built in models

$ cd /usr/local/panda
$ find . -type f -name *.egg | xargs pzip
$ cd /usr/local/panda/models/gui/
$ bam2egg dialog_box_gui.bam dialog_box_gui.egg
$ bam2egg radio_button_gui.bam radio_button_gui.egg
$ pzip *egg
$ cd ../misc
$ # run bam2egg filename outfilename.egg on all .bam files
$ pzip *egg

16) Done.

Comments