Building TurboVNC for Windows
=============================


Build Environment
-----------------

-- CMake (http://www.cmake.org) v2.6 or later

-- Microsoft Visual C++ 2005 or later

   If you don't already have Visual C++, then the easiest way to get it is by
   installing the Windows SDK:

   http://msdn.microsoft.com/en-us/windows/bb980924.aspx

   The Windows SDK includes both 32-bit and 64-bit Visual C++ compilers and
   everything necessary to build TurboVNC.

   * For 32-bit builds, you can also use Microsoft Visual C++ Express
     Edition.  Visual C++ Express Edition is a free download.
   * If you intend to build TurboVNC from the command line, then add the
     appropriate compiler and SDK directories to the INCLUDE, LIB, and PATH
     environment variables.  This is generally accomplished by executing
     vcvars32.bat or vcvars64.bat and SetEnv.cmd.  vcvars32.bat and
     vcvars64.bat are part of Visual C++ and are located in the same directory
     as the compiler.  SetEnv.cmd is part of the Windows SDK.  You can pass
     optional arguments to SetEnv.cmd to specify a 32-bit or 64-bit build
     environment.

-- Inno Setup (needed to build the TurboVNC installer)
   Inno Setup can be downloaded from http://www.jrsoftware.org/isinfo.php.
   You also need the Inno Setup Preprocessor, which is available in the
   Inno Setup QuickStart Pack.

   Add the directory containing iscc.exe (for instance, 
   C:\Program Files\Inno Setup 5) to the system or user PATH environment
   variable prior to building TurboVNC.

-- libjpeg-turbo SDK for Visual C++

   * The libjpeg-turbo SDK Windows installer (EXE) can be obtained from the
     "Files" area of:

     http://sourceforge.net/projects/libjpeg-turbo

   * The VirtualGL build system will search for the TurboJPEG header and
     library under c:\libjpeg-turbo64 (64-bit) or c:\libjpeg-turbo (32-bit),
     but you can override this by setting the TJPEG_INCLUDE_DIR CMake variable
     to the directory containing turbojpeg.h and the TJPEG_LIBRARY CMake
     variable to the full path of the TurboJPEG library against which you
     want to link.


Out-of-Tree Builds
------------------

Binary objects, libraries, and executables are generated in the same directory
from which CMake was executed (the "binary directory"), and this directory need
not necessarily be the same as the TurboVNC source directory.  You can create
multiple independent binary directories, in which different versions of
TurboVNC can be built from the same source tree using different compilers or
settings.  In the sections below, {build_directory} refers to the binary
directory, whereas {source_directory} refers to the TurboVNC source directory
(vnc\vnc_winsrc.)  For in-tree builds, these directories are the same.


Building TurboVNC from the Command Line
---------------------------------------

  cd {build_directory}
  cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release [additional CMake flags] {source_directory}
  nmake

This will build either a 32-bit or a 64-bit version of TurboVNC, depending on
which version of cl.exe is in the PATH.


Building TurboVNC Using the Visual Studio IDE
---------------------------------------------

Choose the appropriate CMake generator option for your version of Visual Studio
(run "cmake" with no arguments for a list of available generators.)  For
instance:

  cd {build_directory}
  cmake -G "Visual Studio 9 2008" [additional CMake flags] {source_directory}

You can then open ALL_BUILD.vcproj in Visual Studio and build one of the
configurations in that project ("Debug", "Release", etc.) to generate a full
build of TurboVNC.


Debug Build
-----------

Add "-DCMAKE_BUILD_TYPE=Debug" to the CMake command line.  Or, if building with
NMake, remove "-DCMAKE_BUILD_TYPE=Release" (Debug builds are the default with
NMake.)


Packaging TurboVNC
------------------

If using NMake:

  cd {build_directory}
  nmake installer

If using the Visual Studio IDE, build the "installer" project.

The installer package (TurboVNC[64]-{version}.exe) will be located under
{build_directory}.  If building using the Visual Studio IDE, then the installer
package will be located in a subdirectory with the same name as the
configuration you built (such as {build_directory}\Debug\ or
{build_directory}\Release\).
