1. pygame
  2. Untitled project
  3. pygame


pygame / doc / BuildVC.txt

Building Pygame2 using Microsoft Visual C++
In contrast to the MinGW build, the Microsoft Visual C++ build will require a
bit more ground work before you actually can start to make your own pygame2

Setting up Visual C++ and the environment
First of all, you have to make sure, that you have at least a Microsoft
Visual C++ compiler that matches your current Python version. For Python
<= 2.5 this usually will be the Visual C++ 7.x compiler, shipped with
e.g. the VC Toolkit 2003 or Visual Studio.NET 2003.
For later Python releases, Visual Studio.NET 2008 or Visual C++ 2008 Express
are required. 

.. note::

    If you are going to use the VC Toolkit 2003, make sure, you have some
    proper registry keys set. Otherwise Python's distutils will not be able to
    detect the settings. Within the util/ directory you can find an example
    registry key. Change the paths within it according to your system
    configuration and import it into your registry to allow C Python modules
    to be built with the VC Toolkit 2003.

Setting up the dependencies

.. note::

    The following list of dependencies might not be the most actual
    one. Please check the README.txt file in the top source directory
    for the most actual dependency list!

Make sure, you have at least one of the following Python versions

* Python 2.4, 2.5, 2.6, 3.1 (http://www.python.org)

To build anything, you will have to download the following additional

* SDL >= 1.2.10              (http://www.libsdl.org)
* SDL_mixer >= 1.2.11        (http://www.libsdl.org/projects/SDL_mixer/)
* SDL_ttf >= 2.0.9           (http://www.libsdl.org/projects/SDL_ttf/)
* SDL_image >= 1.2.10        (http://www.libsdl.org/projects/SDL_image/)
* SDL_gfx >= 2.0.18          (http://www.ferzkopp.net/Software/SDL_gfx-2.0/)
* libpng >= 1.2.24           (http://www.libpng.org)
* libjpeg >= 6b              (http://www.ijg.org/)
* freetype >= 2.3.5          (http://www.freetype.org)
* portmidi >= 199            (http://portmedia.sourceforge.net/)
* OpenAL                     use one of:
  * OpenAL11CoreSDK (Aug 2009) http://www.openal.org 
  * openal-soft >= 1.11.753    http://kcat.strangesoft.net/openal.html

The Win32 build chain for Pygame2 does not support building all
dependencies from scratch. Instead it relies on already built libraries,
correctly configured settings and matching includes. Thus you will
either need to build them yourself or to rely on the offered prebuilt

Once you downloaded and/or built all the dependencies, you have to make
sure that they can be found by Pygame2's build script. The script will
search the directory where it resides, the parent directory of it and a
directory named 'prebuilt' for the libraries and headers. If you
installed the dependencies to different locations, you should change the
_searchdirs entry within the config/config_win.py script to include the

.. note::

    At this point, we strongly recommend a directory named 'prebuilt'
    that is created under the Pygame2 source directory.

.. note::

    The 'prebuilt' directory should have the following layout:

    prebuilt\\include    -> Contains all header files and header subdirectories
    as installed by the dependencies.

    prebuilt\\lib        -> Contains all library files (both, .dll and .lib)
    as installed by the dependencies.

Building Pygame2
If anything you can proceed to build and install Pygame2 itself. Simply
type: ::

    python setup.py build install

This will build and install Pygame2 in one step.

You also can use the small build.bat batch script, which optionally can
set up the VC++ include and library paths for the VC Toolkit 2003. Change it to
your needs and then execute it using ::


This will build and install Pygame2 as above.