From user's Wiki!
Revision as of 09:34, 25 February 2011 by Criccobene (Talk | contribs)

Jump to: navigation, search

In order to generate the folder structure and the basic files needed for your new library, run the StartNewModule tool from the installation path.

Create Folders and Templates

1. Specify the name of the new library in the Name field (e.g. MyLib)

2. Specify the path where the new library will be created in the Root path field (e.g. MyProject/MyProject_src/modules)

3. Select Library in the Type combo box

4. Specify in the Toolkit csn file field

5. Press Start New Module

StartNewModule fields for new library

The tool will create a new folder ’MyLib’ in the ’modules’ folder. The content of this folder is shown in

MyLib folder structure

The new library will also be added to the python file

definition of your new library

How to create a solution with my library

1. Edit the python file for the new MyLib library

  • specify all dependencies of the new library. For instance, if your new library will use vtk functions, include vtk in the projects as follows: myLib.AddProjects([baseLib,vtk])
  • specify all library modules. The library module created by default is ’tlFirst’ and includes template files (.cpp and .h) containing one template class. To create your own classes it is suggested to make a copy of the ’tlFirst’ folder, rename it (e.g. ’tlMyClass’), rename the source and include files (e.g. ’tlMyClass.cpp’ and ’tlMyClass.h’) contained in the folder and include it in the library modules, as follows: myLib.AddLibraryModules([“tlMyClass]“).

2. Open CSnake, specify the new MyLib library as the source file and generate the MyLib solution

  • press Update and select the Instance mylib
  • press Create CMake files and Run CMake
  • press Launch IDE
StartNewModule fields for new library

3. Implement your class

In the Visual Studio solution of your new module edit tlMyClass.cpp and tlMyClass.h to implement your class (e.g. ’MyClass’)

4. Implement your application

  • Rename the ’tlAppFirst’ folder and the ’tlAppFirst.cpp’ with the name of your application (e.g. ’tlMyApp’)
  • Edit ’’ and include your application: myLibApps.AddApplications([“tlMyApp”])
  • Open CSnake, specify as CSnake file, and press update
  • press Create CMake files and Run CMake
  • press Launch IDE
  • compile the solution in Visual Studio
Configuration of Csnake for applications

Next/Previous Steps: