Difference between revisions of "AnyWave:BuildSDK"

From WikiMEG
Jump to: navigation, search
Line 57: Line 57:
 
export MATLAB_ROOT=/usr/local/MATLAB/R2015a
 
export MATLAB_ROOT=/usr/local/MATLAB/R2015a
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
We strongly suggest that you add this bash command to your .bash_profile file so it will be available in your bash environment.<br />
 +
The path in this example is the location where MATLAB 2015a is installed by default on Debian. AnyWave will get the necessary headers and libraries from there.
  
=Software requirements=
+
=Build AnyWave=
A C/C++ compiler is required. Linux and Mac versions of AnyWave were built using the gcc/g++ compiler which is the most common compiler on these platforms.<br />
+
Go to the sdk folder and launch cmake build:
 +
<syntaxhighlight lang="bash">
 +
cd aw-sdk
 +
cmake ../aw-git
 +
make install
 +
</syntaxhighlight>
 +
If cmake failed to find some libraries, like VTK or Qwt you may have to define the default path for them as follow:
 +
<syntaxhighlight lang="bash">
 +
cd aw-sdk
 +
cmake -DVTK_DIR=/path-to-VTK6.3/lib/cmake/vtk-6.3 -DQWT_DIR=/usr/local/qwt-6.1.2 ../aw-git
 +
make install
 +
</syntaxhighlight>
  
The Windows version was built with '''Visual Studio 2008''', so it is strongly advised to use the same IDE to build plug-ins that will run with the Windows version of AnyWave.<br />
+
=Using the SDK to develop plugins=
However, it is possible to rebuild the complete AnyWave application using another C++ compiler and to set that version as the SDK to build plug-ins.<br />
+
After you successfully built AnyWave, you will use the sdk folder as a SDK root folder for plugins.<br />
This choice will raise a binary incompatibility with the distributed Windows package and the developed plug-ins. See AnyWave compatibility section.
+
You must add an environment variable called AWSDK to hold the path to the SDK folder:
 
+
<syntaxhighlight lang="bash">
On Mac OS X, '''XCode''' must be installed to provide access to the gcc/g++ compiler.<br />
+
export AWSDK=/path-to/aw-sdk
'''XCode.app''' is freely available on the App Store.
+
</syntaxhighlight>
 
+
We strongly suggest that you add this line to your .bash_profile file so it will become available in your bash environment.
To successfully build the SDK, at least three software must be installed on the computer:
+
* The Qt4 framework
+
* The VTK library (version 5.4.2 to 5.8 will work)
+
* CMake 2.8 or greater.
+
 
