Skip to main content

Windows compilation in a nutshell

Hi everyone,

This tutorial is meant to give an easy way for windows developers to compile and run Tulip on a Windows 32 bit system.
The idea is to get a working environment to easily create and manage plugins with Qt creator IDE and the mingw32 build system. 
If you have any problem related to the installation process, feel free to check on our forums (https://sourceforge.net/projects/auber/forums) for help.

 

Note: This tutorial does not mean to explain how to use the CMake program of the Qt Creator IDE, for any information, please consult the respective documentation of those programs.

Note 2: We also assume that you know how to edit eh PATH environment variable in windows, for any help on this, just consult the microsoft web site.

 

I- Requirements

First, you'll need some administration rights on your machine, you'll have to be able to install programs and edit system environment variables. To check this, just go into the system advanced configuration and check the system environment variables.

You'll need to download the following packages:

Now your downloads folder should look like this:

  • freetype-2.3.5-1-setup.exe

  • glew-1.5.6-win32.zip

  • iconv-1.9.2.win32.zip

  • jpeg-6b-4.exe

  • libpng-1.2.37-setup.exe

  • libxml2-2.6.32+.win32.zip

  • qt-sdk-win-opensource-2010.05.exe

  • zlib-1.2.3.exe

Note: Versions of those components may vary, we'll try to get an up-to-date version of this document but if you experience an error with a different version of any of those packages, feel free to report it on our forums.

It is also recommanded that you download a SVN client program to checkout the last Tulip sources. You can use Tortoise SVN provided by tigris.org: http://tortoisesvn.tigris.org/

 

II- Installation

Install the previously downloaded packages in the following order:

  1. CMake for Windows

  2. Qt SDK

  3. JPEG for Windows

  4. PNG for Windows

  5. ZLIB for Windows

  6. Freetype2 for Windows

We suggest that you keep the default installation paths during the installation of those programs, this will ensure that all the GnuWin32 programs will be installed in the same folder and will reduce configuration hassle. In the following, we will assume that you selected the same installation folder for at least the GnuWin32 programs (JPEG, PNG, ZLIB and Freetype2).

Now unzip the LibXML package into your GnuWin32 installation folder. You should get a prompt to merge the include and lib folders, click yes. Do the same with the iconv archive.

Unzip the glew ZIP archive somewhere in your filesystem.

Time to install MSYS, run the setup and say yes for the post installation instructions. You will be asked ton input the path of your MinGW installation. Which is located in the mingw subdirectory of your Qt install folder.

Ok all the files have been installed, we can now proceed to the system configuration part.

 

III- Configuration

Open your system environment variable configuration window (Should be somewhere like Control Panel > System > Advanced System Settings > Environment Variables, location vary on different Windows version)

First, well edit your PATH environment variable. Locate the mingw32/bin folder in your Qt installation (eg. C:\Qt\2010.05\mingw\bin). Check that this folder is already present in yout PATH. If not, add it.

Do the same for the qt/bin folder in yout Qt installation directory.

Do the same for the bin folder in your CMake installation directory.

Do the same for the bin folder located in your MSYS installation directory.

Now create a new environment variable called CMAKE_INCLUDE_PATH. This variable is meant to contain any include directory used by FindPACKAGE.cmake scripts to find include directories.

Add the paths to the include sub-directories located in your GnuWin32 and GLEW installation directories.

Note: Environment variable separators are system-specific, the ; character is commonly used in windows to separate two paths. So your CMAKE_INCLUDE_PATH variable shoudl look like this: C:\Program Files\GnuWin32\include;C:\glew-1.5.6\include;

Create a new environment variable called CMAKE_LIBRARY_PATH and add the paths to the lib sub-folders located in your GnuWin32 and GLEW installation directories. (Same as before).

Click ok and go back to your desktop. 

 

IV - Compiling

Now everything should be set up to build tulip, check out the latest sources from our SVN or just download a source package on our website: http://tulip.labri.fr/

Run cmake gui and specify the build and source directories. Click on Configure and choose MinGW Makefiles, Using default native compilers. Everything should run smoothly except for the CMAKE_BUILD_TYPE and CMAKE_INSTALL_PREFIX variables where you'll have to fill your desired values.

Note: Some users experienced problems at compilation stage when using OpenMP along with mingw runtime. To disable OpenMP, check the "Advanced" box in cmake-gui and look for the OpenMP_CXX_FLAGS and OpenMP_C_FLAGS. They should contains some flags

like -fopenmp. Remove everything for those two variables and re-run a configure.

You'll now have to add some parameters to the CMake variables.

First set the CMAKE_EXE_LINKER_FLAGS variable to -Wl,--allow-multiple-definition

 

Note: The following flags are not mandatory, they'll just make your Tulip binaries smallers as they'll link your software against the dll of the libstdc++ instead of using the static libraries.

  • Add -D_GLIBCXX_DLL to your CMAKE_CXX_FLAGS

  • Add -lstdc++_s to your CMAKE_EXE_LINKER_FLAGS

You should now be able to click on the "Generate" button to generate the MinGW Makefiles.

You can now import the Tulip sources in a Qt Creator project and setup a build configuration using the MinGW32 toolchain, ot just open a command prompt (cmd.exe), cd into your build folder and run mingw32-make.

For any additional information, feel free to post on our forums (https://sourceforge.net/projects/auber/forums) and be sure to check out any update of this tutorial on the Tulip web site: http://tulip.labri.fr/ 

 

V- Additional notes: Running Tulip

To run Tulip, you'll have to add some extra configuration to your system.

Add the paths to the bin sub-folders of your Glew and GnuWin32 to your PATH (Windows need them in the path when running an application)