- Using the GRT in your projects
- Compiling the GRT using GNU Make
- Setting up the GRT in Xcode
You need to download, and add the GRT to your project before you can use it. After downloading the GRT, locate the folder called GRT in the main gesture-recognition-toolkit folder and add the GRT folder and all its subfolders to your project.
Installing and using the GRT in your c++ projects
To use the GRT you simply need to add all of the code contained in the GRT folder to your c++ project. If you are using an IDE such as XCode or VisualStudio then you can either add the files in the GRT folder to your project using "File -> Add Files to project", or in most IDEs you can simply drag the GRT folder (from Finder or Windows Explorer) into your IDE which should add all of the files in the GRT folder to your project.
After you have added the code in the GRT folder to your project, you can now use any of the GRT functions or classes by adding the following two lines of code to the top of any header file in your project in which you want to use the GRT code:
//The next line states that you are using the GRT namespace, this means you don't have to write GRT::WhatEverClass in front of any of the GRT classes you want to use
using namespace GRT;
int main (int argc, const char * argv)
//The main code for your project....
The first line of code above adds the main GRT header file (GRT.h) to your project, this header file contains all of the GRT module header files which means you do not need to manually include any other GRT header files. The second line of code states that you are using the GRT namespace, this means that you don't have to write
GRT::WhatEverClass every time you want to use a GRT class and can instead simply write
Note that, depending on your IDE, you may have to specify the physical path that you placed the GRT folder in on your hard drive, for instance you might have to write something like:
Compiling the GRT using GNU Make
You can easily compile the GRT using GNU make. You can find an example makefile in the examples folder. This example makefile will compile the GRT as a static library, which you can then link against in your own projects. The example will also compile all of the GRT examples (in the examples folder) along with copying all the example datasets into a temporary examples folder so the examples can easily be run.
At this time the example makefile supports OS X or Linux, there is limited Windows support, but this is a work in progress.
To compile the GRT and the examples using the makefile:
- Check to make sure make is installed on your machine (open terminal and type make -version and you should see some version info if make is installed)
- Open terminal and cd into the build folder
- Type make in the terminal window
- GNU make should now compile the GRT and all the GRT examples
- You can then use the GRT static library in your own projects (look for the libgrt.a file in the GRTBuild folder)
- You can also run any of the GRT examples, simply cd into the examples folder in the build folder and type ./ExampleName to run any of the examples (where ExampleName is the name of the example you want to run)
Setting up the GRT in XCode
To add the GRT to your c++ project in XCode either:
- In XCode, select File -> Add Files to "NAME_OF_YOUR_PROJECT", then select the folder called GRT located in the main gesture-recognition-toolkit folder
- in Finder, drag the folder called GRT located in the main gesture-recognition-toolkit folder into the XCode src folder (normally located on the left-hand side of the main XCode GUI)
After you have added the GRT to you project you can then use any of the GRT modules or functions by including the main GRT header file to your project.