How to compile ClientServer module on Windows platform
Prerequisites
- Working environment installed as described in How to install COOLFluiD on Windows XP
- At least Qt 4.5 open source edition (link below)
- ClientServer module needs COOLFluiD kernel librairies to compile and work
Compile Qt
Introduction
It is possible to get a precompiled version of Qt. But it is compiled using MinGW, which makes Qt totally unusable with Microsoft Visual C++. Qt has to be recompiled using Visual C++.
Compiling Qt is a process that eats time (several hours) and disk space (about 5 GB, more in 64 bits). This howto explains how to compile a minimalist Qt capable to compile the ClientServer module. To achieve this, the following parts will be skipped:
- Tools (note that qmake and moc tools are compiled anyway, they are used to compile Qt itself)
- Examples
- Demos
- Docs
- Translations (translation files for tools)
- Qt3 support
Note that examples and demos sources will be copied to the final installation directory. API documentation will be available in HTML format.
Compilation
- Create C:\Qt\4.5.2 directory
- Download Qt sources here
- Unzip the archive to C:\tmp
- Copy the "mkspecs" directory from unzipped directory to C:\Qt\4.5.2
- Launch the Visual Studio command prompt (typically Start > All programs > Microsoft Visual C++ 2008 Express edition > Visual Studio Tools > Visual Studion 2008 Command prompt).
- Go to the unzipped directory
- Do
$> configure -prefix "C:\Qt\4.5.2" -platform win32-msvc2008 -opensource -fast -no-qt3support
Where:- prefix option gives the directory where Qt will be installed to.
- platform option defines the platform Qt will be compiled for (here Visual C++ 2008).
- opensource option defines the license. Note that Qt open source edition only supports the Express edition of Visual C++.
- fast option allows to skip some parts of Qt
- no-qt3support option disables Qt3 support.
You have to accept the LGPL license to continue. The configuration step takes a few minutes.
- Once the configuration is finished, go to the unzipped directory with Windows Explorer. Find the file "project.pro" and open it with a text editor. Find a line similar to:
QT_BUILD_PARTS = libs tools examples demos docs translations
Comment to keep only "libs", like this:QT_BUILD_PARTS = libs # tools examples demos docs translations
- Save the file and go back to the command prompt. Do:
$> nmake
This step takes from one to three hours (or more), depending on your hardware configuration. - When compilation is done, install Qt to the destination directory:
$> nmake install
Final step
Add Qt bin directory to the path environment variable
- Right-click on the "My computer" icon on the desktop and choose "Properties" (or do the shortcut <Windows key> + <Break>)
- Click on the "Environment variables" button in the "Advanced" tab
- In "System variables", double click on Path variable and append ";C:\Qt\4.5.2\bin" to the value (don't forget the semi-colon!)
- Close the windows by clicking on "Ok".
Launch a new Visual Studio command prompt. If the system can find Qt, the command:
$> qmake -version
Should print something like:
QMake version 2.01a Using Qt version 4.5.2 in C:\Qt\4.5.2\lib
Test Qt installation
Create a directory with any name you want in C:\tmp. Create in this directory a CXX file with the following code:
#include <QtGui> int main(int argc, char * argv[]) { QApplication app(argc, argv); QMessageBox::information(NULL, "Testing Qt", "If you see this, Qt works!"); return 0; }
To compile this code, go to the previously created directory with the Visual Studio prompt command. Do:
$> qmake -project
This analyzes the current directory and sub-directories and generates a .pro file (Qt project file) which has the same name than the current directory. Then, do:
$> qmake
This generates a Makefile. Finally, do:
$> nmake
If the compilation succeeded, you should be able to run the application in the Debug directory
Delete temporary files
All files and directories created in C:\tmp can be deleted.
Compile ClientServer module
Generate Microsoft Visual C++ projects with CMake. The compilation can be done within Visual C++, like the rest of COOLFluiD. Compiling "app_client" and "app_server" projects will build everything that is needed.
Do a full compilation of Qt
To do a full compilation of Qt, follow the previously described steps, but use this configure command:
$> configure -prefix "C:\Qt\4.5.2" -platform win32-msvc2008 -opensource
to configure and do not edit the "projects.pro" file.
