**************************************************************************
Compiler: 
    Microsoft Visual C++ 2015
**************************************************************************

Typical layour for the build directory:

ovito/
  32bit/                (Build directory for 32-bit dependencies)
     ovito_release/     (Build directory for 32-bit OVITO version)
  64bit/                (Build directory for 64-bit dependencies)
     ovito_release/     (Build directory for 64-bit OVITO version)
  source/               (OVITO's source code)

Source code of third-party libraries is extracted into subdirectories of 'ovito/'.

**************************************************************************
zlib (http://www.zlib.net/)
**************************************************************************
mkdir zlib_build
cd zlib_build
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=../zlib_install -DCMAKE_BUILD_TYPE=Release ..\..\zlib-1.2.8
nmake install

**************************************************************************
Qt
**************************************************************************
Install the following components (Qt 5.7) in C:\Qt\ : 
   msvc2015 32-bit
   msvc2015 64-bit

**************************************************************************
Python 3.x
**************************************************************************
Select installation component "pip", deselect all other components.
cd Scripts
easy_install sphinx

----- Install NumPy from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy ---

----- Install SIP ----
..\XXbit\Python\python.exe configure.py
nmake
nmake install

----- Install PyQt5 ----
..\64bit\python\python.exe configure.py ^
   --concatenate ^
   --concatenate-split 10 ^
   --confirm-license ^
   --no-designer-plugin ^
   --no-qml-plugin ^
   --sip=..\64bit\python\sip.exe ^
   --enable QtCore ^
   --enable QtGui ^
   --enable QtWidgets
nmake
nmake install

---- Install matplotlib ----
..\XXbit\python\python.exe -m pip install -U pip setuptools
..\XXbit\python\python.exe -m pip install matplotlib

**************************************************************************
Boost libraries (release 1.62):
**************************************************************************
No installation needed, simply extract archive.

**************************************************************************
HDF5
**************************************************************************
mkdir hdf5_build
cd hdf5_build
cmake -G "NMake Makefiles" ^
   -DCMAKE_BUILD_TYPE=Release ^
   -DCMAKE_INSTALL_PREFIX=../hdf5_install ^
   -DBUILD_SHARED_LIBS=ON ^
   -DHDF5_ENABLE_Z_LIB_SUPPORT=ON ^
   -DHDF5_BUILD_HL_LIB=ON ^
   -DBUILD_TESTING=OFF ^
   -DHDF5_BUILD_EXAMPLES=OFF ^
   -DZLIB_INCLUDE_DIR=%cd:\=/%/../zlib_install/include ^
   -DZLIB_LIBRARY=%cd:\=/%/../zlib_install/lib/zlib.lib ^
   ../../hdf5-1.8.18

nmake install

**************************************************************************
NetCDF
**************************************************************************
mkdir netcdf_build
cd netcdf_build
set HDF5_DIR=%cd:\=/%/../hdf5_install/cmake
cmake -G "NMake Makefiles" ^
   -DCMAKE_BUILD_TYPE=Release ^
   -DCMAKE_INSTALL_PREFIX=../netcdf_install ^
   -DENABLE_DAP=OFF ^
   -DENABLE_EXAMPLES=OFF ^
   -DENABLE_TESTS=OFF ^
   -DBUILD_TESTING=OFF ^
   -DBUILD_UTILITIES=OFF ^
   -DENABLE_HDF4=OFF ^
   -DUSE_HDF5=ON ^
   -DHDF5_INCLUDE_DIR=%cd:\=/%/../hdf5_install/include ^
   -DHDF5_LIB=%cd:\=/%/../hdf5_install/lib/hdf5.lib ^
   -DHDF5_HL_LIB=%cd:\=/%/../hdf5_install/lib/hdf5_hl.lib ^
   -DZLIB_INCLUDE_DIR=%cd:\=/%/../zlib_install/include ^
   -DZLIB_LIBRARY=%cd:\=/%/../zlib_install/lib/zlib.lib ^
   ../../netcdf-4.4.1
nmake install
   
**************************************************************************
QScintilla2
**************************************************************************
mkdir qscintilla
cd qscintilla
qmake ..\..\QScintilla_gpl-2.9.3\Qt4Qt5\qscintilla.pro
nmake

**************************************************************************
libav
**************************************************************************
- Install MSYS2
- Execute msys2_shell.bat console from MSVC command prompt.
- Install YASM (MSYS2: "pacman -S yasm")
- Install make (MSYS2: "pacman -S make")
git clone git://git.libav.org/libav.git libav
cd 64bit
mkdir libav
cd libav
export LIB="$LIB;C:/Users/stuko/ovito/64bit/zlib_install/lib"
export INCLUDE="$INCLUDE;C:/Users/stuko/ovito/64bit/zlib_install/include"
../../libav/configure \
   --toolchain=msvc \
   --disable-programs \
   --enable-gpl \
   --disable-static \
   --enable-shared \
   --prefix=../libav_install \
   --extra-cflags=-I$PWD/../zlib_install/include  \
   --extra-ldflags=-L$PWD/../zlib_install/lib \
   --enable-zlib \
   --disable-doc \
   --disable-network \
   --disable-filters \
   --disable-decoders \
   --disable-debug
make install

**************************************************************************
OpenVR
**************************************************************************
git clone https://github.com/ValveSoftware/openvr.git

**************************************************************************
Create an app package signing certificate:
**************************************************************************
MakeCert /n "CN=ovito.org, O=ovito.org, L=Darmstadt, C=Germany" /r /h 0 /eku "1.3.6.1.5.5.7.3.3,1.3.6.1.4.1.311.10.3.13" /e 12/31/2017 /sv ovito.pvk ovito.cer
Pvk2Pfx /pvk ovito.pvk  /spc ovito.cer /pfx ovito.pfx
# Run as administrator: 
Certutil -addStore TrustedPeople ovito.cer

**************************************************************************
OVITO:
**************************************************************************
mkdir ovito_release
cd ovito_release
cmake -G "NMake Makefiles" ^
   -DCMAKE_BUILD_TYPE=Release ^
   -DCMAKE_INSTALL_PREFIX=../ovito_release_install ^
   -DOVITO_REDISTRIBUTABLE_PACKAGE=ON ^
   -DZLIB_INCLUDE_DIR=%cd:\=/%/../zlib_install/include ^
   -DZLIB_LIBRARY=%cd:\=/%/../zlib_install/lib/zlib.lib ^
   -Dnetcdf_DIR=%cd:\=/%/../netcdf_install/lib/cmake/netCDF ^
   -DHDF5_DIR=%cd:\=/%/../hdf5_install/cmake ^
   -DBOOST_INCLUDEDIR=%cd:\=/%/../../boost_1_62_0 ^
   -DQSCINTILLA_INCLUDE_DIR=%cd:\=/%/../../QScintilla_gpl-2.9.3\Qt4Qt5 ^
   -DQSCINTILLA_LIBRARY=%cd:\=/%/../qscintilla/release/qscintilla2.lib ^
   -DPYTHON_LIBRARY=%cd:\=/%/../Python/libs/python34.lib ^
   -DPYTHON_INCLUDE_DIR=%cd:\=/%/../Python/include ^
   -DPYTHON_EXECUTABLE=%cd:\=/%/../Python/bin/python.exe ^
   -DXSLT_PROCESSOR=../../libxslt-1.1.26.win32/bin/xsltproc.exe ^
   -DSPHINX_PROCESSOR_PATH=%cd:\=/%/../Python/Scripts ^
   -DLIBAV_INCLUDE_DIR=%cd:\=/%/../libav_install/include ^
   -DLIBAV_LIBRARY_DIR=%cd:\=/%/../libav_install/bin ^
   -DOVITO_BUILD_DOCUMENTATION=ON ^
   -DOVITO_BUILD_PLUGIN_VR=OFF ^
   -DOPENVR_INCLUDE_DIR=%cd:\=/%/../openvr/headers ^
   -DOPENVR_LIBRARY=%cd:\=/%/../openvr/lib/win64/openvr_api.lib ^
   -DFFTW3_INCLUDE_DIR=%cd:\=/%/../fftw ^
   -DFFTW3_LIBRARY=%cd:\=/%/../fftw/libfftw3f-3.lib ^
   ../../source
   
nmake install

---- Copy missing DLLs into installation dir of 32-bit version ----

C:\Program Files (x86)\CMake 2.8\bin\libeay32.dll
C:\Program Files (x86)\CMake 2.8\bin\ssleay32.dll

**************************************************************************
Debug version:
**************************************************************************
mkdir ovito_debug
cd ovito_debug
cmake -G "NMake Makefiles" ^
   -DCMAKE_BUILD_TYPE=Debug ^
   -DCMAKE_INSTALL_PREFIX=../ovito_debug_install ^
   -DOVITO_REDISTRIBUTABLE_PACKAGE=ON ^
   -DZLIB_INCLUDE_DIR=%cd:\=/%/../zlib_install/include ^
   -DZLIB_LIBRARY=%cd:\=/%/../zlib_install/lib/zlib.lib ^
   -Dnetcdf_DIR=%cd:\=/%/../netcdf_install/lib/cmake/netCDF ^
   -DHDF5_DIR=%cd:\=/%/../hdf5_install/cmake ^
   -DBOOST_INCLUDEDIR=%cd:\=/%/../../boost_1_62_0 ^
   -DQSCINTILLA_INCLUDE_DIR=%cd:\=/%/../../QScintilla_gpl-2.9.3\Qt4Qt5 ^
   -DQSCINTILLA_LIBRARY=%cd:\=/%/../qscintilla/debug/qscintilla2.lib ^
   -DPYTHON_LIBRARY=%cd:\=/%/../Python/libs/python34.lib ^
   -DPYTHON_INCLUDE_DIR=%cd:\=/%/../Python/include ^
   -DPYTHON_EXECUTABLE=%cd:\=/%/../Python/bin/python.exe ^
   -DXSLT_PROCESSOR=../../libxslt-1.1.26.win32/bin/xsltproc.exe ^
   -DSPHINX_PROCESSOR_PATH=%cd:\=/%/../Python/Scripts ^
   -DLIBAV_INCLUDE_DIR=%cd:\=/%/../libav_install/include ^
   -DLIBAV_LIBRARY_DIR=%cd:\=/%/../libav_install/bin ^
   -DOVITO_BUILD_DOCUMENTATION=ON ^
   -DFFTW3_INCLUDE_DIR=%cd:\=/%/../fftw ^
   -DFFTW3_LIBRARY=%cd:\=/%/../fftw/libfftw3f-3.lib ^
   ../../source