+
==The Qt Framework==
+
Mac Developers can download the Qt framework here: [http://meg.univ-amu.fr/AnyWave/qt-mac-opensource-4.8.5.dmg Qt Framework for Mac]
+
 
+
Linux developers can install the Qt frameworks by installing the qt4-dev-tools package.
+
 
+
Windows developers can download source versions of Qt here: http://download.qt.io/archive/qt/4.8/4.8.6/
+
 
+
Build Qt from source with Visual Studio to match the binary version of AnyWave.
+
 
+
==The VTK Library==
+
Have a look at the [http://www.vtk.org/Wiki/VTK/Configure_and_Build#On_Unix-like_operating_systems VTK Wiki page] to build VTK for your system.
+
 
+
Note that you must build the VTK versions 5.4 to 5.8.
+
 
+
Versions 6.x are not compatible with the current version of AnyWave.
+
 
+
==AnyWave compatibility==
+
When building a plug-in, the developer has two choices:
+
* Build for the currently distributed binary version of AnyWave.
+
* Build for its own AnyWave version built from the sources available on github.
+
 
+
===Plug-ins for the binary distributed package of AnyWave===
+
Pay attention that if the plug-in must work with the distributed binary versions of AnyWave it must match more requirements:
+
* Qt4 must be 4.8.2 to work with the Linux debian packaged version of AnyWave.
+
* Qt4 must be 4.8.1 to 4.8.5 to work with the Mac OS X version.
+
* Qt4 must be 4.8.1 to 4.8.6 to work with the Windows versions. (Note that the Windows version will soon only support 64bit systems)
+
* VTK library must be 5.4.2 to 5.8.xx (VTK 6.x will not work)
+
 
+
The Linux and Mac versions have been built with the gcc compiler and therefore will use the glibc library.<br />
+
On Mac systems, the XCode software must be installed to get access to the gcc compiler.
+
 
+
'''ATTENTION:''' The Windows version of AnyWave was built with Visual Studio 2008. Therefore, the plug-in must also be built using Visual Studio 2008 for binary compatibility.
+
 
+
===Plug-ins for the developer version of AnyWave===
+
If a developer plans to build plug-ins that will stay private, it is up to him/her not to match the requirements previously mentioned.
+
 
+
=Building AnyWave from sources and use it as the SDK=
+
As mentioned before, the developer is free to use the complete AnyWave source code as SDK.<br />
+
The requirements to build AnyWave are the same than for the SDK.<br />
+
Follow the instructions available when cloning [https://github.com/anywave/anywave the anywave repository] to build AnyWave.
+
 
+
=Choose the SDK folder=
+
The first thing to do is to create a build folder with an explicit name, for example: '''AwSDK''', that will be the root of the SDK.<br />
+
 
+
We will consider for the following explanations that the folder is named '''AwSDK''' and is located in '''/home/user/Dev/AwSDK'''<br />
+
We will consider that the git repository was cloned in a folder named '''AwSDK_src'''
+
 
+
==Run cmake==
+
Open a terminal and go to the SDK folder:<br />
+
''cd /home/user/Dev/AwSDK''
+
 
+
Launch cmake from the source repository:<br />
+
''cmake ../AwSDK_src''
+
 
+
If Qt and VTK were successfully detected, then type:<br />
+
''make install''
+
 
+
This will build install headers and libraries in the AwSDK folder.<br />
+
You are ready to build a plug-in.
+

Revision as of 16:24, 1 April 2016

The following instructions will guide you to build AnyWave from the git repository, on Debian Jessie.
This can also be applied to Mac OS Systems (although you will need to find the corresponding packages) if your are using repositories like homebrew.

Prepare to build

AnyWave requires some librairies and tools to be installed on your system before trying to build it.
Use the following command to get the required packages:

sudo apt-get install svn git cmake qt5-default libqt5-dev libvtk6-dev libvtk6.1

VTK

The VTK library 6.x is required. The debian package may be built using qt4 not qt5, so you may have to compile VTK by yourself using qt5.
Download VTK 6.3.0 here
Uncompress the archive and make a separate folder to build it.
Use cmake with variables to add Qt Support and Qt5 path:

cd /path/to/VTK-Release-qt5.2.1-build
cmake -DVTK_QT_VERSION:STRING=5 \
     -DQT_QMAKE_EXECUTABLE:PATH=/path/to/qt5.2.1-install/5.2.1/gcc_64/bin/qmake \
     -DVTK_Group_Qt:BOOL=ON \
     -DCMAKE_PREFIX_PATH:PATH=/path/to/qt.5.2.1-install/5.2.1/gcc_64/lib/cmake  \
     -DBUILD_SHARED_LIBS:BOOL=ON
     /path/to/VTK

This will build VTK with the current Qt 5.2.1 version installed. The VTK libraries will be built as shared libraries.

QWT

The Qwt library is also required to build AnyWave. The available debian package might contain a version built with qt4, not qt5. So you may have to compile the library yourself using qt5 libraries.
Get the sources:

svn checkout svn://svn.code.sf.net/p/qwt/code/branches/qwt-6.1 qwt6.1

Build with the default options:

cd qwt6.1
qmake qwt.pro
sudo make install

This should build qwt as a shared library and install it to /usr/local/qwt-6.1.2

Clone the repository

clone the git repo in a folder:

git clone https://github.com/anywave aw-git

Now make a folder that will become the root folder for the SDK:

mkdir aw-sdk

MATLAB support

AnyWave can run MATLAB scripts which are bundled in a plug-in. To do so, the MATLAB support must be built.
This requires MATLAB to be installed on the computer.
If you want to build the MATLAB support, you must define an environment variable called MATLAB_ROOT before starting to build AnyWave:

export MATLAB_ROOT=/usr/local/MATLAB/R2015a

We strongly suggest that you add this bash command to your .bash_profile file so it will be available in your bash environment.
The path in this example is the location where MATLAB 2015a is installed by default on Debian. AnyWave will get the necessary headers and libraries from there.

Build AnyWave

Go to the sdk folder and launch cmake build:

cd aw-sdk
cmake ../aw-git
make install

If cmake failed to find some libraries, like VTK or Qwt you may have to define the default path for them as follow:

cd aw-sdk
cmake -DVTK_DIR=/path-to-VTK6.3/lib/cmake/vtk-6.3 -DQWT_DIR=/usr/local/qwt-6.1.2 ../aw-git
make install

Using the SDK to develop plugins

After you successfully built AnyWave, you will use the sdk folder as a SDK root folder for plugins.
You must add an environment variable called AWSDK to hold the path to the SDK folder:

export AWSDK=/path-to/aw-sdk

We strongly suggest that you add this line to your .bash_profile file so it will become available in your bash environment.