Panda3D Manual: How to compile a CXX Panda3D program on Mac OS X
This short guide explains how to build a Panda3D game written in C++ game under Mac OS. Mac OS comes with python installed, however because of production cycles your version may be a bit outdated, if you want to download the latest python version, you can go to the Python website. Just make sure that the Panda3D version is compatible with it. In order to compile you need also to have the GNU G++ compiler. Unlike in Linux, the G++ compiler is not pre-installed in Mac OS X, you will need to install Xcode development tools, the installer comes in the Mac OS installer CDs or DVDs, however for newer versions, you can download it from its website. You will need to register for an account. Having these two components, we can proceed to compile: First we must create .o file from our cxx file. We need to link to the Panda3D include files and to the Python include files. Note: only 386 arch is supported for panda 1.7.0 so we need to include the -arch i386 flag. g++ -c filename.cxx -o filename.o -fPIC -O2 -arch i386 -I{pythoninclude} -I{panda3dinclude} Please change the paths in these commands to the appropiate locations. A list of locations is at the end of the page. Secondly, we need to generate an executable, you can use the following command: g++ filename.o -o filename -fPIC -arch i386 -L{panda3dlibs} -lp3framework -lpanda -lpandafx -lpandaexpress -lp3dtoolconfig -lp3dtool -lp3pystub -lp3direct As mentioned above, we need to change the paths accordingly, the paths for Mac OS are listed below: • {pythoninclude}: The path to your Python include folder. For version 2.5, this is /usr/include/python2.5 by default. • {panda3dinclude}: Change this to the path to your Panda3D include directory. This would probably look like /Developer/Panda3D/include/ in the case of 1.7.0. (for 1.6.2 use /Applications/Panda3D/1.6.2/include/) • {panda3dlibs}: Change this to the path to your Panda3D libraries. This is /Developer/Panda3D/lib in the case of 1.7.0. (for 1.6.2 use /Applications/Panda3D/1.6.2/lib/) And lastly to run the created executable, type: ./filename
• If you get errors like "Undefined symbols: "TypedObject::_type_handle", referenced from: " you are not including some panda3d libraries needed or missing the-arch i386 flag. • If you get an error running your executable like "dyld: Library not loaded: @executable_path/../Library/Frameworks/Cg.framework/Cg" means you need to install Cg library from http://developer.nvidia.com/object/cg_download.html
© Carnegie Mellon University 2010 |