CompilePlugins.wiki - Vaa3D/Vaa3D_Wiki GitHub Wiki

Content

How to compile a plugin and run on the Vaa3D platform

Follow the instructions below for different operating systems.

Mac

  1. Download Qt 4.5.2 or a newer Qt version. Compile the “Release” version and install it by run the following commands in a Terminal window.
cd <unzipped_qt_source_code_folder>
./configure
make
sudo make install

If you would like to Qt quickly, you may replace the two middle commands as

./configure -nomake examples
make -j4 #or -j2, -j8, -j16... depending on how many CPUs your machine has 

You should then set the environment variable to make 'qmake' detected in your search path.

  1. Enter the folder that contains your Vaa3D plugin source code and the Qt project file “abc.pro”, - suppose “abc.pro” is the project file name. Run the following commands
qmake abc.pro
make
# copy the compiled plugin dynamic library file, which should have a name similar to “abc.dylib”, to a subfolder (say “my_abc”) under the “plugins” folder where you the Vaa3D program installed (typically “/Applications/vaa3d”).
cp abc.dylib <vaa3d_executable_plugins_folder>
  1. Launch Vaa3D program, and you should see a new sub-menu in the plugin menu, called “my_abc”, and you can find the “abc” plugin there.

  2. If you already launch Vaa3D before you build the plugin, you don’t need to re-start Vaa3D. Instead, you click the plugin menu and choose “Rescan plugins”, and you should find the sub-menu.

Trouble-shooting

If you follow the above instructions but cannot see the full drop-down menu-list in the sub-menu “my_abc”, you need to check

  1. your Qt version,
  2. the Release or Debug version in your compilation.

You can also try one of the Vaa3D plugin examples. These examples have been tested on many machines and different environments. If they cannot work, you may need to adjust the configuration of Qt and/or the compiling setting on your machine.

Linux

Similar to Mac instructions above, except that the extension of the dynamic library file will be different and the typical Vaa3D folder is the one where unzip the installer.

Trouble-shooting (especially for Ubuntu)

For Ubuntu, since many times the g++ and Qt libraries are not installed by default, you may need to ensure you have the correct compiling environment.

Windows

MinGW compiler

MinGW used to be 32bit-only compiler, but was recently upgraded to 64bit. The following instructions apply to 32bit MinGW, but may also work for 64bit.

You can download Qt (e.g. 4.4.3) from Nokia’s official Qt website. Compile the “Release” version and install it by run the following commands in a Terminal window. (i.e. first run “./configure”, followed by “make” and “sudo make install”). Then use the “make”, or “mingw32-make”, in a similar way like the above Mac and Linux environment.

Visual Studio / Visual C++ / Visual C++ Express compilers

  1. Download Qt 4.6 (or whatever latest version) from the following website http://code.google.com/p/qt-msvc-installer/ . Ensure that if you have a 32bit system, you will need the 32bit installer; if you have a 64bit Windows system, you should download the 64bit installer. (Note: we recommend you use the Qt 4.7.2 binary downloadable from here https://qt-msvc-installer.googlecode.com/files/qt-win64-opensource-4.7.2-vs2008.exe as newer versions of Qt for Windows, e.g. 4.8, seemingly has changed the plugin interface which makes our plugins difficult to unload and re-instantiate!)

  2. Add Qt’s bin directory to your system PATH environment variable, so that on a command line window you can find “qmake” command.

  3. Select and run the 32bit or 64bit command line Terminal in the Visual Studio 2008 folder. This will give you a command line window. Then run the following command

qmake abc.pro # assuming abc.pro is the Qt project name for your plugin.
nmake -f Makefile.Release  # This should compile the plugin.

You may also use the following command to generate a vcproj file, and then use the Visual Studio instead of the command line to build. This is similar to the building of main Vaa3D program.

qmake -tp vc abc.pro # assuming abc.pro is the Qt project name for your plugin.

Since a plugin (e.g. Vaa3D-Neuron2 plugin) may have different dependency of some particular libraries, which will have different locations under Windows from Mac/Linux, you may need to adjust the location(s) the Vaa3D source code as well as these libraries in the respective .pro file(s), before you run the above commands to generate the Visual Studio project files.

  1. Then you can copy the compiled plugin dynamic library file, which should have a name similar to “abc.dll”, to a subfolder (say “my_abc”) under the “plugins” folder where you the Vaa3D program installed (or unzipped).

  2. Launch Vaa3D program, and you should see a new sub-menu in the plugin menu, called “my_abc”, and you can find the “abc” plugin there.

Of note, if you already launch Vaa3D before you build the plugin, you don’t need to re-start Vaa3D. Instead, you click the plugin menu and choose “Rescan plugins”, and you should find the sub-menu.

Trouble-shooting

If you follow the above instructions but cannot see the full drop-down menu-list in the sub-menu “my_abc”, you need to check your Qt version, the Release or Debug version in your compilation. You can also try one of the Vaa3D plugin examples. These examples have been tested on many machines and different environments. If they cannot work, you may need to adjust the configuration of Qt and/or the compiling setting on your machine.

CMake

If you are using CMake, the compilation will be more sophisticated to explain. You can check out the open-source Vaa3D-ITK project source code and follow the instruction in the respective README file. You may directly contact us if you are interested in this topic.

⚠️ **GitHub.com Fallback** ⚠️