MASH logo
Login | Register

CMake: Quick Start Guide

From MASH Wiki

Jump to: navigation, search

The purpose of this guide is to let you build the MASH SDK in the shortest possible time. The barest minimum of CMake is shown here, and there is no real discussion. If you want or need more informations, please read the CMake: Getting Started page.

We assume here that you've already downloaded / extracted the MASH SDK source code into a folder on your local machine. From here, go to the section for your platform.


Contents


Windows

On Windows, you can compile the SDK using either Visual Studio 2005, Visual Studio 2008 or Visual C++ 2008 Express (which is free).

  1. Download CMake. You want the 'Win32 installer' release in the binary distribution section.
  2. Run the CMake installer, install wherever you like.
  3. Launch CMake via Start > Program Files > CMake 2.6 > CMake (GUI) (note that the shortcut put by the installer on your desktop does NOT point to the CMake GUI program!)
  4. In the "Where is the source code" box, type or browse to the root directory of your MASH SDK source.
  5. In the "Where to build the binaries" box, type or browse to any folder you like - this will be where the Visual Studio solution will be generated. This folder does not have to exist yet.
  6. Hit the Configure button near the bottom of the window.
  7. Pick your target compiler, e.g. "Visual Studio 8 2005".
  8. Answer Ok when asked if you want to create the build directory.
  9. Wait for the configure process to finish.
  10. The screen will now have one configuration option on it, which will be red. You don't need to change its value, since you won't install anything. Just click the Configure button again.
  11. The option will turn grey, and the Generate button at the bottom will now be enabled. Click Generate.
  12. The build files will now be generated in the location you picked.

You can now open the MASH.sln file that was generated in your build directory, and compile as usual.

To test your heuristics, you must launch the testheuristic executable. For that you must correctly setup the arguments and working directory in the settings window of the project:


Linux / Unix

On Linux, CMake can also be used via a GUI if you want. Refer to the Windows or MacOS X instructions if you are interested. The command-line variant is shown here.

  1. Install CMake via your distribution's package repository. For example, on Ubuntu type:
    sudo apt-get install cmake cmake-gui
    If your distribution does not provide an official CMake package, go to the CMake website and either download a binary package or download and compile CMake from source.
  2. Create a build directory somewhere on your filesystem - this will be where the makefiles will be generated.
  3. In a console, cd to the build directory and call cmake with the path to the source dirrectory of the MASH SDK:
    cmake /path/to/mash/sdk
  4. Compile the SDK by doing:
    make

As you can see, CMake essentially replace ./configure.


MacOS X

On MacOS X, you can build the SDK using either XCode 3.1+ or gcc.

  1. Download CMake. You want the 'Mac OSX Universal' release in the binary distribution section.
  2. Open the downloaded .dmg file to mount it.
  3. Double-click the .pkg installer, install on your main drive and enable the installation of the command-line tools (in case you want to use them later, we will use the GUI here).
  4. Launch CMake (from your Applications folder).
  5. In the "Where is the source code" box, type or browse to the root directory of your MASH SDK source.
  6. In the "Where to build the binaries" box, type or browse to any folder you like - this will be where the Visual Studio solution will be generated. This folder does not have to exist yet.
  7. Hit the Configure button near the bottom of the window.
  8. Pick 'XCode' as the generator and choose to use the native compilers.
  9. Answer Ok when asked if you want to create the build directory.
  10. Wait for the configure process to finish
  11. The screen will now have several configuration options on it, which will be red. You don't need to change their value. Just click the Configure button again.
  12. The options will turn grey, and the Generate button at the bottom will now be enabled. Click Generate.
  13. The build files will now be generated in the location you picked.

You can now open the MASH.xcodeproj file that was generated in your build directory, and compile as usual.

To test your heuristics, you must launch the testheuristic executable. For that you must correctly setup the arguments in the settings window of the target:

Warning: It seems that there is a bug in either CMake or XCode that prevent the debugger to work correctly. The workaround is to open the preferences window of XCode, in the Debugging panel, and uncheck the Load symbols lazily setting:

Personal