Difference between revisions of "Fixing external projects"

From mitk.org
Jump to navigation Jump to search
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
If you generated a MITK project using the [[BundleGenerator]], your projects build system probably needs a couple of tweaks to work with the new CTK-based [[BlueBerry]].
+
If you generated a MITK project using the BundleGenerator, your projects build system probably needs a couple of tweaks to work with the new CTK-based [[BlueBerry]].
  
 
* Your custom executable needs a different set of include directories. The new variables to use are:
 
* Your custom executable needs a different set of include directories. The new variables to use are:
+
 
<pre><nowiki>
+
<syntaxhighlight lang="cmake">
 
INCLUDE_DIRECTORIES(
 
INCLUDE_DIRECTORIES(
 
   ${org_blueberry_osgi_INCLUDE_DIRS}
 
   ${org_blueberry_osgi_INCLUDE_DIRS}
Line 10: Line 10:
 
   ${mbilog_INCLUDE_DIRS}
 
   ${mbilog_INCLUDE_DIRS}
 
)
 
)
</nowiki></pre>
+
</syntaxhighlight>
  
 
* The TARGET_LINK_LIBRARIES command for your executable should now look like
 
* The TARGET_LINK_LIBRARIES command for your executable should now look like
+
 
<pre><nowiki>
+
<syntaxhighlight lang="cmake">
 
TARGET_LINK_LIBRARIES(<executable-target> org_blueberry_osgi)
 
TARGET_LINK_LIBRARIES(<executable-target> org_blueberry_osgi)
</nowiki></pre>
+
</syntaxhighlight>
 
 
  
 
* Your applications .ini file needs an additional entry:
 
* Your applications .ini file needs an additional entry:
 
   
 
   
<pre><nowiki>
+
<syntaxhighlight lang="cmake">
 
BlueBerry.provisioning=@MITK_PLUGIN_PROVISIONING_FILE@
 
BlueBerry.provisioning=@MITK_PLUGIN_PROVISIONING_FILE@
</nowiki></pre>
+
</syntaxhighlight>
 
 
  
 
* Your executables .cpp file usually contains a statement like
 
* Your executables .cpp file usually contains a statement like
 
   
 
   
<pre><nowiki>
+
<syntaxhighlight lang="cpp">
 
#include <org.blueberry.osgi/src/application/berryStarter.h>
 
#include <org.blueberry.osgi/src/application/berryStarter.h>
</nowiki></pre>
+
</syntaxhighlight>
  
* which must be changed to
+
which must be changed to<br \>
+
 
<pre><nowiki>
+
<syntaxhighlight lang="cpp">
 
#include <berryStarter.h>
 
#include <berryStarter.h>
</nowiki></pre>
+
</syntaxhighlight>
 
 
  
 
* Further, your executables .cpp file  must now create a QApplication instance. So add the include directive  "#include <QApplication>" and add the following lines at the  beginning of your main method:
 
* Further, your executables .cpp file  must now create a QApplication instance. So add the include directive  "#include <QApplication>" and add the following lines at the  beginning of your main method:
 
   
 
   
<pre><nowiki>
+
<syntaxhighlight lang="cpp">
 
// Create a QApplication instance first
 
// Create a QApplication instance first
 
QApplication myApp(argc, argv);
 
QApplication myApp(argc, argv);
 
myApp.setApplicationName("MyApp");
 
myApp.setApplicationName("MyApp");
 
myApp.setOrganizationName("My Organization");
 
myApp.setOrganizationName("My Organization");
</nowiki></pre>
+
</syntaxhighlight>
 +
 
 +
* On Windows, you have to fix the batch files used for starting Visual Studio or the application itself. The files are called start<project-name>.bat.in and startVS2008.bat.in and are located in your projects source directory. In both files, the line which sets the PATH variable should now look like:
 +
 +
<syntaxhighlight lang="cpp">
 +
PATH=@MITK_RUNTIME_PATH@;@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/@VS_BUILD_TYPE@;%PATH%
 +
</syntaxhighlight>
 +
 
 +
Don't forget to re-run CMake after editing the files.
 +
 
 +
* Usually, your external project contains also [[BlueBerry]] bundles. You must fix them by following the instructions provided [[Fixing legacy BlueBerry bundles|here]].

Latest revision as of 13:49, 1 December 2014

If you generated a MITK project using the BundleGenerator, your projects build system probably needs a couple of tweaks to work with the new CTK-based BlueBerry.

  • Your custom executable needs a different set of include directories. The new variables to use are:

<syntaxhighlight lang="cmake"> INCLUDE_DIRECTORIES(

 ${org_blueberry_osgi_INCLUDE_DIRS}
 ${Poco_INCLUDE_DIRS}
 ${mbilog_INCLUDE_DIRS}

) </syntaxhighlight>

  • The TARGET_LINK_LIBRARIES command for your executable should now look like

<syntaxhighlight lang="cmake"> TARGET_LINK_LIBRARIES(<executable-target> org_blueberry_osgi) </syntaxhighlight>

  • Your applications .ini file needs an additional entry:

<syntaxhighlight lang="cmake"> BlueBerry.provisioning=@MITK_PLUGIN_PROVISIONING_FILE@ </syntaxhighlight>

  • Your executables .cpp file usually contains a statement like

<syntaxhighlight lang="cpp">

  1. include <org.blueberry.osgi/src/application/berryStarter.h>

</syntaxhighlight>

which must be changed to

<syntaxhighlight lang="cpp">

  1. include <berryStarter.h>

</syntaxhighlight>

  • Further, your executables .cpp file must now create a QApplication instance. So add the include directive "#include <QApplication>" and add the following lines at the beginning of your main method:

<syntaxhighlight lang="cpp"> // Create a QApplication instance first QApplication myApp(argc, argv); myApp.setApplicationName("MyApp"); myApp.setOrganizationName("My Organization"); </syntaxhighlight>

  • On Windows, you have to fix the batch files used for starting Visual Studio or the application itself. The files are called start<project-name>.bat.in and startVS2008.bat.in and are located in your projects source directory. In both files, the line which sets the PATH variable should now look like:

<syntaxhighlight lang="cpp"> PATH=@MITK_RUNTIME_PATH@;@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/@VS_BUILD_TYPE@;%PATH% </syntaxhighlight>

Don't forget to re-run CMake after editing the files.
  • Usually, your external project contains also BlueBerry bundles. You must fix them by following the instructions provided here.