MS Windows from Source Code Tarball

Warning

The last version of Gwyddion that can be built with MSVC6 is 2.22.

Gwyddion MS Windows build system uses the Microsoft Visual C++ (MSVC) compiler (version 6 is tested and recommended, albeit it is a bit older). It primarily consists of a set of nmake makefiles, that is the compilation is done from the command line. This approach has several advantages with respect to reproducibility and automation of the process. Furthermore, it enables easy synchronization of Unix and MS Windows build systems. The necessity to use command line may be considered a disadvantage though you should find the compilation process quite simple even you are not used to use the command line much.

In addition to MSVC you need to install Gtk+ development environment. Again, we recommend to use the GladeWin32 package. Note it also contains the complete run-time environment, therefore you do not need to install the run-time package if you install the development one.

Unpacking

Unpack the source code tarball with your favorite (de)compression program or file manager. Tarballs compressed with bzip2 (.bz2) are considerably smaller than gzip compressed tarballs (.gz), however support for bzip2 compression used to be less widespread than gzip compression support in MS Windows programs. Most recent programs support both, for example 7zip which is also Free Software.

The unpacking will create directory gwyddion-2.19 (with 2.19 replaced with the actual version number) where all other compilation actions will take place.

Configuration

Open file make.msc in a text editor. It starts approximately as follows:

# @(#) $Id: make.msc 8812 2008-12-02 08:49:22Z xhorak $
#
# XXX: Set following to your Gtk+-Development and MSVC paths
#
# The uncommented paths should work for default MSVC 6 installation and for
# default GladeWin32 installation.
# If you have GtkGLext separate from Gtk+, define GTKGLEXT_TOP accordingly.
# If you have LibXML2 separate from Gtk+, define LIBXML2_TOP accordingly.
GTK_TOP = C:\Gtk
GTKGLEXT_TOP = $(GTK_TOP)
LIBXML2_TOP = $(GTK_TOP)
#GTKGLEXT_TOP = C:\GtkGLExt\1.0
#LIBXML2_TOP = C:\libxml2
MSC_TOP = C:\Program Files\Microsoft Visual Studio\VC98

Check and correct the paths according to the instructions. Often, no modifications are necessary as the paths in the file represent the default installation directories of each program.

GTK_TOP
It should point to the top-level directory of Gtk+ installation, that is the directory containing bin, lib, share, etc. subdirectories. We will refer to its value as to $(GTK_TOP) below.
GTKGLEXT_TOP
It should point to the corresponding top-level directory of GtkGLExt installation. This differs from $(GTK_TOP) only if you do not use GladeWin32 and have installed GtkGLExt separately.
LIBXML2_TOP
It should point to the corresponding top-level directory of LibXML2 installation. This differs from $(GTK_TOP) only if you do not use GladeWin32 and have installed LibXML2 separately.
MSC_TOP
It should point to the top-level directory of MSVC installation.

Run a shell (command line, MS-DOS prompt), switch to the source directory and run vcvars32.bat there. This batch file is provided by MSVC and sets certain environment variables the command-line compiler and linker require, it also makes them directly executable by setting PATH. Note vcvars32.bat may not be in PATH itself but it should be easy to locate.

Compilation

Run

nmake -f makefile.msc

to compile Gwyddion and

nmake -f makefile.msc install

to install it into a staging area, namely subdirectory inst (created by this command). If something goes wrong with the second step and you wish to start it again, remove directory inst and file inst.stamp first for a clean start.

Installation

The layout of the staging area in inst exactly the same as of the final installation. Therefore you can also run Gwyddion directly from it (gwyddion.exe is found directly in inst). Except if you have never run Gwyddion before, it will not find the run-time Gtk+ libraries (DLLs) it needs. Run regedit, create in

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\App Paths\Gwyddion.exe

a string key Path and put $(GTK_TOP)\lib;$(GTK_TOP)\bin there (here again $(GTK_TOP) is to be replaced with the corresponding directory set in make.msc, do not put $(GTK_TOP) there literally). If you have separate GtkGLExt and/or LibXML2, add also their lib and bin directories, separated by semicolons. If you cannot edit global registry under HKEY_LOCAL_MACHINE, set the path under HKEY_CURRENT_USER for the current user only.

Now you can either run Gwyddion from inst or copy the directory elsewhere, possibly renaming it.

Executable Installers

To create an executable installer you need Inno Setup, version 4 or newer. Open inst/gwyddion.iss and build the installer, it will create Gwyddion-2.19.exe (with 2.19 replaced with the actual version number), again in inst. You can repeat this procedure with inst/gwyddion-devel.iss to obtain Gwyddion-Development-2.19.exe, should you ever need it.