Compiling ElmerGUI with Visual Studio Express Edition

From Elmer Wiki
Jump to: navigation, search

Prerequisites

  • Visual C++ 2008 Express Edition
  • Qt4 compiled for Visual C++ 2008 Express Edition
  • Qwt5 compiled for Visual C++ 2008 Express Edition
  • If you already have VC++, Qt4 and Qwt5 installed on your system, please goto step 4.

Elmerguivc.jpg

Installing Visual C++ 2008 Express Edition

Get the compiler from http://www.microsoft.com/express/vc/

Installing Qt4

Get the source code of Qt4 from Trolltech's site (choose the open source edition for Windows). Uncompress the source package in C:\Qt and rename directory for convenience e.g. as 4.4.0 (this was the current version when this document was written). You should then have a directory structure which looks like this:

C:\Qt
C:\Qt\4.4.0
C:\Qt\4.4.0\src
C:\Qt\4.4.0\examples

Open the Visual Studio Command prompt (Start -> Programs -> Visual C++ 9.0... -> Visual studio tools -> Cmd prompt) and "cd" to the directory C:\Qt\4.4.0. Type (please follow the instructions provided by "configure" carefully):

C:\Qt\4.4.0> configure
C:\Qt\4.4.0> nmake

These two commands will compile the Qt4 library for you. It may take hours to complete, so be patient.

Finally, modify the environment variables by typing:

C:\Qt\4.4.0> set QTDIR=C:\Qt\4.4.0
C:\Qt\4.4.0> set path=%QTDIR%\bin;%path%

Installing Qwt5

Get the source package "qwt-5.1.1.zip" from SF.net and uncompress its contents in "C:\". You should then have a directory called C:\Qwt-5.1.1 containing Qwt's source code:

C:\Qwt-5.1.1
C:\Qwt-5.1.1\src
C:\Qwt-5.1.1\examples

Open the Visual Studio Command Prompt, go to the directory C:\Qwt-5.1.1 and type (please make sure that QTDIR is set and %QTDIR%\bin is in path - see Section 1 above):

C:\Qwt-5.1.1> qmake
C:\Qwt-5.1.1> nmake
C:\Qwt-5.1.1> nmake install

If the compilation fails, you may need to edit the file "qwtconfig.pri" and comment out (at the bottom of the file) the line

CONFIG += QwtDesigner

Then retype the above command sequence.

Compiling ElmerGUI from command line

Get the source code for ElmerGUI from the subversion repository of Elmer.

Open the Visual Studio Command Prompt and go to the source directory "elmerfem\trunk\ElmerGUI" (please make sure that the environment variable QTDIR has been set up correctly. Also make sure that %QTDIR%\bin is in path - see the Section 1 above). Edit the file ElmerGUI.pri as follows:

DEFINES += EG_QWT
DEFINES -= EG_VTK
DEFINES += EG_MATC
DEFINES -= EG_OCC
DEFINES -= EG_PYTHONQT

Type:

> qmake
> nmake

Finally install and run the executable as:

> nmake install
> ElmerGUI

Note: The installation directory must be included in your path variable.

Creating a Visual C++ project for ElmerGUI

Follow the steps of section 4, but instead of "qmake", type:

> qmake -tp vc -spec win32-msvc2008

This will create the Visual Studio project file "Mesh3D.vcproj".