INSTALL 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. Panda3D Install
  2. This document describes how to compile and install Panda 3D on a
  3. system for the first time. Panda is a complex project and is not
  4. trivial to install, although it is not really very difficult. Please
  5. do take the time to read this document before starting.
  6. Panda is known to build successfully on Linux, SGI Irix, Windows NT
  7. and Windows 2000. It should also be easily portable to other
  8. Unix-based OpenGL systems with little or no changes (please let us
  9. know if you try this). When compiled by Windows NT or 2000, it will
  10. then run on a Windows 95 or 98 system, but we have found that Windows
  11. 98 is not itself stable enough to compile the codebase without
  12. crashing.
  13. Presently, Panda does not compile successfully with Microsoft Visual
  14. C++ version 6.0. You must install Visual C++ 7.0 (that is, Microsoft
  15. Visual Studio .NET) in order to compile Panda on Windows.
  16. Before you begin to compile Panda, there are a number of optional
  17. support libraries that you may wish to install. None of these are
  18. essential; Panda will build successfully without them, but possibly
  19. without some functionality.
  20. * Python. Panda is itself a C++ project, but it can generate a
  21. seamless Python interface layer to its C++ objects and function
  22. calls. Since Python is an interpreted language with a command
  23. prompt, this provides an excellent way to get interactive control
  24. over the 3-D environment. However, it is not necessary to use the
  25. Python interface; Panda is also perfectly useful without Python, as
  26. a C++ 3-D library.
  27. Other scripting language interfaces are possible, too, in theory.
  28. Panda can generate an interface layer for itself that should be
  29. accessible by any scripting language that can make C function calls
  30. to an external library. We have used this in the past, for
  31. instance, to interface Panda with Squeak, an implementation of
  32. Smalltalk. At the present, the Python interface is the only one we
  33. actively maintain. We use Python 2.2; you can get Python at
  34. http://www.python.org .
  35. * NSPR. This is the Netscape Portable Runtime library, an OS
  36. compatibility layer written by the folks at Mozilla for support of
  37. the Netscape browser on different platforms. Panda takes advantage
  38. of NSPR to implement threading and network communications. At the
  39. present, if you do not have NSPR available Panda will not be able to
  40. fork threads and will not provide a networking interface. Aside
  41. from that, the PStats analysis tools (which depend on networking)
  42. will not be built without NSPR. We have compiled Panda with NSPR
  43. version 3 and 4.0, although other versions should also work. You
  44. can download NSPR from http://www.mozilla.org .
  45. * VRPN, the "Virtual Reality Peripheral Network," a peripheral
  46. interface library designed by UNC. This is particularly useful for
  47. interfacing Panda with external devices like trackers and joysticks;
  48. without it, Panda can only interface with the keyboard and mouse.
  49. You can find out about it at http://www.cs.unc.edu/Research/vrpn .
  50. * libjpeg and libtiff. These free libraries provide support to Panda
  51. for reading and writing JPEG and TIFF image files, for instance for
  52. texture images. Even without these libraries, Panda has built-in
  53. support for pbm/pgm/ppm, SGI (rgb), TGA, BMP, and a few other
  54. assorted image types like Alias and SoftImage native formats. Most
  55. Linux systems come with libjpeg and libtiff already installed, and
  56. the version numbers of these libraries is not likely to be
  57. important. You can download libjpeg from the Independent JPEG group
  58. at http://www.ijg.org , and libtiff from SGI at
  59. ftp://ftp.sgi.com/graphics/tiff .
  60. * Gtk--. This is a C++ graphical toolkit library, and is only used
  61. for one application, the PStats viewer for graphical analysis of
  62. real-time performance, which is part of the pandatool package.
  63. Gtk-- only compiles on Unix, and primarily Linux; it may be possible
  64. to compile it with considerable difficulty on Irix. We have used
  65. version 1.2.1. You can find it at http://www.gtkmm.org .
  66. PANDA'S BUILD PHILOSOPHY
  67. Panda is divided into a number of separate packages, each of which
  68. compiles separately, and each of which generally depends on the ones
  69. before it. The packages are, in order:
  70. dtool - this defines most of the build scripts and local
  71. configuration options for Panda. It also includes the program
  72. "interrogate," which is used to generate the Python interface, as
  73. well as some low-level libraries that are shared both by
  74. interrogate and Panda. It is a fairly small package.
  75. panda - this is the bulk of the C++ Panda code. It contains the 3-D
  76. engine itself, as well as supporting C++ interfaces like
  77. networking, audio, and device interfaces. Expect this package to
  78. take from one to two hours to build from scratch. You must build
  79. and install dtool before you can build panda.
  80. direct - this is the high-level Python interface to Panda. Although
  81. there is some additional C++ interface code here, most of the code
  82. in this package is Python; there is no reason to install this
  83. package if you are not planning on using the Python interface.
  84. DIRECT is an acronym, and has nothing to do with DirectX.
  85. You must build and install dtool and panda before you can build
  86. direct.
  87. pandatool - this is a suite of command-line utilities, written in
  88. C++ using the Panda libraries, that provide useful support
  89. functionality for Panda as a whole, like model-conversion
  90. utilities. You must build and install dtool and panda before you
  91. can build pandatool, although it does not depend on direct.
  92. In graphical form, here are packages along with a few extras:
  93. +------------------------------+
  94. | Your Python Application Here |
  95. +------------------------------+
  96. |
  97. V
  98. +--------+ +-----------+ +---------------------------+
  99. | direct | | pandatool | | Your C++ Application Here |
  100. +--------+ +-----------+ +---------------------------+
  101. | | |
  102. +-------------+-------------------/
  103. V
  104. +-------+
  105. | panda |
  106. +-------+
  107. |
  108. V
  109. +-------+
  110. | dtool |
  111. +-------+
  112. The arrows above show dependency.
  113. Usually, these packages will be installed as siblings of each other
  114. within the same directory; the build scripts expect this by default,
  115. although other installations are possible.
  116. In order to support multiplatform builds, we do not include makefiles
  117. or project files with the sources. Instead, all the compilation
  118. relationships are defined in a series of files distributed throughout
  119. the source trees, one per directory, called Sources.pp.
  120. A separate program, called ppremake ("Panda pre-make") reads the
  121. various Sources.pp files, as well as any local configuration
  122. definitions you have provided, and generates the actual makefiles that
  123. are appropriate for the current platform and configuration. It is
  124. somewhat akin to the idea of GNU autoconf ("configure"), although it
  125. is both less automatic and more general, and it supports non-Unix
  126. platforms easily.
  127. HOW TO CONFIGURE PANDA FOR YOUR ENVIRONMENT
  128. When you run ppremake within a Panda source tree, it reads in a number
  129. of configure variable definitions given in the file Config.pp in the
  130. root of the dtool package. Many of these variables will already have
  131. definitions that are sensible for you; some will not. You must
  132. customize these variables before you run ppremake.
  133. Normally, rather than modifying dtool/Config.pp directly, you would
  134. create your own, empty Config.pp file in a safe place (for instance,
  135. in your personal home directory) and define just the variables you
  136. need there. The definitions you give in your personal Config.pp file
  137. will override those in the source directory. You will need to set an
  138. environment variable PPREMAKE_CONFIG to the full filename path of your
  139. personal Config.pp (more on this in the platform-specific installation
  140. notes, below). It is also possible simply to modify dtool/Config.pp,
  141. but this is not recommended as it makes it difficult to install
  142. updated versions of Panda.
  143. The syntax of the Config.pp file is something like a cross between the
  144. C preprocessor and Makefile syntax. The full syntax of ppremake
  145. input scripts is described in more detail in another document, but the
  146. most common thing you will need to do is set the value of a variable
  147. using the #define statement. Look in dtool/Config.pp for numerous
  148. examples of this.
  149. Some of the variables you may define within the Config.pp file hold a
  150. true or a false value by nature. It is important to note that you
  151. indicate a variable is true by defining it to some nonempty string
  152. (e.g. "yes" or "1"), and false by defining it to nothing. For
  153. example:
  154. #define HAVE_DX 1
  155. Indicates you have the DirectX SDK installed, while
  156. #define HAVE_DX
  157. Indicates you do not. Do not be tempted to define HAVE_DX to "no" or
  158. "0"; since these are both nonempty strings, they are considered to
  159. represent "true"!
  160. The comments within dtool/Config.pp describe a more complete list of
  161. the variables you may define. The ones that you are most likely to
  162. find useful are:
  163. INSTALL_DIR - this is the prefix of the directory hierarchy into
  164. which Panda should be installed. By default, this is
  165. /usr/local/panda, a fine convention for Unix machines although a
  166. little questionable for Windows environments.
  167. OPTIMIZE - define this to 1, 2, 3, or 4. This is not the same thing
  168. as compiler optimization level; our four levels of OPTIMIZE define
  169. broad combinations of compiler optimizations and debug symbols:
  170. 1 - No compiler optimizations, full debug symbols
  171. 2 - Full compiler optimizations, full debug symbols
  172. (if the compiler supports this)
  173. 3 - Full compiler optimizations, no debug symbols, non-debug heap
  174. 4 - Full optimizations, no debug symbols, and asserts removed
  175. Usually OPTIMIZE 2 or 3 is the most appropriate choice for
  176. development work.
  177. PYTHON_IPATH / PYTHON_LPATH / PYTHON_LIBS - the full pathname to
  178. Python header files, if Python is installed on your system. As of
  179. Python version 2.0, compiling Python interfaces doesn't require
  180. linking with any special libraries, so normally PYTHON_LPATH and
  181. PYTHON_LIBS are left empty.
  182. NSPR_IPATH / NSPR_LPATH / NSPR_LIBS - the full pathname to NSPR
  183. header and library files, and the name of the NSPR library, if
  184. NSPR is installed on your system.
  185. VRPN_IPATH / VRPN_LPATH / VRPN_LIBS - the full pathname to VRPN
  186. header and library files, and the name of the VRPN libraries, if
  187. VRPN is installed on your system.
  188. DX_IPATH / DX_LPATH / DX_LIBS - the full pathname to the DirectX 8.1
  189. SDK header and library files, if you have installed this SDK.
  190. (You must currently install this SDK in order to build DirectX
  191. support for Panda.)
  192. GL_IPATH / GL_LPATH / GL_LIBS - You get the idea. (Normally, OpenGL
  193. is installed in the standard system directories, so you can leave
  194. GL_IPATH and GL_LPATH empty. But if they happen to be installed
  195. somewhere else on your machine, you can fill in the pathnames
  196. here.)
  197. HOW TO BUILD PANDA ON A UNIX SYSTEM
  198. First, make a subdirectory to hold the Panda sources. This can be
  199. anywhere you like; in these examples, we'll assume you build
  200. everything within a directory called "panda3d" in your home directory.
  201. mkdir ~/panda3d
  202. You must compile ppremake before you can begin to compile Panda
  203. itself. Generally, you do something like the following:
  204. cd ~/panda3d/ppremake
  205. ./configure
  206. make
  207. make install
  208. By default, ppremake will install itself in /usr/local/panda/bin, the
  209. same directory that the other Panda binaries will install themselves
  210. to. If you prefer, you can install it in another directory by doing
  211. something like this:
  212. ./configure --prefix=/my/install/directory
  213. If you do this, you will also want to redefine INSTALL_DIR in your
  214. Config.pp to be the same directory (see above). Wherever you install
  215. it, you should make sure the bin directory is included on your search
  216. path, and the corresponding lib directory (e.g. /usr/local/panda/lib)
  217. is on your LD_LIBRARY_PATH (the following example assumes you are
  218. using a csh derivative):
  219. set path=(/usr/local/panda/bin $path)
  220. setenv LD_LIBRARY_PATH /usr/local/panda/lib:$LD_LIBRARY_PATH
  221. If you have a Bourne-shell derivative, e.g. bash, the syntax is:
  222. PATH=/usr/local/panda/bin:$PATH
  223. LD_LIBRARY_PATH=/usr/local/panda/lib:$LD_LIBRARY_PATH
  224. export LD_LIBRARY_PATH
  225. Now you should create your personal Config.pp file, as described
  226. above, and customize whatever variables are appropriate. Be sure to
  227. set the PPREMAKE_CONFIG environment variable to point to it.
  228. setenv PPREMAKE_CONFIG ~/Config.pp
  229. In bash:
  230. PPREMAKE_CONFIG=~/Config.pp
  231. export PPREMAKE_CONFIG
  232. You may find it a good idea to make these environment settings in your
  233. .cshrc or .bashrc file so that they will remain set for future sessions.
  234. Now that you have ppremake, you can test the configuration settings in
  235. your Config.pp file.
  236. cd ~/panda3d/dtool
  237. ppremake
  238. When you run ppremake within the dtool directory, it will generate a
  239. file, dtool_config.h (as well as all of the Makefiles). This file
  240. will be included by all of the Panda3D sources, and reveals the
  241. settings of many of the options you have configured. You should
  242. examine this file to ensure that your settings have been made the way
  243. you expect.
  244. Now you can build the Panda3D sources. Begin with dtool (the current
  245. directory):
  246. make
  247. make install
  248. Once you have successfully built and installed dtool, you can then
  249. build and install panda:
  250. cd ~/panda3d/panda
  251. ppremake
  252. make
  253. make install
  254. After installing panda, you are almost ready to run the program
  255. "pview," which is a basic model viewer program that demonstrates some
  256. Panda functionality. Successfully running pview proves that Panda is
  257. now installed and configured correctly. However, you must set up a
  258. Configrc file to set your runtime configuration options before you can
  259. run Panda and open up a graphics window. See HOW TO RUN PANDA, below.
  260. If you wish, you may also build direct or pandatool:
  261. cd ~/panda3d/direct
  262. ppremake
  263. make
  264. make install
  265. cd ~/panda3d/pandatool
  266. ppremake
  267. make
  268. make install
  269. HOW TO BUILD PANDA ON A WINDOWS SYSTEM, USING CYGWIN
  270. Cygwin is a set of third-party libraries and tools that present a very
  271. Unix-like environment for Windows systems. If you prefer to use a
  272. Unix environment, Cygwin is the way to go. You can download a free
  273. version from http://www.cygwin.com which will have almost everything
  274. you might need, or you can purchase a CD which has some additional
  275. tools (including csh or bash) that you might find useful.
  276. Panda can build and run within a Cygwin environment, but it does not
  277. require it. Note that Cygwin is used strictly as a build environment;
  278. the Cygwin compiler is not used, so no dependency on Cygwin will be
  279. built into Panda. The Panda DLL's that you will generate within a
  280. Cygwin environment will be exactly the same as those you would
  281. generate in a non-Cygwin environment; once built, Panda will run
  282. correctly on any Win32 machine, with or without Cygwin installed.
  283. If you do not wish to install Cygwin for your build environment, see
  284. the instructions below.
  285. If you wish to use Cygwin, there is one important point to keep in
  286. mind. Panda internally uses a Unix-like filename convention; that is,
  287. forward slashes (instead of backslashes) separate directory
  288. components, and there is no leading drive letter on any filename.
  289. These Unix-like filenames are mapped to Windows filenames (with drive
  290. letters and backslashes) when system calls are made.
  291. Cygwin also uses a Unix-like filename convention, and uses a series of
  292. mount commands to control the mapping of Unix filenames to Windows
  293. filenames. Panda is not itself a Cygwin program, and does not read
  294. the Cygwin mount definitions.
  295. That's important enough it's worth repeating. Panda is not aware of
  296. the Cygwin mount points. So a Unix-like filename that makes sense to
  297. a Cygwin command may not be accessible by the same filename from
  298. within Panda.
  299. However, you can set things up so that most of the time, Cygwin and
  300. Panda agree, which is convenient. To do this, it is important to
  301. understand how Panda maps Unix-like filenames to Windows filenames.
  302. * Any relative pathname (that is, a pathname that does not begin
  303. with a leading slash) is left unchanged, except to reverse the
  304. slashes.
  305. * Any full pathname whose topmost directory component is *not* a
  306. single letter is prepended with the contents of the environment
  307. variable PANDA_ROOT.
  308. * Any full pathname whose topmost directory component *is* a single
  309. letter is turned into a drive letter and colon followed by the
  310. remainder of the path. For example, /c/windows/system is turned
  311. into C:\windows\system.
  312. The expectation is that most of the files you will want to access
  313. within Panda will all be within one directory structure, which you
  314. identify by setting the PANDA_ROOT variable. Generally, when you are
  315. using Cygwin, you will want to set this variable to be the same thing
  316. as the root of your Cygwin tree.
  317. For instance, typically Cygwin installs itself in C:\Cygwin. This
  318. means that when you reference the directory /usr/local/bin within
  319. Cygwin, you are actually referring to C:\Cygwin\usr\local\bin. You
  320. should therefore set PANDA_ROOT to C:\Cygwin, so that /usr/local/bin
  321. within Panda will also refer to C:\Cygwin\usr\local\bin.
  322. To sum up: to use Panda within a Cygwin environment,
  323. In tcsh:
  324. setenv PANDA_ROOT 'C:\Cygwin'
  325. or in bash:
  326. PANDA_ROOT='C:\Cygwin'
  327. Follow the instructions under HOW TO BUILD PANDA FOR A UNIX
  328. ENVIRONMENT, above.
  329. HOW TO BUILD PANDA ON A WINDOWS SYSTEM, WITHOUT CYGWIN
  330. You will need a directory for holding the installed Panda. This can
  331. be anywhere you like; in this example we'll assume you use a directory
  332. called "panda3d" on the root of the C drive.
  333. md c:\panda3d
  334. Panda3D includes a pre-compiled ppremake.exe, but not the cygwin DLL.
  335. Since ppremake is a Cygwin program (even though the rest of Panda is
  336. not), you will need the DLL in order to run ppremake.
  337. The cygwin1.dll should be available at http://www.cygwin.com
  338. Make sure the Panda bin and lib directories are on your path, and set
  339. a few environment variables for building. We suggest creating a file
  340. called PandaEnv.bat to hold these commands; then you may invoke this
  341. batch file before every Panda session to set up your environment
  342. properly. Alternatively, you may make these definitions in the
  343. registry.
  344. path c:\panda3d\bin;c:\panda3d\lib;%PATH%
  345. set PANDA_ROOT=c:\
  346. set PPREMAKE_CONFIG=c:\panda3d\Config.pp
  347. Setting PANDA_ROOT specifies the default drive Panda will search for
  348. file references. (Panda internally uses a Unix-like filename
  349. convention, which does not use leading drive letters. See the bullet
  350. points in the Cygwin section, above, describing the rules Panda uses
  351. to map its Unix-like filenames to Windows filenames.)
  352. Now make a directory for building Panda. This may be different from
  353. the directory, above, that holds the installed Panda files; or it may
  354. be the same. In this example we assume you will be building in the
  355. same directory, c:\panda3d.
  356. Now set up your personal Config.pp file to control your local
  357. configuration settings, as described above. We suggest putting it in
  358. the root of the build directory.
  359. edit c:\panda3d\Config.pp
  360. Add at least the following line to your Config.pp file. (You may want
  361. to add additional lines, according to your needs. See HOW TO
  362. CONFIGURE PANDA FOR YOUR ENVIRONMENT, above.)
  363. #define INSTALL_DIR c:\panda3d
  364. Now you should be able to build dtool.
  365. c:
  366. cd \panda3d\dtool
  367. ppremake
  368. nmake
  369. nmake install
  370. And then build panda.
  371. c:
  372. cd \panda3d\panda
  373. ppremake
  374. nmake
  375. nmake install
  376. And (optionally) build direct.
  377. c:
  378. cd \panda3d\direct
  379. ppremake
  380. nmake
  381. nmake install
  382. And (optionally) build pandatool.
  383. c:
  384. cd \panda3d\pandatool
  385. ppremake
  386. nmake
  387. nmake install
  388. HOW TO RUN PANDA
  389. Once Panda has been successfully built and installed, you should be
  390. able to run pview to test that everything is working:
  391. pview
  392. The first time you run pview, if you have not yet created a Configrc
  393. file, you should see something like this:
  394. Known pipe types:
  395. No interactive pipe is available! Check your Configrc!
  396. If you get instead an error about some shared library or libraries not
  397. being found, check that your LD_LIBRARY_PATH setting (on Unix) or your
  398. PATH (on Windows) include the directory in which all of the Panda
  399. libraries have been installed (That is, $INSTALL_DIR/lib, or whatever
  400. you set INSTALL_DIR to followed by "lib". On Unix, this defaults to
  401. /usr/local/panda/lib).
  402. If you do get the above error message, you will need to create a
  403. Configrc file to indicate some run-time parameters. This is different
  404. from the Config.pp file you created above, which is only used by
  405. ppremake to define compile-time parameters; the Configrc file is read
  406. every time Panda is started and it defines parameters that control
  407. run-time behavior.
  408. Create a file called Configrc in your home directory (or wherever you
  409. find convenient). Note that this file must have no extension; in
  410. particular, it should not have the extension "txt". Notepad will add
  411. this extension by default, so if you use Notepad to create the file,
  412. you should then rename it so that it does not have the extension
  413. "txt".
  414. For now, add just the line:
  415. load-display pandagl
  416. Or, if you are on Windows and prefer to use DirectX instead of OpenGL,
  417. add instead the line:
  418. load-display pandadx
  419. Later you may add additional lines here to control the default
  420. behavior of Panda in other ways.
  421. If you do not specify otherwise, Panda will look for the Configrc file
  422. in the current directory, so for now try to run pview from within the
  423. same directory as your Configrc file. If all goes well, it should
  424. open up a window with a blue triangle. You can use the mouse to move
  425. the triangle around. You can also pass the name of an egg file, if
  426. you have one, on the command line, and pview will load up and display
  427. the egg file.
  428. If you want to load the Configrc from other than the current
  429. directory, set the following two environment variables:
  430. CONFIG_CONFIG=:configpath=CFG_PATH
  431. CFG_PATH=/my/home/directory
  432. Where /my/home/directory is the name of your home directory (or
  433. wherever you put the Configrc file). Note that forward slashes should
  434. be used, according to the Panda convention. Also note that on
  435. Windows, the path you specify is relative to the directory named by
  436. PANDA_ROOT, unless it begins with a single-letter directory name (see
  437. the explanation of how Panda maps its internal filenames to Windows
  438. filenames, above.)