Difference between revisions of "AnyWave:DeveloperCorner"

From WikiMEG
Jump to: navigation, search
(Build a reader plugin)
 
(48 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
__NOTOC__
 
=Welcome=
 
=Welcome=
 
This part of the Wiki is dedicated to developers who would like to implement their own plug-ins for AnyWave.<br />
 
This part of the Wiki is dedicated to developers who would like to implement their own plug-ins for AnyWave.<br />
AnyWave is written using the Qt Framework and the Qt plugin mechanism, so a good knowledge of the Qt Framework is required.
+
{| style="text-align: center; margin: auto;"
 
+
|+ Quick Navigation
=The SDK=
+
|-
If you have installed AnyWave on your system, you will find all the required files in the installation folder.<br />
+
| [[File:Menu_matlab_plugin.png|400px|link=AnyWave:MATLAB_Plugin|'''Write a MATLAB Plugin''']] || [[File:Menu_cpp_plugin.png|400px|link=AnyWave:Cpp_Plugin|'''Write a c++ Plugin''']]
==Linux==
+
|-
Build from sources following the instructions on our [https://gitlab.thevirtualbrain.org/anywave Gitlab].<br />
+
| [[File:Menu_matlab_batch.png|400px|link=AnyWave:Plugin_Batch|'''Make your plugin batchable''']] || [[File:Menu_matlab_batch_gui_compatible.png|400px|link=AnyWave:MATLAB_Batch_GUI|'''Make your plugin compatible with the batch GUI of AnyWave''']]
Considering the default installation path, the requires folders to build a plugin are:<br />
+
|}
* '''/usr/local/AnyWave/include'''
+
* '''/usr/local/AnyWave/lib'''
+
==Mac OS==
+
The required folders to build a plugin are:<br />
+
* '''/Applications/AnyWave.app/Contents/include'''
+
* '''/Applications/AnyWave.app/Contents/dylibs'''
+
 
+
==Windows==
+
The required folders to build a plugin are:<br />
+
* '''AnyWave\include'''
+
* '''AnyWave\lib'''
+
 
+
=Basic requirements to build a plugin=
+
We strongly recommend QtCreator as the tool to use which is available along with the Qt open source package you will need to build a plugin. <br/>
+
Download Qt and Qt Creator here: [https://www.qt.io/download Get Qt and Qt Creator] <br/>
+
'''Note about Windows:'''<br/>
+
The Windows version of AnyWave is built with Visual Studio 2017 though, so, if you plan to build a plugin for Windows, consider using Visual Studio along with the Qt VS Addin.<br/>
+
Technically speaking you can build a plugin with QtCreator using another compiler like '''gcc''' or '''clang'''.<br/>
+
You will need to put the runtime DLL files of the chosen compiler into the AnyWave folder after you copied the plugin into the Plugins subdirectory.
+
 
+
==Prepare a project==
+
Every Qt project starts with a .pro file which is the format used by qmake, the tool for building Qt projects.<br/>
+
Building an AnyWave plugin requires that the paths to AnyWave headers and libraries must be set.<br/>
+
A good practice is to set an environment variable called '''AW_ROOT''' that points to the root folder of your AnyWave installation.<br />
+
Example:<br/>
+
<syntaxhighlight lang="text">
+
CONFIG += release warn_off c++11 plugin
+
ROOT=$$(AW_ROOT)
+
# on Mac OS the required folders are located inside the application bundle.
+
macx{
+
ROOT = $$(AW_ROOT)/Contents
+
}
+
INCLUDEPATH += $$ROOT/include
+
LIBS += -L$$ROOT/lib
+
DESTDIR = $$ROOT/Plugins
+
 
+
# Mac OS application has a separated folder for Plugins.
+
macx {
+
DESTDIR = $$ROOT/../../Anywave_Plugins
+
# shared libs on Mac are located in the application bundle.
+
LIBS += -F/Library/Frameworks -L$$ROOT/dylibs
+
}
+
</syntaxhighlight>
+
You may use this file as .pri that you could include in every project you plan to develop:<br/>
+
[http://meg.univ-amu.fr/AnyWave/sdk/plugins.pri Get plugins.pri file]
+
 
+
=Build a reader plugin=
+
As a tutorial, we are going to develop here a reader plugin called "My Reader".<br/>
+
Each Qt project starts with a .pro file which qmake use to compile and link a Qt project.<br/>
+
A Reader plugin is a Qt shared library that should be placed in the Plugins directory of AnyWave.<br/>
+
Let's create a folder in which we will put the files required to build our plugin:<br/>
+
<syntaxhighlight lang="bash">
+
mkdir MyReader && cd MyReader
+
</syntaxhighlight>
+
Now we can create the .pro file for our project:<br>
+
<syntaxhighlight lang="text">
+
# We assume that the plugins.pri file is also in our plugin directory.
+
include(plugins.pri)
+
# The name of our plugin
+
TARGET=MyReader
+
TEMPLATE = lib
+
QT -= gui
+
 
+
# We must link with some AnyWave libs
+
#  AwRW is the AnyWave ReadWrite lib.
+
LIBS += -lAwRW 
+
 
+
HEADERS += MyReader.h
+
SOURCES += MyReader.cpp
+
 
+
</syntaxhighlight>
+
 
+
=Build a signal processing plug-in=
+
==[[AnyWave:WriteMatlabScripted|How to write a MATLAB plug-in]]==
+
===[[AnyWave:MATLAB_API|MATLAB API]]===
+
 
+
==[[AnyWave:WritePythonScripted|How to write a Python Scripted plug-in]]==
+

Latest revision as of 16:14, 21 April 2020

Welcome

This part of the Wiki is dedicated to developers who would like to implement their own plug-ins for AnyWave.

Quick Navigation
Write a MATLAB Plugin Write a c++ Plugin
Make your plugin batchable Make your plugin compatible with the batch GUI of AnyWave