# TPCCLIB development using C in Windows

This page gives instructions on setting up the necessary tools for compiling TPCCLIB in the Windows environment, for use in the Windows computers. Alternatively, Windows and Linux binaries can be compiled in WSL in Windows 10.

## Installing C compiler

C libraries and programs can be compiled using GNU C compiler (gcc) in 32- and 64-bit Windows. Installation on only 64-bit Windows is considered here, but both 32- and 64-bit executables can be compiled using the 64-bit compiler suite.

Install either TDM-GCC, which can be downloaded from http://tdm-gcc.tdragon.net/, MinGW-w64, which can be downloaded from http://sourceforge.net/projects/mingw-w64/, or gcc including make and openMP from Equation Solution. If you plan to distribute the executables, TDM-GCC and Equation Solution gcc are easier options, because they link all libraries statically by default; that leads to increased executable size, but prevents errors like cannot find xxx.dll when trying to use the programs on another computer.

If you have a previous installation of GCC compiler on your computer, uninstall those and remove all related environment settings before installing a new compiler and toolchain package to your computer, otherwise you may encounter spurious errors when trying to compile your C code.

## Installing build, test, and packaging tool CMake

CMake is an open-source, cross-platform tool which is required to build, test, and package the TPCCLIB software. Download and install the binary package from http://cmake.org. You can use 32-bit version of CMake to build configurations for 32- and 64-bit software on 64-bit platforms.

## Installing bash shell

Bash command line interpreter system facilitates porting open-source software to MS Windows. TPCCLIB test routines are written as bash scripts, which can be executed in Linux and macOS, but usage of bash scripts in Windows requires installation of bash shell. It is not needed to run Windows executables compiled from TPCCLIB source codes.

It is possible to install MSYS using MinGW installer, but the easiest option is to install Git for Windows, which provides Git bash, UNIX like tools such as grep, and of course git, which can be then used to easily clone the TPCCLIB source codes. Some tools, such as rsync, can be installed from MinGW/MSYS.

In Turku PET Centre: If you are installing Git for Windows in Turku PET Centre, create first a new environment variable ‘HOME’, pointing to a folder on a local drive which you want to be your home directory for Git bash; in TPC the home directory would be the very slow M: drive by default.

## Compiling

Documentation for TPCCLIB gives instructions for compiling the C libraries and executables.

In order to use the compiled programs Windows must be told where to find the program files by adding the directory of compiled executables into the search path. Also the test procedure requires this setting.

## Doxygen

TPCCLIB documentation is included in the TPCCLIB source codes, and to reproduce the HTML version of the documentation you must install doxygen documentation system. To include diagrams and graphs in doxygen documents install also the dot tool.

Doxygen can be used from either Windows command prompt window or from Git bash.