Personal tools
You are here: Home / cmgui / Wiki / Windows instructions using CMake
Navigation
Log in


Forgot your password?
 

Windows instructions using CMake

Building Cmgui using CMake and Microsoft Visual Studio

The following is a description of how to build Cmgui on a Windows 7 (64 bit) machine using CMake and Microsoft Visual Studio. The following will assume that the PC currently contains none of the required software. Maybe your PC already has some of the required software, if so then feel free to skip the relevant parts.

Some advice, have a good read through these instructions first and then another read through each subsection when you reach it. It will hopefully give you the understanding necessary if things don't quite go to plan.

Software Requirements

Here is a list of all the software required:

  • CMake - minimum version 2.8.2
  • Sliksvn
  • Perl - Active perl community edition
  • Patch for windows
  • Visual Studio Express
  • FreeType

If you want to build 64 bit applications then you also need:

  • Microsoft SDK v7.1

Download Software

To download the required software the following is a list of places to start.

I have had some problems with the 'Patch for Windows' program from GNU and User Account Control (UAC) on Windows 7. So the patch supplied here is one I have built specifically for windows. The installer will install the patch executable into 'C:\Program Files (x86)\Gnu\Patch-2.5.9' by default. Whichever directory the patch executable gets installed to needs to be added to your system path, if not already there.

The include and lib directory of the installed FreeType should also be added to your system path.

The versions of the above software used in this page are

  • cmake-2.8.4-win32-x86 (yes 32 bit) {8 MB}
  • Sliksvn-1.7.5 {4.5 MB}
  • ActivePerl-5.12.3.1204-MSWin32-x64-294330 {24.4 MB}
  • Patch-2.5.9 {214 KB}
  • Microsoft Visual Studio 2010 Express {? MB}
  • Microsoft SDK v7.1 {? MB}
  • FreeType {1.1 MB}

Install Software

Now install that lot. For Visual Studio you will have to register the product to use it for longer than the evaluation period (30 days). For this you need a windows live id. Something you will need to sort out for yourself.

  • Say 'yes' to add CMake to the system path
  • Say 'yes' to add perl to the system path
  • Add the location of the freetype installation to the system path. On my system this was the default install location 'C:\Program Files (x86)\GnuWin32'.

If you have an old version of CMake (2.8.9 or less) then you will need to edit the FindFreetype.cmake Module so that line 67 reads:

PATH_SUFFIXES include/freetype2 freetype2

I used the Microsoft Help Viewer application to download some help files

  • Visual Studio C++ Help
  • And something else that I thought might be useful but can't remember what???

When I went through this process on Windows XP, Visual Studio forced a restart on me so perhaps do this last.

With everything installed I used approximately 4 GB of hard disk drive space.

Build Pre-requisites

So to get the build started you need to do a little work and I have a CMake script that will do the rest. This script will download and build a lot of stuff, all of which it will put under one folder defined by you, let's call it CMISS_ROOT. The default location for this folder is:

C:\cmiss

But feel free to change it.

Things you need to do

  1. create the directory 'CMISS_ROOT'.
  2. create another directory somewhere called setup.
  3. create a subfolder of setup called build
  4. download this CMake script (Right click and choose 'save target/link as...') and save it in 'somewhere\setup'.

The files and folders in the 'setup' directory can be deleted when the build process is finished. Creating the directory 'setup' inside the CMISS_ROOT directory is fine (that's what I do). That's about it, now we are ready to actually start building some software.

Building Cmgui Dependencies

Open up a Visual Studio command prompt. (Make sure it is a Visual Studio command prompt because it sets up the build environment for us). For building default 32-bit binaries this is likely to be:

Start/All programs/Microsoft Visual Studio 2010 Express/Visual Studio Command Prompt (2010)

If you want to build 64-bit binaries, use the one added with the Windows SDK, something like:

Start/All programs/Microsoft Windows SDK v7.1/Windows SDK v7.1 Command Prompt

I actually right click on this menu item and pin it to the taskbar and pin it to the Start Menu to make it easily accessible.

In the command prompt execute the following commands:

cd /d somewhere\setup\build
cmake-gui ..

Now check that cmake-gui has set the following, if not make it so:

  • 'Where is the source code:' somewhere/setup
  • 'Where to build the binaries:' somewhere/setup/build

then press the 'Configure' button choose your generator as 'NMake Makefiles' and configure away, read the build option descriptions to get an idea of their use. Press 'Configure' until you have no more red highlighting and then 'Generate'. Now we can execute the following command in the command shell:

nmake

The build script should find the sliksvn client, but when it comes to use it for the first time it will ask you to accept the security certificate if you choose the permanent (p) option the script will carry on without further user interaction.

-- If you get a User Access Control dialog box appear see below for a remedy to this. --

Now you wait while everything builds ... you will need to wait a while ... quite a while.

The Last Step

At the successful completion of the build we still need to do a couple of jobs to finish off. What the above steps have done is to compile all the dependencies of Cmgui and setup a Visual Studio solution for developing Cmgui. To finish off all we need do is open the Cmgui Visual Studio solution file in Visual Studio and build the ALL_BUILD target. This will build a Debug or Release version of Cmgui depending on the current build configuration.

Enjoy.

That Script Again

CMake Cmgui build script: https://svn.physiomeproject.org/svn/cmiss/cmake/trunk/cmgui/CMakeLists.txt (Right click and choose 'save target/link as...')

If you encounter any issues with this script please leave a comment here.

Windows 7 User Access Control

For us this is bad. It just doesn't like the patch.exe program. We need to disable this for the duration of building Cmgui's Dependencies. To disable UAC we need administrator priveleges then we can do the following.

Disable and Turnoff UAC in Windows 7 from Control Panel

  1. Access User Control Panel from Start Menu -> Control Panel -> User Accounts and Family Safety -> User Account
  2. Click on User Account Control settings link.
  3. Move the Slider to Never Notify
  4. Click OK to make the change effective
  5. Reboot