Qt Script template is a CMake project to create your classes 'scriptable'. If you have library with some QObject or non-QObject based classes, it's the fatest way to create QtScript bindings.

First of all you need QtScriptGenerator (hereinafter QSG) from my repository:
Qt Code:
  1. git clone git://gitorious.org/~asvil/qt-labs/asvils-qtscriptgenerator.git qtscriptgenerator
  2. cd qtscriptgenerator
To copy to clipboard, switch view to plain text mode 
Than make QSG:
Qt Code:
  1. cd generator
  2. qmake
  3. make
To copy to clipboard, switch view to plain text mode 
Optionally
Create Qt Modules bindings.
Execute QSG without parameters, than make plugin projects:
Qt Code:
  1. ./generator
  2. cd ../qtbindings
  3. qmake && make
To copy to clipboard, switch view to plain text mode 
If you don't have all Qt modules, make subdirs particularly:
Qt Code:
  1. cd ../qtbindings/qtscript_core
  2. qmake && make
  3. #etc
To copy to clipboard, switch view to plain text mode 

After this manipulation, download qtscriptemplate:
Qt Code:
  1. git clone git://gitorious.org/qtscripttemplate/qtscripttemplate.git qtscripttemplate
  2. cd qtscripttemplate
  3. mkdir include
  4. mkdir lib
To copy to clipboard, switch view to plain text mode 
Place your include files into 'include', your libraries into 'lib'.
Edit three files in 'buildplugin' subdirectory:
CMakeLists.txt
plugin_build.txt.in
plugin_typesystem.xml.in

In CMakeLists.txt replace uncomment two strings and print your plugin project names:
Qt Code:
  1. # Plugin file name
  2. set (PROJECT YOUR_SCRIPT_PLUGIN_NAME)
  3. # Extension name for method QScriptEngine::importExtension().
  4. set (QS_PACKAGE_NAME YOUR_PACKAGE_NAME)
To copy to clipboard, switch view to plain text mode 
Add Qt Modules your library using in CMake project, for example:
set(QT_USE_QTNETWORK TRUE)

In plugin_build.txt.in uncomment Qt modules your library using.

Edit plugin_typesystem.xml.in (read more here):
For namecpaces add tag: <namespace-type name="YourNamespace"/>
For enums:
<enum-type name="Namespace::SomeEnum"/>
or
<enum-type name="SomeClass::SomeEnum"/>
For QObject based classes with Q_OBJECT macro:
<object-type name="QObjectSubclass"/>
For non-QObject based classes, haves copy constructor and assignment operator
<value-type name="NonQObjectClass"/>

Than make buildplugin/CMakeLists.txt with this commands, cmake called QSG to generate bindings for your classes:
Qt Code:
  1. cmake buildplugin -DCMAKE_BUILD_TYPE=Release
  2. make
To copy to clipboard, switch view to plain text mode 
'plugins/script' is the output directory for plugin.

For some libraries created appropriate branch: log4qt, ncreport252, qserialdevice. By switching to these branches need only to copy the headers and the library itself.
Example:
Qt Code:
  1. git branch --track origin/qserialdevice
  2. mkdir lib
  3. mkdir include
  4. .....................
  5. # Copy qserialdevice library and headers
  6. .....................
  7. cmake biuldplugin -DCMAKE_BUILD_TYPE=Release
  8. make
  9.  
  10. git branch --track origin/ncreport252
  11. mkdir lib
  12. mkdir include
  13. .....................
  14. # Copy ncreport >= 2.5.2 library and headers
  15. .....................
  16. cmake biuldplugin -DCMAKE_BUILD_TYPE=Release
  17. make
To copy to clipboard, switch view to plain text mode