How to compile OpenObex on Windows platform
===========================================

You should read INSTALL.txt before continuing reading this file.

1 Requirements
==============

The requirements to compile OpenObex on Windows are fairly low:
1. a compiler
2. the Platform SDK (now also called Windows SDK)
3. LibUSB-Win32[1]
4. CMake(>= 2.8.5)[2]

The supported compilers are:
 * Microsoft Visual Studio 2010 (10)
 * Microsoft Visual Studio 2008 (9)
 * Microsoft Visual Studio 2005 (8)
 * Microsoft Visual Studio .NET 2003 (7.1)
 * MinGW gcc
 * Cygwin gcc

Visual Studio 2008 and 2010 already include the SDK.

[1]: at http://libusb-win32.sf.net (if not compiling for cygwin)
[2]: at http://www.cmake.org


2 Compilation
=============

Visual Studio
-------------

Using Visual Studio >= 2008 (Express versions are sufficient) is the
recommended way of compiling under Windows. You must open the console link that
runs the proper vcvars.bat (see Start menu).
Then, you _MUST_ add the directories of the platform SDK include files,
libraries and executables to the environment variables INCLUDE, LIB and PATH.
Now, your build environment is set up. You can now call cmake with the proper
generator (see "cmake --help"). Using the "NMake Makefiles" generator, OpenObex
can be compiled directly in the command prompt window:
  > mkdir build
  > cd build
  > cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ..
  > nmake


MinGW
-----

Install MinGW, including core and mingw32-make, to e.g. C:\mingw.
To get Bluetooth and Irda support, you must copy the following files from the
Platform SDK include directory to usr/local/include in the MinGW installation
directory:
  ws2bth.h
  bthdef.h
  bthsdpdef.h
  af_irda.h

Either you add MinGW bin directory to PATH, or you call the mingw32-make with
full path, both variations work.
Then, at the command prompt:
  > set PATH=%PATH%;C:\mingw\bin
  > mkdir build
  > cd build
  > cmake -G"MinGW Makefiles" ..
  > mingw32-make

You can also use MSYS as environment:
  > mkdir build
  > cd build
  > cmake -G"MSYS Makefiles" ..
  > make


Cygwin
------

You must not use the Windows version of CMake but a version compiled specially
for cygwin. You may also install cygwin version of libusb. Copy the same files
as for the MinGW case to /usr/local/include. Then cou can run in the cygwin
shell command window:
  $ mkdir build
  $ cd build
  $ cmake -G"Unix Makefiles" ..
  $ make



3 Installation
==============

You can run the installation directly by calling the "install" make target.
With the DESTDIR variable, you can add an additional prefix:
  $ make install DESTDIR=/some/directory

Additionally, when you used CMake, you can create installation packages but a
few steps are needed:
  * install NSIS
  * install a ZIP program (e.g. info-zip)
Now you are ready to run the "package" make target.
