Hi,
Option 1 (sources):
--------------------
In your project you usually call the ctkMacroSetupPlugins() macro, like in
https://github.com/MITK/MITK-ProjectTemplate/blob/master/CMakeLists.txt
Now, you can pass both absolute or relative source code paths to
plug-ins (look at the documentation of the macro and at the contents of
the Plugins/Plugins.cmake file). You should be able to either call the
macro twice (first with a list of absolute source directories pointing
to the external plug-ins, second the usual call containing the relative
paths of your in-project plug-ins) or just put all entries together in
one macro call.
The important "trick" will probably be to tell the CTK macros that the
external plug-ins now also kind of belong to your current project. The
CTK macros use the "GetMyTargetLibraries" macro to determine which
plug-ins belong to the current project and which plug-ins are external
(your own plug-in might have dependencies on external plug-ins and the
macros need to cope with that). So the usual macro looks like this:
https://github.com/MITK/MITK-ProjectTemplate/blob/master/CMakeLists.txt#L321
You will likely have to add another regular expression if the "external"
plug-ins follow another naming scheme. E.g.:
macro(GetMyTargetLibraries all_target_libraries varname)
set(re_ctkplugin "^my_awesomeproject_[a-zA-Z0-9_]+$")
set(re_external_plugin "^my_external_project_[a-zA-Z0-9_]+$")
set(_tmp_list)
list(APPEND _tmp_list ${all_target_libraries})
ctkMacroListFilter(_tmp_list re_ctkplugin re_external_pluginOUTPUT_VARIABLE
${varname})
endmacro()
Note the additional regular expression contained in "re_external_plugin"
which should match the symbolic names of the external plug-ins.
With that, it should be possible to build of these plug-ins within one
build tree.
Option 2 (binaries)
---------------------
The plug-ins and the accompanying CTK CMake macros allow to "share"
pre-compiled plug-ins between projects. However, projects providing
binary plug-ins need some CMake infrastructure for that. CTK and MITK
contain this infrastructure (plug-ins from other projects can depend on
them and integrate them in their custom application). However, the
ProjectTemplate for example does not. This should get you going:
1. Generate a "plugin use file" which will contain CMake variables
holding information about all your project's plug-ins. In MITK, it is
done like this:
https://github.com/MITK/MITK/blob/master/CMakeLists.txt#L766
2. You need to create an "exports" file which contains the plug-in
targets so other projects will be able to link to them. MITK does it
this way:
https://github.com/MITK/MITK/blob/master/CMakeLists.txt#L885 (up to L901).
This exports file needs to be included by one of the "use files",
usually it is included from the <your-project-name>_USE_FILE, e.g.:
3. Your project should provide a "<project>Config.cmake" file which is
read by CMake when external projects use
"find_package(<your-project-name>)" and which sets a CMake variable
pointing to either a global "project use file" which includes the
"plugin use file" from step 1 or just a CMake variable pointing directly
to the "plugin use file". Additionally, this file includes the export
file from step 2:
https://github.com/MITK/MITK/blob/master/MITKConfig.cmake.in#L165
External projects than just do
find_package(<your-project-name>)
include(${<your-project-name>_USE_FILE})
and all the other CTK CMake macros related to plug-ins will pick up the
external plug-in information.
Best,
Sascha
On 11/15/2013 08:13 PM, Federico Milano wrote:
Hi. Do you have any tips about the first option?
Thanks,
Federico
On Wed, Nov 13, 2013 at 6:28 PM, Federico Milano <[email protected]
<mailto:[email protected]>> wrote:
Hi Sacha,
Well, if you could point me the way to do both thing I would be
very grateful. The original question was about the first option,
i.e., how to re-use the plug-in source code from other repo
without copying it to the Plugin directory of the new project, but
I have always wondered how to integrate already compiled plugins.
Thanks,
Fede
On Wed, Nov 13, 2013 at 1:41 PM, Sascha Zelzer
<[email protected] <mailto:[email protected]>>
wrote:
Hi Federico,
do you want to re-use the plug-in source code from the other
repository and compile everything from within one project or
do you want to integrate compiled plug-ins from the other
repository?
- Sascha
On 11/12/2013 08:51 PM, Federico Milano wrote:
Hi. I have a MITK project in a repository and I want to use
in this project some plugins that I have in another
repository. In which cmake file/files of the MITK project can
I find the directories in which the different plugin
directories are included? In other words, how can I add a
directory that is not *<your-project>/Plugins/ *?
Thanks in advance,
Federico
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users