- Panda3d 1.7 Game Developer's Cookbook
- Christoph Lang
- 656字
- 2021-04-09 21:21:44
Building Panda3D from source code
When developing a game with Panda3D you may want to—and most likely will need to—compile the engine from source code. This recipe will show how to do this and show which options there are for configuring how your custom build of Panda3D is created.
Getting ready
The following instructions rely on the target system having installed Microsoft Visual Studio 2008 or Microsoft Visual C++ Express 2008. To build the DirectX 8 and 9 renderers, you also need the DirectX SDK, which can be downloaded from msdn.microsoft.com/en-us/directx/aa937788.aspx. If you have the Professional Edition of Visual Studio, you're set and ready to go.
For making the recipe work with the Express Edition you will need to download and install the Windows Server 2003 R2 Platform SDK, as recommended in the documentation of Panda3D. It can be obtained from the following URL: www.microsoft.com/downloads/details.aspx?familyid=0BAF2B35-C656-4969-ACE8-E4C0C0716ADB
How to do it...
Work through these tasks to build Panda3D from source code:
- Go to www.panda3d.org/download.php?platform=windows&version=1.7.0&sdk, download the Panda3D Complete Source Code package and unzip the archive at a location of your choice.
- Open the file
makepanda\makepanda.bat
in a text editor and change the lineif
%PROCESSOR_ARCHITECTURE%
==
AMD64
goto
:AMD64
toREM
if
%PROCESSOR_ARCHITECTURE%
==
AMD64
goto
:AMD64
. - Open a Visual Studio 2008 Command Prompt by clicking Microsoft Visual Studio 2008 | Visual Studio Tools | Visual Studio Command Prompt in the Start menu. If you have Visual C++ Express 2008, you can find it under Microsoft Visual C++ Express 2008 | Visual Studio Tools | Visual Studio Command Prompt.
- Change to the directory you unpacked the source code to. If you enter the
dir
command and see the following directory listing (or a similar looking one) you are in the right directory: - Type
makepanda\makepanda.bat
--everything
.
How it works...
Panda3D uses its own custom build system to produce builds from source code. In step 2, we need to modify the build system's start script to prevent it from throwing an error if the build system is using a 64-bit processor. Building 64-bit executables does not work with version 1.7.0 of Panda3D and isn't officially supported, so we force the build system to compile 32-bit executables and libraries.
In the following steps we open a Visual Studio 2008 Command Prompt, which guarantees that all required search paths are set properly and kick off a complete build of Panda3D. Please note that such a build, depending on the power of your machine, takes about one hour to complete!
Once the build is complete, the freshly compiled version of Panda3D can be found in the built
subdirectory.
There's more...
Panda3D's build system allows us to configure the build using a number of command line flags. The --everything option we already used before will instruct the makepanda
script to build Panda3D and all third party libraries.
The exact counterpart of the --everything option is --nothing, which will disable all third party libraries to be built.
Of course there isn't just on and off. The makepanda build script allows us to set which libraries we do and do not want to include in our build. This can be done by setting the various --use-xxx and --no-xxx flags, where xxx stands for a library to be included or left out of the resulting executable. For a full list, just issue the command makepanda\makepanda.bat
from the top level of the unpacked source package.
The --optimize option allows to set the optimization level used when compiling Panda3D on a range from 1 to 4, where 1 creates a debug build and 4 enables the most aggressive optimizations, including link time code generation. If not set, this value defaults to 3, which provides a safe default while generating a very well performing build.
Lastly, we can use the --installer flag to generate an installer, which for example makes it easier to redistribute the custom build of the engine to other developers on a team.
- 人臉識別算法與案例分析
- 新編三維CAD習題集
- 照相館的故事:Photoshop CC 2018調色合成精修
- AI繪畫:Stable Diffusion從入門到精通
- Photoshop CC從入門到精通(全彩超值版)
- 3ds Max 2015中文版從入門到精通
- 中文版3ds Max 2021完全自學教程
- Microsoft Silverlight 5: Building Rich Enterprise Dashboards
- Vue 企業開發實戰
- Plone 3 Intranets
- CAXA 實體設計2013案例課堂
- 金融精英PPT實操手冊:世界知名公司這樣展示研究報告
- 24小時學會Word-Excel-PowerPoint 2010三合一
- 中文版Premiere Pro CS6視頻編輯(慕課版)
- PHPList 2 E/mail Campaign Manager