INSTALL-PP 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  1. ///////////////////////////////////////////////////////////////////////
  2. // Caution: there are two separate, independent build systems:
  3. // 'makepanda', and 'ppremake'. Use one or the other, do not attempt
  4. // to use both. This file is part of the 'ppremake' system.
  5. ///////////////////////////////////////////////////////////////////////
  6. Panda3D Install --- using the 'ppremake' system.
  7. This document describes how to compile and install Panda 3D on a
  8. system for the first time. Panda is a complex project and is not
  9. trivial to install, although it is not really very difficult. Please
  10. do take the time to read this document before starting.
  11. Panda is known to build successfully on Linux, SGI Irix, and Windows
  12. NT/2000/XP. It should also be easily portable to other Unix-based
  13. OpenGL systems with little or no changes (please let us know if you
  14. try this). When compiled by Windows NT/2000/XP, it will then run on a
  15. Windows 98 system, but we have found that Windows 98 is not itself
  16. stable enough to compile the codebase without crashing.
  17. Before you begin to compile Panda, there are a number of optional
  18. support libraries that you may wish to install. None of these are
  19. essential; Panda will build successfully without them, but possibly
  20. without some functionality.
  21. * Python. Panda is itself a C++ project, but it can generate a
  22. seamless Python interface layer to its C++ objects and function
  23. calls. Since Python is an interpreted language with a command
  24. prompt, this provides an excellent way to get interactive control
  25. over the 3-D environment. However, it is not necessary to use the
  26. Python interface; Panda is also perfectly useful without Python, as
  27. a C++ 3-D library.
  28. Other scripting language interfaces are possible, too, in theory.
  29. Panda can generate an interface layer for itself that should be
  30. accessible by any scripting language that can make C function calls
  31. to an external library. We have used this in the past, for
  32. instance, to interface Panda with Squeak, an implementation of
  33. Smalltalk. At the present, the Python interface is the only one we
  34. actively maintain. We use Python 2.2, but almost any version should
  35. work; you can get Python at http://www.python.org .
  36. * NSPR. This is the Netscape Portable Runtime library, an OS
  37. compatibility layer written by the folks at Mozilla for support of
  38. the Netscape browser on different platforms. Panda takes advantage
  39. of NSPR to implement threading and network communications. At the
  40. present, if you do not have NSPR available Panda will not be able to
  41. fork threads and will not provide a networking interface. Aside
  42. from that, the PStats analysis tools (which depend on networking)
  43. will not be built without NSPR. We have compiled Panda with NSPR
  44. version 3 and 4.0, although other versions should also work. You
  45. can download NSPR from http://www.mozilla.org/projects/nspr/ .
  46. * VRPN, the "Virtual Reality Peripheral Network," a peripheral
  47. interface library designed by UNC. This is particularly useful for
  48. interfacing Panda with external devices like trackers and joysticks;
  49. without it, Panda can only interface with the keyboard and mouse.
  50. You can find out about it at http://www.cs.unc.edu/Research/vrpn .
  51. * libjpeg, libtiff, libpng. These free libraries provide support to
  52. Panda for reading and writing JPEG, TIFF, and PNG image files, for
  53. instance for texture images. Even without these libraries, Panda
  54. has built-in support for pbm/pgm/ppm, SGI (rgb), TGA, BMP, and a few
  55. other assorted image types like Alias and SoftImage native formats.
  56. Most Linux systems come with these libraries already installed, and
  57. the version numbers of these libraries is not likely to be
  58. important. You can download libjpeg from the Independent JPEG group
  59. at http://www.ijg.org , libtiff from SGI at
  60. ftp://ftp.sgi.com/graphics/tiff , and libpng from
  61. http://www.libpng.org .
  62. * zlib. This very common free library provides basic
  63. compression/decompression routines, and is the basis for the Unix
  64. gzip tool (among many other things). If available, Panda uses it to
  65. enable storing compressed files within its native multifile format,
  66. as well as in a few other places here and there. It's far from
  67. essential. If you don't have it already, you can get it at
  68. http://www.gzip.org/zlib .
  69. * Fmod. This is a free sound library that our friends at CMU have
  70. recently integrated into Panda. It provides basic support for
  71. playing WAV files, MP3 files, and MIDI files within Panda. Get it
  72. at http://www.fmod.org .
  73. * Freetype. This free library provides support for loading TTF font
  74. files (as well as many other types of font files) directly for
  75. rendering text within Panda (using Panda's TextNode interface, as
  76. well as the whole suite of DirectGui 2-d widgets in direct). If you
  77. do not have this library, you can still render text in Panda, but
  78. you are limited to using fonts that have been pre-generated and
  79. stored in egg files. There are a handful of provided font files of
  80. this nature in the models directory (specifically, cmr12, cmss12,
  81. and cmtt12); these were generated from some of the free fonts
  82. supplied with TeX. This can be found at http://www.freetype.org ;
  83. you will need at least version 2.0.
  84. * OpenSSL. This free library provides an interface to secure SSL
  85. communications (as well as a normal, unsecured TCP/IP library). It
  86. is used to implement the HTTP client code in Panda for communicating
  87. with web servers and/or loading files directly from web servers, in
  88. both normal http and secure https modes. It also provides some
  89. basic encryption services, allowing encrypted files to be stored in
  90. metafiles (for instance). If you do not have any need to contact
  91. web servers with your Panda client, and you have no interest in
  92. encryption, you do not need to install this library. Find it at
  93. http://www.openssl.org . We used version 0.9.6 or 0.9.7, but if
  94. there is a more recent version it should be fine.
  95. * FFTW, the "Fastest Fourier Transform in the West". This free
  96. whimsically-named library provides the mathematical support for
  97. compressing animation tables into Panda's binary bam format. If
  98. enabled, animation tables can be compressed in a lossy form similar
  99. to jpeg, which provides approximately a 5:1 compression ratio better
  100. than gzip alone even at the most conservative setting. If you don't
  101. need to have particularly small animation files, you don't need this
  102. library. Get it at http://www.fftw.org .
  103. * Gtk--. This is a C++ graphical toolkit library, and is only used
  104. for one application, the PStats viewer for graphical analysis of
  105. real-time performance, which is part of the pandatool package.
  106. Gtk-- only compiles on Unix, and primarily Linux; it is possible to
  107. compile it with considerable difficulty on Irix. (On Windows, you
  108. don't need this, since you will use the pstats viewer built in the
  109. win-stats subdirectory instead.) We have used version 1.2.1. You
  110. can find it at http://www.gtkmm.org .
  111. PANDA'S BUILD PHILOSOPHY
  112. Panda is divided into a number of separate packages, each of which
  113. compiles separately, and each of which generally depends on the ones
  114. before it. The packages are, in order:
  115. dtool - this defines most of the build scripts and local
  116. configuration options for Panda. It also includes the program
  117. "interrogate," which is used to generate the Python interface, as
  118. well as some low-level libraries that are shared both by
  119. interrogate and Panda. It is a fairly small package.
  120. panda - this is the bulk of the C++ Panda code. It contains the 3-D
  121. engine itself, as well as supporting C++ interfaces like
  122. networking, audio, and device interfaces. Expect this package to
  123. take from 30 to 60 minutes to build from scratch. You must build
  124. and install dtool before you can build panda.
  125. direct - this is the high-level Python interface to Panda. Although
  126. there is some additional C++ interface code here, most of the code
  127. in this package is Python; there is no reason to install this
  128. package if you are not planning on using the Python interface.
  129. DIRECT is an acronym, and has nothing to do with DirectX.
  130. You must build and install dtool and panda before you can build
  131. direct.
  132. pandatool - this is a suite of command-line utilities, written in
  133. C++ using the Panda libraries, that provide useful support
  134. functionality for Panda as a whole, like model-conversion
  135. utilities. You must build and install dtool and panda before you
  136. can build pandatool, although it does not depend on direct.
  137. pandaapp - this holds a few sample applications that link with panda
  138. (and pandatool), but are not generally useful enough to justify
  139. putting them in pandatool. Most of these are not actually
  140. graphical applications; they just take advantage of the various
  141. support libraries (like HTTPClient) that Panda provides. At the
  142. moment, most people probably won't find anything useful here, but
  143. you're welcome to browse; and we will probably add more
  144. applications later. You must build and install dtool, panda, anda
  145. pandatool before you can build pandaapp.
  146. In graphical form, here are the packages along with a few extras:
  147. +------------------------------+
  148. | Your Python Application Here |
  149. +------------------------------+
  150. |
  151. | +-----------+
  152. | | pandaapp |
  153. | +-----------+
  154. | |
  155. V V
  156. +--------+ +-----------+ +---------------------------+
  157. | direct | | pandatool | | Your C++ Application Here |
  158. +--------+ +-----------+ +---------------------------+
  159. | | |
  160. +-------------+-------------------/
  161. V
  162. +-------+
  163. | panda |
  164. +-------+
  165. |
  166. V
  167. +-------+
  168. | dtool |
  169. +-------+
  170. The arrows above show dependency.
  171. Usually, these packages will be installed as siblings of each other
  172. within the same directory; the build scripts expect this by default,
  173. although other installations are possible.
  174. In order to support multiplatform builds, we do not include makefiles
  175. or project files with the sources. Instead, all the compilation
  176. relationships are defined in a series of files distributed throughout
  177. the source trees, one per directory, called Sources.pp.
  178. A separate program, called ppremake ("Panda pre-make") reads the
  179. various Sources.pp files, as well as any local configuration
  180. definitions you have provided, and generates the actual makefiles that
  181. are appropriate for the current platform and configuration. It is
  182. somewhat akin to the idea of GNU autoconf ("configure"), although it
  183. is both less automatic and more general, and it supports non-Unix
  184. platforms easily.
  185. HOW TO CONFIGURE PANDA FOR YOUR ENVIRONMENT
  186. When you run ppremake within a Panda source tree, it reads in a number
  187. of configuration variable definitions given in the file Config.pp in
  188. the root of the dtool package, as well as in a custom Config.pp file
  189. that you specify. Many of the variables in dtool/Config.pp will
  190. already have definitions that are sensible for you; some will not.
  191. You must customize these variables before you run ppremake.
  192. Normally, rather than modifying dtool/Config.pp directly, you should
  193. create your own, empty Config.pp file. By default, this file should
  194. be stored in the root of the Panda install directory, as specified
  195. when you built ppremake, but you may put it elsewhere if you prefer by
  196. setting the environment variable PPREMAKE_CONFIG to its full filename
  197. path (more on this in the platform-specific installation notes,
  198. below).
  199. The definitions you give in your personal Config.pp file will override
  200. those given in the file within dtool. It is also possible simply to
  201. modify dtool/Config.pp, but this is not recommended as it makes it
  202. difficult to remember which customizations you have made, and makes
  203. installing updated versions of Panda problematic.
  204. The syntax of the Config.pp file is something like a cross between the
  205. C preprocessor and Makefile syntax. The full syntax of ppremake input
  206. scripts is described in more detail in another document, but the most
  207. common thing you will need to do is set the value of a variable using
  208. the #define statement (or the mostly equivalent #defer statement).
  209. Look in dtool/Config.pp for numerous examples of this.
  210. Some of the variables you may define within the Config.pp file hold a
  211. true or a false value by nature. It is important to note that you
  212. indicate a variable is true by defining it to some nonempty string
  213. (e.g. "yes" or "1"), and false by defining it to nothing. For
  214. example:
  215. #define HAVE_DX9 1
  216. Indicates you have the DirectX SDK installed, while
  217. #define HAVE_DX9
  218. Indicates you do not. Do not be tempted to define HAVE_DX9 to no or 0;
  219. since these are both nonempty strings, they are considered to
  220. represent true! Also, don't try to use a pair of quotation marks to
  221. represent the empty string, since the quotation marks become part of
  222. the string (which is thus nonempty).
  223. The comments within dtool/Config.pp describe a more complete list of
  224. the variables you may define. The ones that you are most likely to
  225. find useful are:
  226. INSTALL_DIR - this is the prefix of the directory hierarchy into
  227. which Panda should be installed. If this is not defined, the
  228. default value is compiled into ppremake. A full description on
  229. setting this parameter is given below in the section describing
  230. how to build ppremake. On Unix systems this is taken from the
  231. --prefix parameter to configure (usually /usr/local/panda); for
  232. Windows users it is specified in config_msvc.h, and is set to
  233. C:\Panda3d unless you modify it.
  234. OPTIMIZE - define this to 1, 2, 3, or 4. This is not the same thing
  235. as compiler optimization level; our four levels of OPTIMIZE define
  236. broad combinations of compiler optimizations and debug symbols:
  237. 1 - No compiler optimizations, full debug symbols
  238. Windows: debug heap
  239. 2 - Full compiler optimizations, debug symbols
  240. Windows: debug heap
  241. 3 - Full compiler optimizations,
  242. Unix: no debug symbols
  243. Windows: non-debug heap, debug symbols available in pdb files
  244. 4 - Full optimizations, no debug symbols, and asserts removed
  245. Windows: non-debug heap
  246. Usually OPTIMIZE 3 is the most appropriate choice for development
  247. work. We recommend OPTIMIZE 4 only for final QA and/or
  248. distribution of a shippable product, never for any development or
  249. alpha testing; and we recommend OPTIMIZE levels 1 and 2 only for
  250. active development of the C++ code within Panda.
  251. PYTHON_IPATH / PYTHON_LPATH / PYTHON_LIBS - the full pathname to
  252. Python header files, if Python is installed on your system. As of
  253. Python version 2.0, compiling Python interfaces doesn't require
  254. linking with any special libraries, so normally PYTHON_LPATH and
  255. PYTHON_LIBS are left empty. You definitely need to set
  256. PYTHON_IPATH, however, if you wish to compile Panda so that it can
  257. be used from Python.
  258. NSPR_IPATH / NSPR_LPATH / NSPR_LIBS - the full pathname to NSPR
  259. header and library files, and the name of the NSPR library, if
  260. NSPR is installed on your system.
  261. VRPN_IPATH / VRPN_LPATH / VRPN_LIBS - the full pathname to VRPN
  262. header and library files, and the name of the VRPN libraries, if
  263. VRPN is installed on your system.
  264. DX9_IPATH / DX9_LPATH / DX9_LIBS - the full pathname to the
  265. DirectX 9 SDK header and library files, if you have installed
  266. this SDK. (You must currently install this SDK in order to
  267. build DirectX9 support for Panda.)
  268. GL_IPATH / GL_LPATH / GL_LIBS - You get the idea. (Normally, OpenGL
  269. is installed in the standard system directories, so you can leave
  270. GL_IPATH and GL_LPATH empty. But if they happen to be installed
  271. somewhere else on your machine, you can fill in the pathnames
  272. here.)
  273. Similar *_IPATH / *_LPATH / *_LIBS variables for other optional
  274. third-party libraries.
  275. HOW TO BUILD PANDA ON A UNIX SYSTEM
  276. First, make a subdirectory to hold the Panda sources. This can be
  277. anywhere you like; in these examples, we'll assume you build
  278. everything within a directory called "panda3d" in your home directory.
  279. mkdir ~/panda3d
  280. You should also create the directory into which panda should be
  281. installed. The default installation directory is /usr/local/panda.
  282. You may choose an alternate installation directory by using the
  283. --prefix parameter to the ppremake configure script, described below.
  284. We recommend giving yourself write permission to this directory, so
  285. that you can run 'make install' and similar scripts that will need to
  286. write to this installation directory, without having to be root.
  287. su root
  288. mkdir /usr/local/panda
  289. chown <your-user-name> /usr/local/panda
  290. exit
  291. Whatever you choose for your installation directory, you should make
  292. sure the bin directory (e.g. /usr/local/panda/bin) is included on your
  293. search path, and the lib directory (e.g. /usr/local/panda/lib) is on
  294. your LD_LIBRARY_PATH. If you use a C-shell derivative like tcsh, the
  295. syntax for this is:
  296. set path=(/usr/local/panda/bin $path)
  297. setenv LD_LIBRARY_PATH /usr/local/panda/lib:$LD_LIBRARY_PATH
  298. If you have a Bourne-shell derivative, e.g. bash, the syntax is:
  299. PATH=/usr/local/panda/bin:$PATH
  300. LD_LIBRARY_PATH=/usr/local/panda/lib:$LD_LIBRARY_PATH
  301. export LD_LIBRARY_PATH
  302. You must now compile ppremake before you can begin to compile Panda
  303. itself. Generally, you do something like the following:
  304. cd ~/panda3d/ppremake
  305. ./configure
  306. make
  307. make install
  308. If the configure script does not already exist, read the document
  309. BUILD_FROM_CVS.txt in the ppremake source directory.
  310. As mentioned above, the default installation directory is
  311. /usr/local/panda. Thus, ppremake will install itself into
  312. /usr/local/panda/bin. If you prefer, you can install Panda into
  313. another directory by doing something like this:
  314. ./configure --prefix=/my/install/directory
  315. make
  316. make install
  317. Now you should create your personal Config.pp file, as described
  318. above, and customize whatever variables are appropriate. By default,
  319. ppremake will look for this file in the root of the install directory,
  320. e.g. /usr/local/panda/Config.pp. If you want to put it somewhere
  321. else, for instance in your home directory, you must set the
  322. PPREMAKE_CONFIG environment variable to point to it:
  323. setenv PPREMAKE_CONFIG ~/Config.pp
  324. In bash:
  325. PPREMAKE_CONFIG=~/Config.pp
  326. export PPREMAKE_CONFIG
  327. You may find it a good idea to make this and other environment
  328. settings in your .cshrc or .bashrc file so that they will remain set
  329. for future sessions.
  330. Now you can test the configuration settings in your Config.pp file:
  331. cd ~/panda3d/dtool
  332. ppremake
  333. When you run ppremake within the dtool directory, it will generate a
  334. file, dtool_config.h (as well as all of the Makefiles). This file
  335. will be included by all of the Panda3D sources, and reveals the
  336. settings of many of the options you have configured. You should
  337. examine this file now to ensure that your settings have been made the
  338. way you expect.
  339. Note that ppremake will also try to create several subdirectories in
  340. the install directory, so you must have write access to the install
  341. directory in order for ppremake to run completely successfully. If
  342. you did not choose to give yourself write access to the install
  343. directory, you may run ppremake as root; in this case we recommend
  344. running ppremake first as a normal user in order to compile, and then
  345. running ppremake again as root just before running make install as
  346. root.
  347. Now that you have run ppremake, you can build the Panda3D sources.
  348. Begin with dtool (the current directory):
  349. make
  350. make install
  351. Once you have successfully built and installed dtool, you can then
  352. build and install panda:
  353. cd ~/panda3d/panda
  354. ppremake
  355. make
  356. make install
  357. After installing panda, you are almost ready to run the program
  358. "pview," which is a basic model viewer program that demonstrates some
  359. Panda functionality (see HOW TO RUN PANDA, below). Successfully
  360. running pview proves that Panda is installed and configured correctly
  361. (at least as a C++ library).
  362. If you wish, you may also build direct. You only need to build this
  363. if you intend to use the Python interfaces.
  364. cd ~/panda3d/direct
  365. ppremake
  366. make
  367. make install
  368. And you may build pandatool. You only need to build this if you want
  369. to take advantage of model conversion utilities for Panda like
  370. maya2egg and egg2bam, or if you want to use other tools like pstats.
  371. cd ~/panda3d/pandatool
  372. ppremake
  373. make
  374. make install
  375. HOW TO BUILD PANDA ON A WINDOWS SYSTEM, USING CYGWIN
  376. Cygwin is a set of third-party libraries and tools that present a very
  377. Unix-like environment for Windows systems. If you prefer to use a
  378. Unix environment, Cygwin is the way to go. You can download Cygwin
  379. for free from http://www.cygwin.com.
  380. Panda can build and run within a Cygwin environment, but it does not
  381. require it. Note that Cygwin is used strictly as a build environment;
  382. the Cygwin compiler is not used, so no dependency on Cygwin will be
  383. built into Panda. The Panda DLL's that you will generate within a
  384. Cygwin environment will be exactly the same as those you would
  385. generate in a non-Cygwin environment; once built, Panda will run
  386. correctly on any Win32 machine, with or without Cygwin installed.
  387. If you do not wish to install Cygwin for your build environment, see
  388. the instructions below.
  389. If you wish to use Cygwin, there is one important point to keep in
  390. mind. Panda internally uses a Unix-like filename convention; that is,
  391. forward slashes (instead of backslashes) separate directory
  392. components, and there is no leading drive letter on any filename.
  393. These Unix-like filenames are mapped to Windows filenames (with drive
  394. letters and backslashes) when system calls are made.
  395. Cygwin also uses a Unix-like filename convention, and uses a series of
  396. mount commands to control the mapping of Unix filenames to Windows
  397. filenames. Panda is not itself a Cygwin program, and does not read
  398. the Cygwin mount definitions.
  399. That's important enough it's worth repeating. Panda is not aware of
  400. the Cygwin mount points. So a Unix-like filename that makes sense to
  401. a Cygwin command may not be accessible by the same filename from
  402. within Panda.
  403. However, you can set things up so that most of the time, Cygwin and
  404. Panda agree, which is convenient. To do this, it is important to
  405. understand how Panda maps Unix-like filenames to Windows filenames.
  406. * Any relative pathname (that is, a pathname that does not begin
  407. with a leading slash) is left unchanged, except to reverse the
  408. slashes.
  409. * Any full pathname whose topmost directory component is *not* a
  410. single letter is prepended with the contents of the environment
  411. variable PANDA_ROOT.
  412. * Any full pathname whose topmost directory component *is* a single
  413. letter is turned into a drive letter and colon followed by the
  414. remainder of the path. For example, /c/windows/system is turned
  415. into C:\windows\system.
  416. The expectation is that most of the files you will want to access
  417. within Panda will all be within one directory structure, which you
  418. identify by setting the PANDA_ROOT variable. Generally, when you are
  419. using Cygwin, you will want to set this variable to be the same thing
  420. as the root of your Cygwin tree.
  421. For instance, typically Cygwin installs itself in C:\Cygwin. This
  422. means that when you reference the directory /usr/local/bin within
  423. Cygwin, you are actually referring to C:\Cygwin\usr\local\bin. You
  424. should therefore set PANDA_ROOT to C:\Cygwin, so that /usr/local/bin
  425. within Panda will also refer to C:\Cygwin\usr\local\bin.
  426. To sum up: to use Panda within a Cygwin environment,
  427. In tcsh:
  428. setenv PANDA_ROOT 'C:\Cygwin'
  429. or in bash:
  430. PANDA_ROOT='C:\Cygwin'
  431. export PANDA_ROOT
  432. (In fact, you do not actually have to set PANDA_ROOT if Cygwin is
  433. installed into C:\Cygwin, since this is Panda's default behavior if
  434. C:\Cygwin exists. But it's important to understand what Panda is
  435. doing to remap directories, and in particular that there is no
  436. relationship to any actual Cygwin mount points.)
  437. There is one additional point: you will need to ensure that the Visual
  438. Studio command-line utilities (like cl.exe) are available on your
  439. path. Set your path appropriately to point to them, if necessary (or
  440. run vcvars32.bat to do it for you; see the paragraph below.)
  441. Follow the instructions under HOW TO BUILD PANDA FOR A UNIX
  442. ENVIRONMENT, above.
  443. HOW TO BUILD PANDA ON A WINDOWS SYSTEM, WITHOUT CYGWIN
  444. You will have to make sure that you installed the command-line
  445. utilities on your system path when you installed Visual Studio, or you
  446. can run the batch file vcvars32.bat to put these utilities on your
  447. path for the current session (this batch file is in a directory like
  448. c:\Program Files\Microsoft Visual Studio .Net\Vc7\bin).
  449. Microsoft provides a command-line make utility with Visual Studio
  450. called nmake, although it's nowhere near as robust as the GNU make
  451. utility provided with Cygwin. But Panda can generate Makefiles that
  452. follow the nmake convention, and will do so by default if your
  453. ppremake was not built with the Cygwin tools.
  454. You will need a directory for holding the installed Panda. This can
  455. be anywhere you like; the default is C:\Panda3d. If you choose to
  456. specify otherwise you should modify the INSTALL_DIR line in
  457. ppremake\config_msvc.h before you build ppremake (below).
  458. (Alternatively, you can leave ppremake alone and simply redefine
  459. INSTALL_DIR in your Config.pp file, but then you will also need to
  460. define the environment variable PPREMAKE_CONFIG to point to your
  461. Config.pp.)
  462. md C:\Panda3d
  463. You will first need to build a copy of ppremake.exe. There is a
  464. Microsoft VC7 project file in the ppremake directory that will build
  465. this. Once it is built, copy it to the Panda bin directory (which you
  466. will have to make yourself). This will be a directory called "bin"
  467. below the root of the installed directory you created above; for
  468. instance, C:\Panda3d\bin.
  469. Make sure the Panda bin and lib directories are on your path, and set
  470. a few environment variables for building. We suggest creating a file
  471. called PandaEnv.bat to hold these commands; then you may invoke this
  472. batch file before every Panda session to set up your environment
  473. properly. Alternatively, you may make these definitions in the
  474. registry.
  475. path C:\Panda3d\bin;C:\Panda3d\lib;%PATH%
  476. set PANDA_ROOT=C:\
  477. Setting PANDA_ROOT is optional; it specifies the default drive Panda
  478. will search for file references. (Panda internally uses a Unix-like
  479. filename convention, which does not use leading drive letters. See
  480. the bullet points in the Cygwin section, above, describing the rules
  481. Panda uses to map its Unix-like filenames to Windows filenames.)
  482. Now make a directory for building Panda. This may be different from
  483. the directory, above, that holds the installed Panda files; or it may
  484. be the same. In this example we assume you will be building in the
  485. same directory, C:\Panda3d.
  486. Now set up your personal Config.pp file to control your local
  487. configuration settings, as described above. By default, ppremake will
  488. look for this file in the root of the install directory,
  489. e.g. C:\Panda3d\Config.pp; if you want to put it somewhere else you
  490. should define the environment variable PPREMAKE_CONFIG to the full
  491. path to your Config.pp.
  492. Use your favorite text editor to add the appropriate lines to your
  493. Config.pp to define the correct paths to the various third-party
  494. packages you have installed on your system. See HOW TO CONFIGURE
  495. PANDA FOR YOUR ENVIRONMENT, above.
  496. edit C:\Panda3d\Config.pp
  497. Now you can test the configuration settings in your Config.pp file:
  498. C:
  499. cd \Panda3d\dtool
  500. ppremake
  501. When you run ppremake within the dtool directory, it will generate a
  502. file, dtool_config.h (as well as all of the Makefiles). This file
  503. will be included by all of the Panda3D sources, and reveals the
  504. settings of many of the options you have configured. You should
  505. examine this file now to ensure that your settings have been made the
  506. way you expect.
  507. Now that you have run ppremake, you can build the Panda3D sources.
  508. Begin with dtool (the current directory):
  509. nmake
  510. nmake install
  511. Once you have successfully built and installed dtool, you can then
  512. build and install panda:
  513. cd \Panda3d\panda
  514. ppremake
  515. nmake
  516. nmake install
  517. After installing panda, you are almost ready to run the program
  518. "pview," which is a basic model viewer program that demonstrates some
  519. Panda functionality (see HOW TO RUN PANDA, below). Successfully
  520. running pview proves that Panda is now installed and configured
  521. correctly (at least as a C++ library).
  522. If you wish, you may also build direct. You only need to build this
  523. if you intend to use the Python interfaces.
  524. cd \Panda3d\direct
  525. ppremake
  526. nmake
  527. nmake install
  528. And you may build pandatool. You only need to build this if you want
  529. to take advantage of model conversion utilities for Panda like
  530. maya2egg and egg2bam, or if you want to use other tools like pstats.
  531. cd \Panda3d\pandatool
  532. ppremake
  533. nmake
  534. nmake install
  535. HOW TO RUN PANDA
  536. Once Panda has been successfully built and installed, you should be
  537. able to run pview to test that everything is working (you might need
  538. to type rehash first if you use csh):
  539. pview
  540. If you get an error about some shared library or libraries not being
  541. found, check that your LD_LIBRARY_PATH setting (on Unix) or your PATH
  542. (on Windows) includes the directory in which all of the Panda
  543. libraries have been installed. (This is normally $INSTALL_DIR/lib, or
  544. whatever you set INSTALL_DIR to followed by "lib". On Unix, this
  545. defaults to /usr/local/panda/lib. If you have redefined
  546. INSTALL_LIB_DIR in your Config.pp, for instance to define Panda as a
  547. native Python module, you should use that directory instead.)
  548. If all goes well, pview should open up a window with a blue triangle.
  549. You can use the mouse to move the triangle around. You can also pass
  550. on the command line the name of an egg or bam file, if you have one
  551. (look in the models directory for some sample egg files), and pview
  552. will load up and display the model.
  553. There are several files in the $INSTALL_DIR/etc directory with the
  554. filename extension .prc; these are Panda Runtime Configuration files.
  555. These are different from the Config.pp file, which controls the way
  556. Panda is compiled and is only used at build time. The prc files are
  557. read in every time Panda is started and control the way Panda behaves
  558. at runtime.
  559. The system-defined prc files begin with digits, so that they sort to
  560. the top of the list and are read first (and so that you may define one
  561. or more additional files that are read afterwards and that will
  562. therefore override the values specified in these system files). The
  563. digits also imply an ordering between the prc files. We recommend
  564. that you name your own prc file(s) beginning with letters, unless for
  565. some reason you need a file to be loaded before one of the
  566. system-defined prc files.
  567. We suggest creating a file in $INSTALL_DIR/etc called Config.prc, into
  568. which you will put your own custom configuration options. For
  569. instance, if you want to run using OpenGL instead of the Windows
  570. default of DirectX9, you can add the line:
  571. load-display pandagl
  572. to your Config.prc file. If you choose not to do this at this time,
  573. you can just leave this file empty for now; however, we do recommend
  574. creating at least an empty Config.prc file as a placeholder into which
  575. you can add your custom configuration options later.
  576. The complete list of available configuration options is very large and
  577. is not fully documented; but there are other documents that list
  578. several particularly useful config variables. These are sometimes
  579. referred to as "Configrc" variables because an older Panda convention
  580. named this file Configrc instead of Config.prc.
  581. If you want to load Config.prc from other than the compiled-in default
  582. directory of $INSTALL_DIR/etc, set the environment variable:
  583. PRC_DIR=/my/home/directory
  584. export PRC_DIR
  585. Where /my/home/directory is the name of your home directory (or
  586. wherever you put the Config.prc file). Note that if you redefine
  587. PRC_DIR, you will no longer automatically load the standard prc files
  588. that were installed into $INSTALL_DIR/etc (so you should consider
  589. copying these files into the same directory). It is possible to
  590. configure Panda to search for prc files in more than one directory,
  591. but that's a little more complicated and is outside the scope of this
  592. document.
  593. HOW TO BUILD THE PYTHON INTERFACES
  594. You may stop now if you only intend to use Panda as a C++ library.
  595. However, if you wish to use Panda from within Python, you must now
  596. generate the Python interfaces.
  597. There are two parts to the Python interface for Panda. The first part
  598. is a series of wrapper functions that are compiled into the Panda
  599. libraries themselves, along with associated *.in files that describe
  600. the class hierarchy. If you defined PYTHON_IPATH correctly in your
  601. Config.pp file, then Python should have been detected by ppremake, and
  602. it would have generated makefiles to build these wrappers
  603. automatically. (You would have seen the program "interrogate" running
  604. within each directory as panda was building, and you will have a
  605. number of *.in files now installed into $INSTALL_DIR/etc.)
  606. If, for some reason, the interrogate program did not run, perhaps
  607. because you defined an invalid directory in PYTHON_IPATH, you can go
  608. back and fix this now, and simply re-run ppremake and make install
  609. again in each of dtool, panda, and direct.
  610. To make Panda accessible to Python, you will need to add
  611. $INSTALL_DIR/lib to your PYTHONPATH variable, e.g.:
  612. setenv PYTHONPATH ${PYTHONPATH}:/usr/local/panda/lib
  613. Or, on Windows:
  614. set PYTHONPATH=%PYTHONPATH%;C:\Panda3d\lib
  615. We recommend the PYTHONPATH approach for most users, since it keeps
  616. all of the Panda files within one directory and doesn't clutter up the
  617. Python distribution. However, if you only intend to use Panda from
  618. Python, and especially if you want to make it accessible to multiple
  619. users, it may be more attractive to install the Panda libraries as a
  620. standard Python module, so that it is not necessary to modify your
  621. PYTHONPATH variable; see "Installing Panda as a standard Python
  622. module", below.
  623. The second part to the Python interface is a series of generated
  624. Python wrapper classes, for each C++ class detected by interrogate.
  625. These classes must be generated after all of the C++ code has been
  626. compiled and installed. Execute the following command (you might need
  627. to type rehash first if you use csh):
  628. genPyCode
  629. This is a script that was installed into $INSTALL_DIR/bin as part of
  630. the build of direct. It invokes Python to read the *.in files
  631. generated by interrogate, and generates the appropriate wrapper
  632. functions, which are then written into $INSTALL_DIR/lib/pandac.
  633. (There will be several hundred generated Python modules, which are
  634. normally "squeezed" into a single file called PandaModules.pyz using
  635. PythonWare's SqueezeTool. This squeeze step gives a significant
  636. load-time speedup, especially on Windows; but if it causes problems,
  637. you can use the option -n, e.g. 'genPyCode -n', to avoid it.)
  638. You will need to re-run this script only if the Panda interface
  639. changes, e.g. if a class is added or a method's parameters change.
  640. You should certainly re-run it any time you update and install a new
  641. version of Panda.
  642. Installing Panda as a native Python module
  643. Panda can be optionally configured to install its run-time interfaces
  644. into the Python installation directory, instead of into the normal
  645. $INSTALL_DIR/lib directory. This means you can run Panda from Python
  646. without having to set your PYTHONPATH variable, but it does clutter up
  647. your Python distribution a bit.
  648. To do this, simply add something like the following line to your
  649. Config.pp:
  650. #define INSTALL_LIB_DIR /usr/lib/python2.2/site-packages
  651. Where you give the actual path to the site-packages directory for your
  652. particular installation of Python. On Windows, this will probably
  653. look something like this:
  654. #define INSTALL_LIB_DIR C:\Python22\Lib\site-packages
  655. Then go back and re-run ppremake and make install in each of dtool,
  656. panda, and direct, and then re-run genPyCode, to install the Panda
  657. libraries and Python files directly into the Python site-packages
  658. directory.
  659. You may also need to set your LD_LIBRARY_PATH (on Unix) or PATH (on
  660. Windows) to reference this new directory instead of $INSTALL_DIR/lib,
  661. especially if you want to be able to run any of the Panda standalone
  662. programs occasionally, like pview or any of the model converters.
  663. Unix users should note that you must have write permission to the
  664. site-packages directory in order to install files there. You may
  665. choose to run these install steps (ppremake, make install, genPyCode)
  666. as root to avoid this problem. If you encounter difficulty running
  667. genPyCode as root, make sure that you still have LD_LIBRARY_PATH
  668. defined appropriately once you have become root.
  669. Testing the Python interface
  670. Assuming that you have already set up your Config.prc file and tested
  671. that pview works, as described above in HOW TO RUN PANDA, you should
  672. now be ready to try to run Panda from within Python. Start up a
  673. Python shell and type the following command:
  674. Python 2.2.2 (#37, Feb 10 2003, 18:00:06) [MSC 32 bit (Intel)] on win32
  675. Type "help", "copyright", "credits" or "license" for more information.
  676. >>> import direct.directbase.DirectStart
  677. You should see a graphics window come up, very similar to the one you
  678. saw when you ran pview. To load a particular model file into the
  679. scene, try something like this:
  680. >>> m = loader.loadModel('/c/Panda3d/models/smiley.egg')
  681. >>> m.reparentTo(render)
  682. >>> run()
  683. Note that Panda expects a forward-slash convention for pathnames, with
  684. no leading drive letter, even on a Windows system. See the full
  685. description of how Panda maps these pathnames to Windows pathnames in
  686. HOW TO BUILD PANDA ON A WINDOWS SYSTEM, USING CYGWIN, above.
  687. You can now move the scene around with the mouse, just as in pview
  688. (you may need to pull the camera back by dragging upwards while
  689. holding down the right mouse button in order to see the model).
  690. Congratulations! Panda 3D is now successfully installed. See the
  691. online documentation available at http://www.etc.cmu.edu/panda3d/ for
  692. more help about where to go next.