From The Player Project

Revision as of 05:19, 26 November 2010 by Rtv (Talk | contribs)
Jump to: navigation, search

Compiling Player for Windows has been tested with the following compilers and operating systems:

  • Visual Studio 2005 on Windows Vista x64
  • Visual Studio 2008 on Windows XP x64.

Currently, these instructions focus on using Visual Studio.



Things you will need:

  • CMake. Download the latest Win32 installer and run it.
  • pthreads for Win32. Download the latest version of the DLLs, lib files and include files. Place these somewhere handy (e.g. c:\pthreads\lib and c:\pthreads\include). Add the lib directory to your system's PATH environment variable. You can do this through the System Properties control panel, Advanced tab, "Environment variables..." button. Separate multiple paths with a semi-colon.
  • Python is also necessary, to compile the interfaces.

Things you may want:

  • pykg-config (not vital, but needed for many drivers).
  • Install the NULL-Device on Windows XP (for Windows XP Embedded only).


Summary of steps

  1. Download the source
  2. Configure Player using CMake
  3. Poke it until it finds pthreads
  4. Compile Player using your compiler

Detailed instructions

1. Check out the source from the subversion repository. Tortoise SVN is probably the best subversion client available for Windows. See the Player FAQ for details on how to get the latest source code. Where you put the source doesn't matter much. Create a subdirectory of the root source directory called build.

2. Run the CMake graphical configuration tool (it should be in the Start Menu - don't use the deprecated one). Point it at the source directory for the source code, and the build/ subdirectory for the binaries. Click Configure.

3. Set the pkg-config executable if CMake couldn't find it automatically. If you are using pykg-config (recommended for Windows), you should point this value at the pkg-config.bat file installed with pykg-config. This may be in, for example, C:\Python26\Scripts\pkg-config.bat.

3. Set the pthreads location in PTHREAD_DIR, and click Configure over and over, until Generate can be clicked (or an error occurs). Then click Generate.

4. In the build/ directory will be a file called Player.sln. This is the solution file for Player. Open it using Visual C++. To compile, all you have to do is build the ALL_BUILD project. Don't just tell Visual C++ to build the startup project, as CMake seems to assign this randomly and you may end up running the uninstall script or something equally annoying. If the build scripts have changed, building any project in Visual C++ will automatically re-run CMake.

Installing Player

Summary of steps

  1. Install Player
  2. Set up environment variables.

Detailed instructions

1. To install Player using Visual Studio, build the INSTALL project. This will recompile anything that is out of date (including re-running CMake if the build scripts have changed). Player will be installed in the directory specified in the CMAKE_INSTALL_PREFIX variable during configuration. The layout under this directory will be similar to that seen on a Unix-like system.

2. Before you can execute Player, you must set up your environment variables correctly. Open the control panel and go to the system settings, or alternatively, right click on "My Computer" and select "Properties" (on Vista, you will need to click "Advanced System Settings" on the left after this). Switch to the "Advanced" tab and click "Environment Variables...". Edit the PATH variable and append to it the Player binary and library directories. Separate multiple paths with a semi-colon. For example, using the default install path, you would append

C:\Program Files (x86)\Player\bin;C:\Program Files (x86)\Player\lib

Any open command prompts will need to be re-opened to get the updated value. You will need to log out of Windows and log back in to update it everywhere else.

If this process has been successful, you should be able to open a command prompt (Start Menu->Run...->cmd) and type "player" to start the server. Obviously, to do anything useful you should provide a configuration file as a command line option. Any other command line options are not currently supported.


Player works well with the pykg-config replacement for pkg-config. You may, however, encounter problems with packages that do not have .pc files correctly set up for Windows. Be sure to read the pykg-config README.txt and adjust your pkg-config files accordingly. The main things to watch out for are the path separator used and paths with spaces in them.

Building clients

The CMake modules installed with Player do a good job of simplifying building clients and plugins on Windows. These files are installed in <pre>C:\Program Files\Player\share\cmake\Modules</pre> by default. See the compiling clients tutorial for more details.

Alternatively, use the build system of your choice, or just create a project manually in Visual Studio and add the include directory as appropriate.



The Player server can be debugged using Visual Studio's debugger and the CMake-generated solution. First, you need to set some paths in Visual Studio so it can find the various DLL files to launch the server. For Visual Studio 2005 and 2008, you need to open the Options panel from the Tools menu. Open the "Projects and Solutions" branch, and choose "VC++ Directories". You need to add the DLL locations under both "Binary files" and "Library files". To avoid needing to run the INSTALL step every time you change something while debugging, add the DLL locations in the build/ directory. There are four necessary locations: build/libplayercore/debug, build/libplayertcp/debug, build/libplayerxdr/debug and build/server/libplayerdrivers/debug. Add all four to both "Binary files" and "Library files". Debugging will then function as normal in Visual Studio.


For debugging clients, you only need to add the location of the installed libraries (for example, C:\Program Files (x86)\Player\lib). If you have set the directories for debugging the server, this is not necessary, but you will need to add the directory build/client_libs/libplayerc/debug. Don't forget to set the build type to Debug if using CMake.

Personal tools