November 3, 2012

HOWTO: Compile Shark Machine Learning Library on Windows using MinGW, CMake

Shark Machine Learning Library (http://shark-project.sourceforge.net/) is a modular C++ library for the design and optimization of adaptive systems. It provides methods for linear and nonlinear optimization, in particular evolutionary and gradient-based algorithms, kernel-based learning algorithms and neural networks, and various other machine learning techniques. SHARK serves as a toolbox to support real world applications as well as research in different domains of computational intelligence and machine learning. The sources are compatible with the following platforms: Windows, Solaris, MacOS X, and Linux.

You can get source here: http://sourceforge.net/projects/shark-project/files/ or thru SVN from here: http://sourceforge.net/projects/shark-project/develop.

Here http://shark-project.sourceforge.net/GettingStarted.html you can read how to compile Shark library, but installing and compiling Shark on Windows systems is not so clear for typical users. 

So, to compile, you must have installed this software:

 

When you unpack Shark sources, go to Shark root directory, and create file script.bat:

mkdir <path-to-build-dir>

cd <path-to-build-dir>

<path-to-CMake-bin>\cmake.exe -G"MinGW Makefiles" <path-to-Shark-sources>

<path-to-mingw-bin>\mingw32-make.exe


For example, I unpacked Shark sources to d:\PROJECTS\NEURAL\Shark\, and there I created such script file:

mkdir d:\PROJECTS\NEURAL\Shark_bin

cd d:\PROJECTS\NEURAL\Shark_bin

"d:\WORKSHOP\CMake 2.8\bin\cmake.exe" -G"MinGW Makefiles" d:\PROJECTS\NEURAL\Shark\

"c:\MinGW\bin\mingw32-make.exe"

 

Example of using Shark with Qt. In .pro file add:

SHARKHOME = "d:/PROJECTS/NEURAL/Shark/"

CONFIG  = qt console

INCLUDEPATH = $${SHARKHOME}/include

win32{

   LIBS = -L$${SHARKHOME}/lib/ -lshark

}

...

 

That's all!