WindowsBuildV2
From PyWiki
Contents |
[edit] Introduction
Building Python-Ogre is a straight forward, if slightly lengthy process consisting of a few basic steps - and (as always) there is more than one way to build Python-Ogre. One involves building each component 'by hand' and is shown below. The second technique is potentially more automated and uses the same build system that we use for Linux - this can be found here
- Download the base source files
- Apply patches as appropriate
- Build the various libraries (OGRE, OIS, etc)
- Create the Python-Ogre wrapper code
- Compile the Python-Ogre modules
NOTE: There are other articles available that might provide aditional information:
[edit] Before you begin
You'll need:
- Python 2.5.x
- Visual Studio - either the full version or the free Express version of C++
- Visual C++ Express Service Pack 1 - (yo'll need this if you're using MSVC++ express 2005). Be sure to download the correct file
- Platform SDK - if you've installed VC++ Express edition, you'll need to install Platform SDK as well
- DirectX SDK - used to build OIS and ogre D3D renderer
- cmake required to build gccxml
- boost source - 1.37 at time of writing
- bjam - boost build tool
- gccxml - CVS version!
- pygccxml - Python wrapper for reading gccxml output
- Py++ - the wrapper backend. requires pygccxml and gccxml
- scons - a build tool used to compile the wrappers
You could probably use other compilers such as MinGW/GCC, but they have not been tested. If you manage to build Python-Ogre with GCC on Windows, be sure to update the Wiki with instructions.
[edit] Visual Studio
Python-Ogre can be compiled with Visual Studio 8.0 (2005) and 9.0 (2008) (7.1 will probably work as well). If you choose VS 8.0, be sure to install ServicePack 1 for it as it is not included in the actual program distribution. Also, if you use Visual C++ Express installation you'll have to install the Platform SDK (windows libs/include files). The full version of Visual Studio should contain a distribution of Platform SDK.
When you install everything you'll need to set up various lib/include directories for DirectX, Platform SDK etc.
Note that vcvars32.bat should be run each time you open a DOS command prompt to ensure you have the paths and environment variables set correctly -- you can see an example of this in the scripts directory of the Python-Ogre source once you download it..
[edit] Setting up bjam
Bjam is boost's build tool. We use it to build boost.python. Extract the exe and put it somewhere (eg. C:/dev/bjam/bjam.exe)
You can put the location of bjam in your system PATH variable to make it more accessible from the command line. To do that, you'll have to right-click on My computer->Properties->Advanced->Environment Variables->System Variables->PATH. Edit it, and add ";<location to bjam's folder>" to the end of the string. Now you can just type bjam instead of c:/dev/bjam/bjam.exe in the command line.
[edit] Building Boost
Prior versions of PythonOgre required that Boost be patched, this is no longer required and all you nede to do is build the boost-python library/dll.
ie. cd to boost/libs/python/build and run
bjam --toolset=msvc-8.0 --with=python release
[edit] Possible errors
'cl' is not recognized as an internal or external command, operable program or batch file.
add C:\Program Files\Microsoft Visual Studio 8\VC\bin to System PATH
If you've successfully build boost, you'll find the binaries in <boost-dir>/bin.v2/libs/python/build/msvc-9.0/release
[edit] GCCXML
[edit] cmake
cmake is used to build gccxml, so go there and download the Windows binary and install it.
[edit] gccxml
gccxml is needed for Py++ to parse C++ library code and create our Python wrapper code.
To obtain the source code follow the instructions on their web site.
- To compile gccxml, run the CMake setup tool, and the cmake-gui tool to generate the visual studio project files.
- Once generated, open gccxml.sln and let visual studio compile everything (Build Solution)
- Be sure to have the proper Platform SDK lib/include paths set!
- if successful, gccxml binaries should be in <your-bin-folder>/bin/release
NOTE: I've had problems when compiling to another directory, gccxml reported it couldnt find the gccxml executable and similar nonsense. if you set both the source and build directories to the same in cmake, gccxml should work.
[edit] Py++
extract pygccxml and py++ archives and run python setup.py install in both directories to install them.
[edit] Python-Ogre
[edit] Getting the latest Source
To get the latest Python-Ogre source, do an SVN Checkout of
https://python-ogre.svn.sourceforge.net/svnroot/python-ogre/branches/v1-6
If you want a more bleeding edge experience you can use the trunk:
https://python-ogre.svn.sourceforge.net/svnroot/python-ogre/trunk/python-ogre
We recommend using TortoiseSVN on Windows
[edit] Scons
In order to compile the wrappers, you'll need to install scons. you'll need to have <Python dir>/Scripts in your system path in order to use it properly.
[edit] Config
open PythonOgreConfig_nt.py and adjust paths to reflect your build directories. Variables you might want to change:
- PATH_Boost - full path to where your boost is (eg. 'po-depend/boost_1_34_1'
- gccxml_bin - Path to gccxml.exe (exe included!)
- pyplusplus_install_dir
- PATH_LIB_Boost
- LIB_Boost
[edit] Building
The easiest way to get a module wrapped is to use BuildModule.py
Usage:
python python-ogre\BuildModule.py -r <module_name> - Retrieve's a module from the internet python python-ogre\BuildModule.py -b <module_name> - Unzip's and patches source if necessary python python-ogre\BuildModule.py -g <module_name> - Generates Code for boost.python python python-ogre\BuildModule.py -c <module_name> - Compiles module
NOTE: if BuildModule fails, it stores it's log file in <python-ogre-root>/log.out
- a More detailed tutorial on compiling Python-Ogre wrappers is available here
