wiki:DianaWindowsProgrammersGuide

Version 4 (modified by ivanovy, 15 years ago) (diff)

--

Programmer's Guide

Making Diana installer for Windows includes three steps:

  • Configuring Linux Environment in Windows.
  • Compiling sources in MinGW environment for Windows.
  • Making installer.

Configuring Linux Environment in Windows

Install MinGW. (mingw-runtime, w32api, GCC, binutils). There is an installer executable for easy installation this components.
Install msys. All links and guides for listed packages installation can be found at http://www.mingw.org
Update gcc to 4.4.0 or later http://gcc.gnu.org/ (version 3.x.x that was in standard mingw installation but didn't work properly).

Compiling sources in MinGW environment for Windows

Download all Windows version of packages required for compiling Diana, and compile/install them. (I installed following components: xerces, swig, python, blas, lapack, cppunit, sundials, ufsparse.) I recommend to install all in C:\WinDiana.

Packages installation:

/c/WinDiana/src/xerces-c-src_2_8_0
$ export XERCESCROOT=`pwd`
/c/WinDiana/src/xerces-c-src_2_8_0/src/xercesc
$ ./runConfigure -pmingw-msys -cgcc -xg++ -minmem -nwinsock -tnative -rpthread -P/WinDiana/xerces
/c/WinDiana/src/xerces-c-src_2_8_0/src/xercesc
$ make
/c/WinDiana/src/xerces-c-src_2_8_0/src/xercesc
$ make install

Requires additional installation of automake, bison.
/c/WinDiana/src/swigwin-1.3.40
$ ./autogen.sh

/c/WinDiana/src/swigwin-1.3.40
$ ./configure --prefix /c/WinDiana/

/c/WinDiana/src/swigwin-1.3.40
$ make

/c/WinDiana/src/swigwin-1.3.40
$ make install

At the moment version 2.6.5(release) is avaible but I used 2.5.4 because 2.6.5 don't output error messages in cases of crash.
Installation: windows executable installer

Make following changes in make.inc:
PLAT =

FORTRAN = gfortran
OPTS = -funroll-all-loops -O3
DRVOPTS = $(OPTS)
NOOPT =
LOADER = gfortran
LOADOPTS =

TIMER = NONE

/c/WinDiana/src/lapack-3.1.1
$ make

/c/WinDiana/src/cppunit-1.12.1
$ ./configure --disable-shared --prefix /c/WinDiana/

/c/WinDiana/src/cppunit-1.12.1
$ make

/WinDiana/src/sundials-2.3.0
$ ./configure --prefix=/WinDiana/sundials
/WinDiana/src/sundials-2.3.0
$ make

*UMFPACK 5.4.0

In UFconfig/UFconfig.mk change
BLAS = -L/c/WinDiana/lib -lblas_LINUX -lgfortran -lgfortranbegin -lg2c
LAPACK = -llapack_LINUX
UMFPACK_CONFIG =

/c/WinDiana/src/UMFPACK/UMFPACK
$ make


Next step - download from svn Diana sources. Compile Diana sources (configuring, making the same as in Linux). In my case it was:

/c/WinDiana/src/diana-0.8.2
$ config/bootstrap
/c/WinDiana/src/diana-0.8.2
$ ./configure --with-xerces=/c/WinDiana/xerces --with-swig=/c/WinDiana/ --with-python=/c/Python25/ --with-blas=/c/WinDiana --with-lapack=/c/WinDiana/ --with-cppunit=/c/WinDiana --with-ufsparse=/c/WinDiana/src/UMFPACK/ --with-sundials=/c/WinDiana/ --prefix=/c/Diana/
/c/WinDiana/src/diana-0.8.2
$ make
/c/WinDiana/src/diana-0.8.2
$ make install

Making installer(for Inno Setup)

Inno Setup is free program for making installer with open sources. I've written pascal-based script for Inno Setup that completely generates Diana installer and components(MinGW, promot, python). Script provides that should be path C:\WinDiana\MakeSetup, which contains following dirs and files:

  • promot.exe – executable Promot installer wchich automatically runs after installion.
  • python-2.5.4.msi – executable Python installer wchich automarically runs after installion.
  • scipy-0.7.1-win32-superpack-python2.5.exe, numpy-1.3.0-win32-superpack-python2.5.exe – utils for Python.
  • makefile-common-actions.mk, makefile-common-vars.mk, makefile-model-library.mk – are needed for work dianac, etc.
  • diana.bat, dianac.bat, DianaConsole.bat, run.bat, mdl2diana.bat – Windows versions of Diana executable batch files.
  • include – all Diana includes and its components: xerces, swig, etc.
  • lib – all Diana libs and its components: xerces, swig, etc.
  • MinGW,msys – environment for compiling model sources (dianac).
  • LICENSE, packages – information files, they are shown during installation process. (GNU Public License and list of packages).

This structure can be changed in field [Files] in script.
All fields in script which contains program information, components list, etc. use special structure and functions of Inno-setup. Code in section [Code] developed on Pascal with using WinAPI to find components that had already installed in system and to add/delete required pathes to system PATH.