diff --git a/.gitattributes b/.gitattributes
index b3de23e58d..51a00f8038 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,65 +1,68 @@
.git* export-ignore
.hooks* export-ignore
.mailmap export-ignore
# Set general file size limit on all files
* hooks.MaxObjectKiB=1024
*.bat -crlf
*.bin -crlf
*.blend -crlf
*.bmp -crlf
*.cpt -crlf
*.gif -crlf
*.icns -crlf
*.ico -crlf
*.jpeg -crlf
*.jpg -crlf
*.mha -crlf
*.odg -crlf
*.pbxproj -crlf
*.pdf -crlf
*.plist -crlf
*.png -crlf
*.ppt -crlf
*.pptx -crlf
*.raw -crlf
*.vtk -crlf
*.xcf -crlf
*.xpm -crlf -diff
*.sh crlf=input
*.sh.in crlf=input
configure crlf=input
cvsrmvend crlf=input
imcp crlf=input
imglob crlf=input
imln crlf=input
immv crlf=input
imrm crlf=input
imtest crlf=input
install-sh crlf=input
newalpha crlf=input
newversion crlf=input
remove_ext crlf=input
vxl_doxy.pl crlf=input
zap.pl crlf=input
*.c whitespace=tab-in-indent,no-lf-at-eof copyright=mitk-license hooks.style=KWStyle,uncrustify
*.cpp whitespace=tab-in-indent,no-lf-at-eof copyright=mitk-license hooks.style=KWStyle,uncrustify
*.h whitespace=tab-in-indent,no-lf-at-eof copyright=mitk-license hooks.style=KWStyle,uncrustify
*.cxx whitespace=tab-in-indent,no-lf-at-eof copyright=mitk-license hooks.style=KWStyle,uncrustify
*.hxx whitespace=tab-in-indent,no-lf-at-eof copyright=mitk-license hooks.style=KWStyle,uncrustify
*.txx whitespace=tab-in-indent,no-lf-at-eof copyright=mitk-license hooks.style=KWStyle,uncrustify
*.txt whitespace=tab-in-indent,no-lf-at-eof
*.cmake whitespace=tab-in-indent,no-lf-at-eof
# The Microservices use an apache copyright
Core/Code/CppMicroServices/**/*.c copyright=apache-license
Core/Code/CppMicroServices/**/*.cpp copyright=apache-license
Core/Code/CppMicroServices/**/*.h copyright=apache-license
# There is no need to check files in the utilities directory for copyright
Utilities/** -copyright
+Applications/PluginGenerator/PluginTemplate/src/**/*.h -copyright
+Applications/PluginGenerator/PluginTemplate/src/**/*.cpp -copyright
+Applications/PluginGenerator/ProjectTemplate/Apps/TemplateApp/TemplateApp.cpp -copyright
# ExternalData content links must have LF newlines
*.md5 crlf=input
diff --git a/Applications/PluginGenerator/LICENSE.txt b/Applications/PluginGenerator/LICENSE.txt
index 8761edc246..07c13ca843 100644
--- a/Applications/PluginGenerator/LICENSE.txt
+++ b/Applications/PluginGenerator/LICENSE.txt
@@ -1,29 +1,29 @@
Copyright (c) 2003-2012 German Cancer Research Center, Division of Medical
and Biological Informatics
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- * Neither the name of the German Cancer Research Center, nor the names of
- its contributors may be used to endorse or promote products derived from
+ * Neither the name of the German Cancer Research Center, nor the names of
+ its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
diff --git a/Applications/PluginGenerator/PluginTemplate/documentation/UserManual/Manual.dox b/Applications/PluginGenerator/PluginTemplate/documentation/UserManual/Manual.dox
index c254a2ba83..56feaaae05 100755
--- a/Applications/PluginGenerator/PluginTemplate/documentation/UserManual/Manual.dox
+++ b/Applications/PluginGenerator/PluginTemplate/documentation/UserManual/Manual.dox
@@ -1,19 +1,18 @@
/**
\page $(plugin-target) $(plugin-name)
\image html icon.xpm "Icon of $(plugin-name)"
Available sections:
- \ref $(plugin-target)Overview
\section $(plugin-target)Overview
Describe the features of your awesome plugin here
- Increases productivity
- Creates beautiful images
- Generates PhD thesis
- Brings world peace
*/
-
diff --git a/Applications/PluginGenerator/PluginTemplate/documentation/doxygen/modules.dox b/Applications/PluginGenerator/PluginTemplate/documentation/doxygen/modules.dox
index 4a1244f9a8..9dcb60e028 100644
--- a/Applications/PluginGenerator/PluginTemplate/documentation/doxygen/modules.dox
+++ b/Applications/PluginGenerator/PluginTemplate/documentation/doxygen/modules.dox
@@ -1,16 +1,16 @@
/**
\defgroup $(plugin-target) $(plugin-symbolic-name)
\ingroup MITKPlugins
\brief Describe your plugin here.
-
+
*/
/**
\defgroup $(plugin-target)_internal Internal
\ingroup $(plugin-target)
\brief This subcategory includes the internal classes of the $(plugin-symbolic-name) plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
*/
diff --git a/Applications/PluginGenerator/PluginTemplate/files.cmake b/Applications/PluginGenerator/PluginTemplate/files.cmake
index ad0fe7df61..c1b3369574 100644
--- a/Applications/PluginGenerator/PluginTemplate/files.cmake
+++ b/Applications/PluginGenerator/PluginTemplate/files.cmake
@@ -1,43 +1,42 @@
set(SRC_CPP_FILES
)
set(INTERNAL_CPP_FILES
$(activator-file-name).cpp
$(view-file-name).cpp
)
set(UI_FILES
src/internal/$(view-file-name)Controls.ui
)
set(MOC_H_FILES
src/internal/$(activator-file-name).h
src/internal/$(view-file-name).h
)
# list of resource files which can be used by the plug-in
# system without loading the plug-ins shared library,
# for example the icon used in the menu and tabs for the
# plug-in views in the workbench
set(CACHED_RESOURCE_FILES
resources/icon.xpm
plugin.xml
)
# list of Qt .qrc files which contain additional resources
# specific to this plugin
set(QRC_FILES
)
set(CPP_FILES )
foreach(file ${SRC_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/${file})
endforeach(file ${SRC_CPP_FILES})
foreach(file ${INTERNAL_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/internal/${file})
endforeach(file ${INTERNAL_CPP_FILES})
-
diff --git a/Applications/PluginGenerator/PluginTemplate/plugin.xml b/Applications/PluginGenerator/PluginTemplate/plugin.xml
index 51215b975c..edacef0b6f 100644
--- a/Applications/PluginGenerator/PluginTemplate/plugin.xml
+++ b/Applications/PluginGenerator/PluginTemplate/plugin.xml
@@ -1,11 +1,11 @@
-
+
diff --git a/Applications/PluginGenerator/PluginTemplate/src/internal/QmitkTemplateView.h b/Applications/PluginGenerator/PluginTemplate/src/internal/QmitkTemplateView.h
index 40ffd7bac8..73d8c90fde 100644
--- a/Applications/PluginGenerator/PluginTemplate/src/internal/QmitkTemplateView.h
+++ b/Applications/PluginGenerator/PluginTemplate/src/internal/QmitkTemplateView.h
@@ -1,51 +1,50 @@
$(license)
#ifndef $(view-file-name)_h
#define $(view-file-name)_h
#include
#include
#include "ui_$(view-file-name)Controls.h"
-/*!
+/**
\brief $(view-class-name)
\warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation.
- \sa QmitkFunctionality
+ \sa QmitkAbstractView
\ingroup ${plugin_target}_internal
*/
class $(view-class-name) : public QmitkAbstractView
{
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT
public:
static const std::string VIEW_ID;
- virtual void CreateQtPartControl(QWidget *parent);
-
protected slots:
/// \brief Called when the user clicks the GUI button
void DoImageProcessing();
protected:
+ virtual void CreateQtPartControl(QWidget *parent);
+
virtual void SetFocus();
/// \brief called by QmitkFunctionality when DataManager's selection has changed
virtual void OnSelectionChanged( berry::IWorkbenchPart::Pointer source,
const QList& nodes );
Ui::$(view-file-name)Controls m_Controls;
};
#endif // $(view-file-name)_h
-
diff --git a/BlueBerry/Bundles/org.blueberry.compat/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.compat/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..144ea564d0
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.compat/documentation/doxygen/modules.dox
@@ -0,0 +1,18 @@
+/**
+ \defgroup org_blueberry_compat org.blueberry.compat
+ \ingroup BlueBerryPlugins
+
+ \brief Track CTK plug-ins and register their extensions and extension-points.
+
+ This plug-in listens to CTK plug-in events and populates the BlueBerry extension
+ registry with entries from the plug-ins embedded plugin.xml files.
+*/
+
+/**
+ \defgroup org_blueberry_compat_internal Internal
+ \ingroup org_blueberry_compat
+
+ \brief This subcategory includes the internal classes of the org.blueberry.compat plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.commands/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.core.commands/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..736f33263a
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.core.commands/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_blueberry_core_commands org.blueberry.core.commands
+ \ingroup BlueBerryPlugins
+
+ \brief Provides an infrastructure for executing commands in the Workbench.
+
+*/
+
+/**
+ \defgroup org_blueberry_core_commands_internal Internal
+ \ingroup org_blueberry_core_commands
+
+ \brief This subcategory includes the internal classes of the org.blueberry.core.commands plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.expressions/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.core.expressions/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..000328274f
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.core.expressions/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_blueberry_core_expressions org.blueberry.core.expressions
+ \ingroup BlueBerryPlugins
+
+ \brief Evaluates complex expressions defined in XML.
+
+*/
+
+/**
+ \defgroup org_blueberry_core_expressions_internal Internal
+ \ingroup org_blueberry_core_expressions
+
+ \brief This subcategory includes the internal classes of the org.blueberry.core.expressions plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.jobs/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.core.jobs/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..176b176704
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.core.jobs/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_blueberry_core_jobs org.blueberry.core.jobs
+ \ingroup BlueBerryPlugins
+
+ \brief A generic jobs API for running background tasks in a BlueBerry application.
+
+*/
+
+/**
+ \defgroup org_blueberry_core_jobs_internal Internal
+ \ingroup org_blueberry_core_jobs
+
+ \brief This subcategory includes the internal classes of the org.blueberry.core.jobs plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.core.runtime/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.core.runtime/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..5508603d74
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.core.runtime/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_blueberry_core_runtime org.blueberry.core.runtime
+ \ingroup BlueBerryPlugins
+
+ \brief Provides runtime services like preferences.
+
+*/
+
+/**
+ \defgroup org_blueberry_core_runtime_internal Internal
+ \ingroup org_blueberry_core_runtime
+
+ \brief This subcategory includes the internal classes of the org.blueberry.core.runtime plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.osgi/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.osgi/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..da7c1015aa
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.osgi/documentation/doxygen/modules.dox
@@ -0,0 +1,18 @@
+/**
+ \defgroup org_blueberry_osgi org.blueberry.osgi
+ \ingroup BlueBerryPlugins
+
+ \brief The partial BlueBerry OSGi implementation.
+
+ Most of the functionality of this plug-in has been superseded by the CTK Plugin Framework
+ and is only kept for backwards compatibility.
+*/
+
+/**
+ \defgroup org_blueberry_osgi_internal Internal
+ \ingroup org_blueberry_osgi
+
+ \brief This subcategory includes the internal classes of the org.blueberry.osgi plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.solstice.common/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.solstice.common/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..913ef08927
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.solstice.common/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_blueberry_solstice_common org.blueberry.solstice.common
+ \ingroup BlueBerryPlugins
+
+ \brief Provides common functionality like status handling of method calls.
+
+*/
+
+/**
+ \defgroup org_blueberry_solstice_common_internal Internal
+ \ingroup org_blueberry_solstice_common
+
+ \brief This subcategory includes the internal classes of the org.blueberry.solstice.common plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.test/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.test/documentation/doxygen/modules.dox
index 15d1afa735..f15b97ba2a 100644
--- a/BlueBerry/Bundles/org.blueberry.test/documentation/doxygen/modules.dox
+++ b/BlueBerry/Bundles/org.blueberry.test/documentation/doxygen/modules.dox
@@ -1,16 +1,16 @@
/**
\defgroup org_blueberry_test org.blueberry.test
\ingroup BlueBerryPlugins
- \brief Describe your plugin here.
+ \brief Testing infrastructure for running unit tests defined in BlueBerry plug-ins.
*/
/**
\defgroup org_blueberry_test_internal Internal
\ingroup org_blueberry_test
\brief This subcategory includes the internal classes of the org.blueberry.test plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
*/
diff --git a/BlueBerry/Bundles/org.blueberry.ui.qt.log/documentation/UserManual/blueberrylogview.dox b/BlueBerry/Bundles/org.blueberry.ui.qt.log/documentation/UserManual/blueberrylogview.dox
index dbde26a7f5..92453eb6f4 100644
--- a/BlueBerry/Bundles/org.blueberry.ui.qt.log/documentation/UserManual/blueberrylogview.dox
+++ b/BlueBerry/Bundles/org.blueberry.ui.qt.log/documentation/UserManual/blueberrylogview.dox
@@ -1,16 +1,16 @@
/**
-\page org_blueberry_ui_qt_log The Logging Module
+\page org_blueberry_ui_qt_log The Logging Plugin
\image html Logging.png "Icon of the Module"
-The Plug-In "Logging Module" records all logging output of events and progress as specified in the source code with time of occurence, level of importance (Info, Warning, Error, Fatal, Debug), the message given and where it happens. The logging starts once you activate the Plug-In in your main application. A screenshot of the main view of the Logging Module is shown next.
+This plug-in records all logging output of events and progress as specified in the source code with time of occurence, level of importance (Info, Warning, Error, Fatal, Debug), the message given and where it happens. The logging starts once the plug-is started. A screenshot of the provided Logging view is shown next.
\image html LogView.png "Screenshot of the Logging Module"
There are different features available in the view. The filter text field allows for searching all log events containing a certain substring. Using the button "Copy to clipboard" on the bottom right you can copy the current content of the logging view to your clipboard. This enables you to insert the logging information to any text processing application.
You can also show more information on every logging message by activating the two checkboxes. In the simple view, leaving both checkboxes unchecked, you'll see logging messages and logging levels. A brief description of the logging levels can be found in the \ref LoggingPage "logging concept documentation". The checkbox "Category" adds a column for the category. The checkbox "Show Advanced Field" shows method, filename and linenumber where the logging message was emitted as well as the running time of the application. The next figure shows all information which can be shown in the Logging Module.
\image html LogViewExplain.png "Details on the Vizualized Logging Information"
-*/
\ No newline at end of file
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.ui.qt.log/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.ui.qt.log/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..6a7ace0f6b
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.ui.qt.log/documentation/doxygen/modules.dox
@@ -0,0 +1,16 @@
+/**
+ \defgroup org_blueberry_ui_qt_log org.blueberry.ui.qt.log
+ \ingroup BlueBerryPlugins
+
+ \brief Provides a Logging View for BlueBerry applications.
+
+*/
+
+/**
+ \defgroup org_blueberry_ui_qt_log_internal Internal
+ \ingroup org_blueberry_ui_qt_log
+
+ \brief This subcategory includes the internal classes of the org.blueberry.ui.qt.log plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.ui.qt.objectinspector/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.ui.qt.objectinspector/documentation/doxygen/modules.dox
index 9a37cee3c1..b54679971a 100644
--- a/BlueBerry/Bundles/org.blueberry.ui.qt.objectinspector/documentation/doxygen/modules.dox
+++ b/BlueBerry/Bundles/org.blueberry.ui.qt.objectinspector/documentation/doxygen/modules.dox
@@ -1,16 +1,17 @@
/**
\defgroup org_blueberry_ui_qt_objectinspector org.blueberry.ui.qt.objectinspector
\ingroup BlueBerryPlugins
- \brief Describe your plugin here.
+ \brief A debugging plug-in providing a BlueBerry View for inspecting berry::Object
+ instances and their associated smart-pointers.
*/
/**
\defgroup org_blueberry_ui_qt_objectinspector_internal Internal
\ingroup org_blueberry_ui_qt_objectinspector
\brief This subcategory includes the internal classes of the org.blueberry.ui.qt.objectinspector plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
*/
diff --git a/BlueBerry/Bundles/org.blueberry.ui.qt/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.ui.qt/documentation/doxygen/modules.dox
new file mode 100644
index 0000000000..a45832401a
--- /dev/null
+++ b/BlueBerry/Bundles/org.blueberry.ui.qt/documentation/doxygen/modules.dox
@@ -0,0 +1,17 @@
+/**
+ \defgroup org_blueberry_ui_qt org.blueberry.ui.qt
+ \ingroup BlueBerryPlugins
+
+ \brief The Qt dependent user interface plug-in providing support for
+ creating Qt based workbench applications.
+
+*/
+
+/**
+ \defgroup org_blueberry_ui_qt_internal Internal
+ \ingroup org_blueberry_ui_qt
+
+ \brief This subcategory includes the internal classes of the org.blueberry.ui.qt plugin. Other
+ plugins must not rely on these classes. They contain implementation details and their interface
+ may change at any time. We mean it.
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.ui/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.ui/documentation/doxygen/modules.dox
index 8c3525ed7b..65d01619f0 100644
--- a/BlueBerry/Bundles/org.blueberry.ui/documentation/doxygen/modules.dox
+++ b/BlueBerry/Bundles/org.blueberry.ui/documentation/doxygen/modules.dox
@@ -1,17 +1,17 @@
/**
\defgroup org_blueberry_ui org.blueberry.ui
\ingroup BlueBerryPlugins
\brief This is the user interface plugin. It provides a GUI-Toolkit independent framework
- to build an BlueBerry workbench.
+ to build a BlueBerry workbench.
*/
/**
\defgroup org_blueberry_ui_internal Internal
\ingroup org_blueberry_ui
\brief This subcategory includes the internal classes of the org.blueberry.ui plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
-*/
\ No newline at end of file
+*/
diff --git a/BlueBerry/Bundles/org.blueberry.uitest/documentation/doxygen/modules.dox b/BlueBerry/Bundles/org.blueberry.uitest/documentation/doxygen/modules.dox
index 599c765dc4..95c905fe9d 100644
--- a/BlueBerry/Bundles/org.blueberry.uitest/documentation/doxygen/modules.dox
+++ b/BlueBerry/Bundles/org.blueberry.uitest/documentation/doxygen/modules.dox
@@ -1,16 +1,16 @@
/**
\defgroup org_blueberry_uitest org.blueberry.uitest
\ingroup BlueBerryPlugins
- \brief Describe your plugin here.
+ \brief Testing infrastructure for executing unit tests which require a running workbench.
*/
/**
\defgroup org_blueberry_uitest_internal Internal
\ingroup org_blueberry_uitest
\brief This subcategory includes the internal classes of the org.blueberry.uitest plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
*/
diff --git a/BlueBerry/Documentation/CMakeLists.txt b/BlueBerry/Documentation/CMakeLists.txt
index 3114734fc9..e3886382b1 100755
--- a/BlueBerry/Documentation/CMakeLists.txt
+++ b/BlueBerry/Documentation/CMakeLists.txt
@@ -1,86 +1,91 @@
-#
+#
# Variables:
# BLUEBERRY_DOCS_OUTPUT_DIR: documentation output directory (optional)
add_subdirectory(snippets)
find_package(Doxygen)
if(DOXYGEN_FOUND)
option(USE_DOT "Use dot program for generating graphical class diagrams with doxygen, if available" ON)
mark_as_advanced(USE_DOT)
set(HAVE_DOT "NO")
if(DOXYGEN_DOT_EXECUTABLE AND USE_DOT)
set(HAVE_DOT "YES")
endif()
-set(BLUEBERRY_DOCS_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "BlueBerry output directory for all generated documentation.")
-set(BLUEBERRY_DOXYGEN_OUTPUT_DIR ${BLUEBERRY_DOCS_OUTPUT_DIR}/reference/api CACHE INTERNAL "BlueBerry doxygen output directory")
-set(BLUEBERRY_XPDOC_OUTPUT_DIR ${BLUEBERRY_DOCS_OUTPUT_DIR}/reference/extension-points)
+if(NOT BLUEBERRY_DOCS_OUTPUT_DIR)
+ set(BLUEBERRY_DOCS_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+ "BlueBerry output directory for all generated documentation.")
+endif()
+if(NOT BLUEBERRY_DOXYGEN_OUTPUT_DIR)
+ set(BLUEBERRY_DOXYGEN_OUTPUT_DIR ${BLUEBERRY_DOCS_OUTPUT_DIR}/reference/api CACHE INTERNAL
+ "BlueBerry doxygen output directory")
+endif()
+if(NOT BLUEBERRY_XPDOC_OUTPUT_DIR)
+ set(BLUEBERRY_XPDOC_OUTPUT_DIR ${BLUEBERRY_DOCS_OUTPUT_DIR}/reference/extension-points)
+endif()
set(BLUEBERRY_DOXYGEN_TAGFILE_NAME ${BLUEBERRY_DOXYGEN_OUTPUT_DIR}/BlueBerry.tag CACHE INTERNAL "BlueBerry Doxygen tag file")
# This is relative to the working directory of the doxygen command
set(BLUEBERRY_DOXYGEN_STYLESHEET bb_doxygen.css)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${BLUEBERRY_DOXYGEN_STYLESHEET}
${CMAKE_CURRENT_BINARY_DIR}/${BLUEBERRY_DOXYGEN_STYLESHEET} @COPYONLY)
file(RELATIVE_PATH BLUEBERRY_DOXYGEN_XP_RELATIVEDIR ${BLUEBERRY_DOXYGEN_OUTPUT_DIR}/html ${BLUEBERRY_XPDOC_OUTPUT_DIR}/)
set(_doxygen_qt4bundles )
set(_doxygen_bundles )
set(_doxygen_binary_qt4bundles )
set(_doxygen_binary_bundles )
file(GLOB _bundle_dirs RELATIVE "${BLUEBERRY_PLUGINS_SOURCE_DIR}" "${BLUEBERRY_PLUGINS_SOURCE_DIR}/*")
foreach(_bundle_dir ${_bundle_dirs})
string(REGEX MATCH "^\\..*" _matched_hidden "${_bundle_dir}")
if(NOT _matched_hidden)
if(IS_DIRECTORY "${BLUEBERRY_PLUGINS_SOURCE_DIR}/${_bundle_dir}")
string(REGEX MATCH ".*\\.qt.*" _matched "${_bundle_dir}")
if(_matched)
if(QT4_FOUND)
set(_doxygen_qt4bundles "${_doxygen_qt4bundles} \"${BLUEBERRY_PLUGINS_SOURCE_DIR}/${_bundle_dir}\"")
set(_doxygen_binary_qt4bundles "${_doxygen_binary_qt4bundles} \"${BLUEBERRY_PLUGINS_BINARY_DIR}/${_bundle_dir}\"")
endif()
else()
set(_doxygen_bundles "${_doxygen_bundles} \"${BLUEBERRY_PLUGINS_SOURCE_DIR}/${_bundle_dir}\"")
set(_doxygen_binary_bundles "${_doxygen_binary_bundles} \"${BLUEBERRY_PLUGINS_BINARY_DIR}/${_bundle_dir}\"")
endif()
endif()
endif()
endforeach()
# Compile a doxygen input filter for processing CMake scripts
include(FunctionCMakeDoxygenFilterCompile)
FunctionCMakeDoxygenFilterCompile(NAMESPACE "CMake")
configure_file(doxygen.conf.in
${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
-
-configure_file(reference/extension-points/index.dox.in
- ${CMAKE_CURRENT_BINARY_DIR}/reference/extension-points/index.dox)
find_package(Doxygen)
-add_custom_target(BlueBerryDoc
+add_custom_target(BlueBerryDoc
${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${_BlueBerryDoc_depends}
)
-
+
# convert the extension points schema files into html
if(ANT_FOUND AND BLUEBERRY_DOC_TOOLS_DIR)
file(GLOB_RECURSE _plugin_xmls ${BLUEBERRY_PLUGINS_SOURCE_DIR}/plugin.xml)
- MACRO_CONVERT_SCHEMA(INPUT ${_plugin_xmls}
+ MACRO_CONVERT_SCHEMA(INPUT ${_plugin_xmls}
OUTPUT_DIR "${BLUEBERRY_XPDOC_OUTPUT_DIR}"
TARGET_NAME BlueBerryXPDoc
)
add_dependencies(BlueBerryDoc BlueBerryXPDoc)
endif(ANT_FOUND AND BLUEBERRY_DOC_TOOLS_DIR)
configure_file(schema.css ${BLUEBERRY_DOCS_OUTPUT_DIR}/schema.css)
endif(DOXYGEN_FOUND)
diff --git a/BlueBerry/Documentation/reference/extension-points/index.dox.in b/BlueBerry/Documentation/reference/extension-points/index.dox
similarity index 97%
rename from BlueBerry/Documentation/reference/extension-points/index.dox.in
rename to BlueBerry/Documentation/reference/extension-points/index.dox
index f9087bd2ee..8b6e7c33fa 100644
--- a/BlueBerry/Documentation/reference/extension-points/index.dox.in
+++ b/BlueBerry/Documentation/reference/extension-points/index.dox
@@ -1,64 +1,64 @@
/**
-\page ExtPointsIndex Extension-Point Reference
+\page BlueBerryExtPointsIndex Extension-Point Reference
BlueBerry Platform Extension Points
The following extension points can be used to extend the capabilities
of the platform infrastructure:
Platform runtime
- \subpage xp_org_blueberry_osgi_applications
Workbench
- \subpage xp_org_blueberry_ui_editors
- \subpage xp_org_blueberry_ui_perspectives
- \subpage xp_org_blueberry_ui_presentationFactories
- \subpage xp_org_blueberry_ui_services
- \subpage xp_org_blueberry_ui_keywords
- \subpage xp_org_blueberry_ui_preferencePages
- \subpage xp_org_blueberry_ui_tweaklets
- \subpage xp_org_blueberry_ui_views
Other
- \subpage xp_org_blueberry_tests
\page xp_org_blueberry_osgi_applications org.blueberry.osgi.applications
\htmlinclude org_blueberry_osgi_applications.html
\page xp_org_blueberry_ui_editors org.blueberry.ui.editors
\htmlinclude org_blueberry_ui_editors.html
\page xp_org_blueberry_ui_perspectives org.blueberry.ui.perspectives
\htmlinclude org_blueberry_ui_perspectives.html
\page xp_org_blueberry_ui_presentationFactories org.blueberry.ui.presentationFactories
\htmlinclude org_blueberry_ui_presentationFactories.html
\page xp_org_blueberry_ui_services org.blueberry.ui.services
\htmlinclude org_blueberry_ui_services.html
\page xp_org_blueberry_ui_keywords org.blueberry.ui.keywords
\htmlinclude org_blueberry_ui_keywords.html
\page xp_org_blueberry_ui_preferencePages org.blueberry.ui.preferencePages
\htmlinclude org_blueberry_ui_preferencePages.html
\page xp_org_blueberry_ui_tweaklets org.blueberry.ui.tweaklets
\htmlinclude org_blueberry_ui_tweaklets.html
\page xp_org_blueberry_ui_views org.blueberry.ui.views
\htmlinclude org_blueberry_ui_views.html
\page xp_org_blueberry_tests org.blueberry.tests
\htmlinclude org_blueberry_tests.html
*/
diff --git a/CMake/mitkMacroCreateModule.cmake b/CMake/mitkMacroCreateModule.cmake
index 87f3707a6e..8a3a23afea 100644
--- a/CMake/mitkMacroCreateModule.cmake
+++ b/CMake/mitkMacroCreateModule.cmake
@@ -1,367 +1,374 @@
##################################################################
#
# MITK_CREATE_MODULE
#
#! Creates a module for the automatic module dependency system within MITK.
#! Configurations are generated in the moduleConf directory.
#!
#! USAGE:
#!
#! \code
#! MITK_CREATE_MODULE(
#! [INCLUDE_DIRS ]
#! [INTERNAL_INCLUDE_DIRS ]
#! [DEPENDS ]
#! [PACKAGE_DEPENDS ]
#! [TARGET_DEPENDS
#! [EXPORT_DEFINE ]
#! [QT_MODULE]
#! [HEADERS_ONLY]
#! [WARNINGS_AS_ERRORS]
#! \endcode
#!
#! \param MODULE_NAME_IN The name for the new module
#! \param HEADERS_ONLY specify this if the modules just contains header files.
##################################################################
macro(MITK_CREATE_MODULE MODULE_NAME_IN)
set(_macro_params
SUBPROJECTS # list of CDash labels
VERSION # module version number, e.g. "1.2.0"
INCLUDE_DIRS # exported include dirs (used in mitkMacroCreateModuleConf.cmake)
INTERNAL_INCLUDE_DIRS # include dirs internal to this module
DEPENDS # list of modules this module depends on
DEPENDS_INTERNAL # list of modules this module internally depends on
PACKAGE_DEPENDS # list of "packages this module depends on (e.g. Qt, VTK, etc.)
TARGET_DEPENDS # list of CMake targets this module should depend on
EXPORT_DEFINE # export macro name for public symbols of this module
AUTOLOAD_WITH # a module target name identifying the module which will trigger the
# automatic loading of this module
ADDITIONAL_LIBS # list of addidtional libraries linked to this module
GENERATED_CPP # not used (?)
)
set(_macro_options
QT_MODULE # the module makes use of Qt features and needs moc and ui generated files
FORCE_STATIC # force building this module as a static library
HEADERS_ONLY # this module is a headers-only library
GCC_DEFAULT_VISIBILITY # do not use gcc visibility flags - all symbols will be exported
NO_INIT # do not create CppMicroServices initialization code
WARNINGS_AS_ERRORS # treat all compiler warnings as errors
)
MACRO_PARSE_ARGUMENTS(MODULE "${_macro_params}" "${_macro_options}" ${ARGN})
set(MODULE_NAME ${MODULE_NAME_IN})
if(MODULE_HEADERS_ONLY)
set(MODULE_PROVIDES )
if(MODULE_AUTOLOAD_WITH)
message(SEND_ERROR "A headers only module cannot be auto-loaded")
endif()
else()
set(MODULE_PROVIDES ${MODULE_NAME})
if(NOT MODULE_NO_INIT AND NOT MODULE_NAME STREQUAL "Mitk")
# Add a dependency to the "Mitk" module
list(APPEND MODULE_DEPENDS Mitk)
endif()
endif()
if(NOT MODULE_SUBPROJECTS)
if(MITK_DEFAULT_SUBPROJECTS)
set(MODULE_SUBPROJECTS ${MITK_DEFAULT_SUBPROJECTS})
endif()
endif()
# check if the subprojects exist as targets
if(MODULE_SUBPROJECTS)
foreach(subproject ${MODULE_SUBPROJECTS})
if(NOT TARGET ${subproject})
message(SEND_ERROR "The subproject ${subproject} does not have a corresponding target")
endif()
endforeach()
endif()
# check and set-up auto-loading
if(MODULE_AUTOLOAD_WITH)
if(NOT TARGET "${MODULE_AUTOLOAD_WITH}")
message(SEND_ERROR "The module target \"${MODULE_AUTOLOAD_WITH}\" specified as the auto-loading module for \"${MODULE_NAME}\" does not exist")
endif()
# create a meta-target if it does not already exist
set(_module_autoload_meta_target "${MODULE_AUTOLOAD_WITH}-universe")
if(NOT TARGET ${_module_autoload_meta_target})
add_custom_target(${_module_autoload_meta_target})
endif()
endif()
# assume worst case
set(MODULE_IS_ENABLED 0)
# first we check if we have an explicit module build list
if(MITK_MODULES_TO_BUILD)
list(FIND MITK_MODULES_TO_BUILD ${MODULE_NAME} _MOD_INDEX)
if(_MOD_INDEX EQUAL -1)
set(MODULE_IS_EXCLUDED 1)
endif()
endif()
if(NOT MODULE_IS_EXCLUDED AND NOT (MODULE_QT_MODULE AND NOT MITK_USE_QT))
# first of all we check for the dependencies
MITK_CHECK_MODULE(_MISSING_DEP ${MODULE_DEPENDS})
if(_MISSING_DEP)
message("Module ${MODULE_NAME} won't be built, missing dependency: ${_MISSING_DEP}")
set(MODULE_IS_ENABLED 0)
else(_MISSING_DEP)
set(MODULE_IS_ENABLED 1)
# now check for every package if it is enabled. This overlaps a bit with
# MITK_CHECK_MODULE ...
foreach(_package ${MODULE_PACKAGE_DEPENDS})
if((DEFINED MITK_USE_${_package}) AND NOT (MITK_USE_${_package}))
message("Module ${MODULE_NAME} won't be built. Turn on MITK_USE_${_package} if you want to use it.")
set(MODULE_IS_ENABLED 0)
endif()
endforeach()
if(MODULE_IS_ENABLED)
# clear variables defined in files.cmake
set(RESOURCE_FILES )
set(CPP_FILES )
set(H_FILES )
set(TXX_FILES )
set(DOX_FILES )
set(UI_FILES )
set(MOC_H_FILES )
set(QRC_FILES )
# clear other variables
set(Q${KITNAME}_GENERATED_MOC_CPP )
set(Q${KITNAME}_GENERATED_QRC_CPP )
set(Q${KITNAME}_GENERATED_UI_CPP )
_MITK_CREATE_MODULE_CONF()
if(NOT MODULE_EXPORT_DEFINE)
set(MODULE_EXPORT_DEFINE ${MODULE_NAME}_EXPORT)
endif(NOT MODULE_EXPORT_DEFINE)
if(MITK_GENERATE_MODULE_DOT)
message("MODULEDOTNAME ${MODULE_NAME}")
foreach(dep ${MODULE_DEPENDS})
message("MODULEDOT \"${MODULE_NAME}\" -> \"${dep}\" ; ")
endforeach(dep)
endif(MITK_GENERATE_MODULE_DOT)
set(DEPENDS "${MODULE_DEPENDS}")
set(DEPENDS_BEFORE "not initialized")
set(PACKAGE_DEPENDS "${MODULE_PACKAGE_DEPENDS}")
MITK_USE_MODULE("${MODULE_DEPENDS}")
# ok, now create the module itself
include_directories(. ${ALL_INCLUDE_DIRECTORIES})
include(files.cmake)
set(module_compile_flags )
if(WIN32)
set(module_compile_flags "${module_compile_flags} -DPOCO_NO_UNWINDOWS -DWIN32_LEAN_AND_MEAN")
endif()
if(MODULE_GCC_DEFAULT_VISIBILITY)
set(use_visibility_flags 0)
else()
# We only support hidden visibility for gcc for now. Clang 3.0 still has troubles with
# correctly marking template declarations and explicit template instantiations as exported.
# See http://comments.gmane.org/gmane.comp.compilers.clang.scm/50028
# and http://llvm.org/bugs/show_bug.cgi?id=10113
if(CMAKE_COMPILER_IS_GNUCXX)
set(use_visibility_flags 1)
else()
# set(use_visibility_flags 0)
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
# MinGW does not export all symbols automatically, so no need to set flags.
#
# With gcc < 4.5, RTTI symbols from classes declared in third-party libraries
# which are not "gcc visibility aware" are marked with hidden visibility in
# DSOs which include the class declaration and which are compiled with
# hidden visibility. This leads to dynamic_cast and exception handling problems.
# While this problem could be worked around by sandwiching the include
# directives for the third-party headers between "#pragma visibility push/pop"
# statements, it is generally safer to just use default visibility with
# gcc < 4.5.
if(${GCC_VERSION} VERSION_LESS "4.5" OR MINGW)
set(use_visibility_flags 0)
endif()
endif()
if(use_visibility_flags)
mitkFunctionCheckCompilerFlags("-fvisibility=hidden" module_compile_flags)
mitkFunctionCheckCompilerFlags("-fvisibility-inlines-hidden" module_compile_flags)
endif()
configure_file(${MITK_SOURCE_DIR}/CMake/moduleExports.h.in ${CMAKE_BINARY_DIR}/${MODULES_CONF_DIRNAME}/${MODULE_NAME}Exports.h @ONLY)
if(MODULE_WARNINGS_AS_ERRORS)
if(MSVC_VERSION)
mitkFunctionCheckCompilerFlags("/WX" module_compile_flags)
else()
mitkFunctionCheckCompilerFlags("-Werror" module_compile_flags)
# The flag "c++0x-static-nonintegral-init" has been renamed in newer Clang
# versions to "static-member-init", see
# http://clang-developers.42468.n3.nabble.com/Wc-0x-static-nonintegral-init-gone-td3999651.html
#
# Also, older Clang and seemingly all gcc versions do not warn if unknown
# "-no-*" flags are used, so CMake will happily append any -Wno-* flag to the
# command line. This may get confusing if unrelated compiler errors happen and
# the error output then additinally contains errors about unknown flags (which
# is not the case if there were no compile errors).
#
# So instead of using -Wno-* we use -Wno-error=*, which will be properly rejected by
# the compiler and if applicable, prints the specific warning as a real warning and
# not as an error (although -Werror was given).
mitkFunctionCheckCompilerFlags("-Wno-error=c++0x-static-nonintegral-init" module_compile_flags)
mitkFunctionCheckCompilerFlags("-Wno-error=gnu" module_compile_flags)
+
+ # VNL headers throw a lot of these, not fixable for us at least in ITK 3
+ mitkFunctionCheckCompilerFlags("-Wno-error=unused-parameter" module_compile_flags)
+
+ # Some DICOM header file in ITK
+ mitkFunctionCheckCompilerFlags("-Wno-error=cast-align" module_compile_flags)
+
endif()
endif(MODULE_WARNINGS_AS_ERRORS)
if(MODULE_FORCE_STATIC)
set(_STATIC STATIC)
else()
set(_STATIC )
endif(MODULE_FORCE_STATIC)
if(NOT MODULE_NO_INIT)
set(MODULE_LIBNAME ${MODULE_PROVIDES})
usFunctionGenerateModuleInit(CPP_FILES
NAME ${MODULE_NAME}
LIBRARY_NAME ${MODULE_LIBNAME}
DEPENDS ${MODULE_DEPENDS} ${MODULE_DEPENDS_INTERNAL} ${MODULE_PACKAGE_DEPENDS}
#VERSION ${MODULE_VERSION}
)
if(RESOURCE_FILES)
usFunctionEmbedResources(CPP_FILES
LIBRARY_NAME ${MODULE_LIBNAME}
ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Resources
FILES ${RESOURCE_FILES})
endif()
endif()
if(MODULE_QT_MODULE)
if(UI_FILES)
QT4_WRAP_UI(Q${KITNAME}_GENERATED_UI_CPP ${UI_FILES})
endif(UI_FILES)
if(MOC_H_FILES)
QT4_WRAP_CPP(Q${KITNAME}_GENERATED_MOC_CPP ${MOC_H_FILES})
endif(MOC_H_FILES)
if(QRC_FILES)
QT4_ADD_RESOURCES(Q${KITNAME}_GENERATED_QRC_CPP ${QRC_FILES})
endif(QRC_FILES)
set(Q${KITNAME}_GENERATED_CPP ${Q${KITNAME}_GENERATED_CPP} ${Q${KITNAME}_GENERATED_UI_CPP} ${Q${KITNAME}_GENERATED_MOC_CPP} ${Q${KITNAME}_GENERATED_QRC_CPP})
endif()
ORGANIZE_SOURCES(SOURCE ${CPP_FILES}
HEADER ${H_FILES}
TXX ${TXX_FILES}
DOC ${DOX_FILES}
UI ${UI_FILES}
QRC ${QRC_FILES}
MOC ${Q${KITNAME}_GENERATED_MOC_CPP}
GEN_QRC ${Q${KITNAME}_GENERATED_QRC_CPP}
GEN_UI ${Q${KITNAME}_GENERATED_UI_CPP})
set(coverage_sources
${CPP_FILES} ${H_FILES} ${GLOBBED__H_FILES} ${CORRESPONDING__H_FILES} ${TXX_FILES}
${TOOL_CPPS} ${TOOL_GUI_CPPS})
if(MODULE_SUBPROJECTS)
set_property(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
endif()
if(NOT MODULE_HEADERS_ONLY)
if(ALL_LIBRARY_DIRS)
# LINK_DIRECTORIES applies only to targets which are added after the call to LINK_DIRECTORIES
link_directories(${ALL_LIBRARY_DIRS})
endif(ALL_LIBRARY_DIRS)
add_library(${MODULE_PROVIDES} ${_STATIC}
${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP}
${DOX_FILES} ${UI_FILES} ${QRC_FILES})
if(MODULE_TARGET_DEPENDS)
add_dependencies(${MODULE_PROVIDES} ${MODULE_TARGET_DEPENDS})
endif()
if(MODULE_SUBPROJECTS)
set_property(TARGET ${MODULE_PROVIDES} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
foreach(subproject ${MODULE_SUBPROJECTS})
add_dependencies(${subproject} ${MODULE_PROVIDES})
endforeach()
endif()
if(ALL_LIBRARIES)
target_link_libraries(${MODULE_PROVIDES} ${ALL_LIBRARIES})
endif(ALL_LIBRARIES)
if(MODULE_QT_MODULE AND QT_LIBRARIES)
target_link_libraries(${MODULE_PROVIDES} ${QT_LIBRARIES})
endif()
if(MINGW)
target_link_libraries(${MODULE_PROVIDES} ssp) # add stack smash protection lib
endif()
# Apply properties to the module target.
set_target_properties(${MODULE_PROVIDES} PROPERTIES
COMPILE_FLAGS "${module_compile_flags}")
# add the target name to a global property which is used in the top-level
# CMakeLists.txt file to export the target
set_property(GLOBAL APPEND PROPERTY MITK_MODULE_TARGETS ${MODULE_PROVIDES})
if(MODULE_AUTOLOAD_WITH)
# for auto-loaded modules, adapt the output directory
add_dependencies(${_module_autoload_meta_target} ${MODULE_PROVIDES})
if(WIN32)
set(_module_output_prop RUNTIME_OUTPUT_DIRECTORY)
else()
set(_module_output_prop LIBRARY_OUTPUT_DIRECTORY)
endif()
set(_module_output_dir ${CMAKE_${_module_output_prop}}/${MODULE_AUTOLOAD_WITH})
get_target_property(_module_is_imported ${MODULE_AUTOLOAD_WITH} IMPORTED)
if(NOT _module_is_imported)
# if the auto-loading module is not imported, get its location
# and put the auto-load module relative to it.
get_target_property(_module_output_dir ${MODULE_AUTOLOAD_WITH} ${_module_output_prop})
set_target_properties(${MODULE_PROVIDES} PROPERTIES
${_module_output_prop} ${_module_output_dir}/${MODULE_AUTOLOAD_WITH})
else()
set_target_properties(${MODULE_PROVIDES} PROPERTIES
${_module_output_prop} ${CMAKE_${_module_output_prop}}/${MODULE_AUTOLOAD_WITH})
endif()
set_target_properties(${MODULE_PROVIDES} PROPERTIES
MITK_AUTOLOAD_DIRECTORY ${MODULE_AUTOLOAD_WITH})
# add the auto-load module name as a property
set_property(TARGET ${MODULE_AUTOLOAD_WITH} APPEND PROPERTY MITK_AUTOLOAD_TARGETS ${MODULE_PROVIDES})
else()
# Add meta dependencies (e.g. on auto-load modules from depending modules)
if(ALL_META_DEPENDENCIES)
add_dependencies(${MODULE_PROVIDES} ${ALL_META_DEPENDENCIES})
endif()
endif()
endif()
endif(MODULE_IS_ENABLED)
endif(_MISSING_DEP)
endif(NOT MODULE_IS_EXCLUDED AND NOT (MODULE_QT_MODULE AND NOT MITK_USE_QT))
if(NOT MODULE_IS_ENABLED)
_MITK_CREATE_MODULE_CONF()
endif(NOT MODULE_IS_ENABLED)
endmacro(MITK_CREATE_MODULE)
diff --git a/CMake/mitkMacroCreateModuleTests.cmake b/CMake/mitkMacroCreateModuleTests.cmake
index c10927ae34..7820e68174 100644
--- a/CMake/mitkMacroCreateModuleTests.cmake
+++ b/CMake/mitkMacroCreateModuleTests.cmake
@@ -1,85 +1,90 @@
#
# Create tests and testdriver for this module
#
# Usage: MITK_CREATE_MODULE_TESTS( [EXTRA_DRIVER_INIT init_code] )
#
# EXTRA_DRIVER_INIT is inserted as c++ code in the testdriver and will be executed before each test
#
macro(MITK_CREATE_MODULE_TESTS)
MACRO_PARSE_ARGUMENTS(MODULE_TEST
- "EXTRA_DRIVER_INIT;EXTRA_DRIVER_INCLUDE" "" ${ARGN})
+ "EXTRA_DRIVER_INIT;EXTRA_DRIVER_INCLUDE;EXTRA_DEPENDS" "" ${ARGN})
if(BUILD_TESTING AND MODULE_IS_ENABLED)
set(OLD_MOC_H_FILES ${MOC_H_FILES})
set(MOC_H_FILES)
include(files.cmake)
include_directories(.)
if(DEFINED MOC_H_FILES)
QT4_WRAP_CPP(MODULE_TEST_GENERATED_MOC_CPP ${MOC_H_FILES})
endif(DEFINED MOC_H_FILES)
+ if (MODULE_TEST_EXTRA_DEPENDS)
+ MITK_USE_MODULE("${MODULE_TEST_EXTRA_DEPENDS}")
+ include_directories(${ALL_INCLUDE_DIRECTORIES})
+ endif()
+
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "mitk::LoggingBackend::Register(); ${MODULE_TEST_EXTRA_DRIVER_INIT};")
set(CMAKE_TESTDRIVER_AFTER_TESTMAIN "mitk::LoggingBackend::Unregister();")
if(NOT MODULE_TEST_EXTRA_DRIVER_INCLUDE)
# this is necessary to make the LoggingBackend calls available if nothing else is included
set(MODULE_TEST_EXTRA_DRIVER_INCLUDE "mitkLog.h")
endif(NOT MODULE_TEST_EXTRA_DRIVER_INCLUDE)
create_test_sourcelist(MODULETEST_SOURCE ${MODULE_NAME}TestDriver.cpp
${MODULE_TESTS} ${MODULE_IMAGE_TESTS} ${MODULE_CUSTOM_TESTS}
EXTRA_INCLUDE ${MODULE_TEST_EXTRA_DRIVER_INCLUDE}
)
set(TESTDRIVER ${MODULE_NAME}TestDriver)
add_executable(${TESTDRIVER} ${MODULETEST_SOURCE} ${MODULE_TEST_GENERATED_MOC_CPP} ${TEST_CPP_FILES})
target_link_libraries(${TESTDRIVER} ${MODULE_PROVIDES} ${ALL_LIBRARIES})
if(MODULE_SUBPROJECTS)
foreach(subproject ${MODULE_SUBPROJECTS})
add_dependencies(${subproject} ${TESTDRIVER})
endforeach()
endif()
#
# Now tell CMake which tests should be run. This is done automatically
# for all tests in ${KITNAME}_TESTS and ${KITNAME}_IMAGE_TESTS. The IMAGE_TESTS
# are run for each image in the TESTIMAGES list.
#
foreach( test ${MODULE_TESTS} )
get_filename_component(TName ${test} NAME_WE)
add_test(${TName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName})
# Add labels for CDash subproject support
if(MODULE_SUBPROJECTS)
set_property(TEST ${TName} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
endif()
endforeach( test )
foreach(image ${MODULE_TESTIMAGES} ${ADDITIONAL_TEST_IMAGES} )
if(EXISTS ${image})
set(IMAGE_FULL_PATH ${image})
else(EXISTS ${image})
# todo: maybe search other paths as well
# yes, please in mitk/Testing/Data, too
set(IMAGE_FULL_PATH ${MITK_DATA_DIR}/${image})
endif(EXISTS ${image})
if(EXISTS ${IMAGE_FULL_PATH})
foreach( test ${MODULE_IMAGE_TESTS} )
get_filename_component(TName ${test} NAME_WE)
get_filename_component(ImageName ${IMAGE_FULL_PATH} NAME)
add_test(${TName}_${ImageName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName} ${IMAGE_FULL_PATH})
# Add labels for CDash subproject support
if(MODULE_SUBPROJECTS)
set_property(TEST ${TName}_${ImageName} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
endif()
endforeach( test )
else(EXISTS ${IMAGE_FULL_PATH})
message("!!!!! No such file: ${IMAGE_FULL_PATH} !!!!!")
endif(EXISTS ${IMAGE_FULL_PATH})
endforeach( image )
set(MOC_H_FILES ${OLD_MOC_H_FILES})
endif(BUILD_TESTING AND MODULE_IS_ENABLED)
endmacro(MITK_CREATE_MODULE_TESTS)
diff --git a/CMake/mitkSetupVariables.cmake b/CMake/mitkSetupVariables.cmake
index 515ee84fde..d233b8b0b2 100644
--- a/CMake/mitkSetupVariables.cmake
+++ b/CMake/mitkSetupVariables.cmake
@@ -1,165 +1,169 @@
if(MITK_BUILD_ALL_PLUGINS)
set(MITK_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL")
endif()
set(LIBPOSTFIX "")
# MITK_VERSION
set(MITK_VERSION_MAJOR "2012")
set(MITK_VERSION_MINOR "12")
set(MITK_VERSION_PATCH "99")
set(MITK_VERSION_STRING "${MITK_VERSION_MAJOR}.${MITK_VERSION_MINOR}.${MITK_VERSION_PATCH}")
if(MITK_VERSION_PATCH STREQUAL "99")
set(MITK_VERSION_STRING "${MITK_VERSION_STRING}-${MITK_REVISION_SHORTID}")
endif()
+# Needed early on for redirecting the BlueBerry documentation output dir
+set(MITK_DOXYGEN_OUTPUT_DIR ${PROJECT_BINARY_DIR}/Documentation/Doxygen CACHE PATH
+ "Output directory for doxygen generated documentation." )
+
#-----------------------------------
# Configuration of module system
#-----------------------------------
set(MODULES_CONF_DIRNAME modulesConf)
set(MODULES_CONF_DIRS ${MITK_BINARY_DIR}/${MODULES_CONF_DIRNAME})
if(NOT UNIX AND NOT MINGW)
set(MITK_WIN32_FORCE_STATIC "STATIC" CACHE INTERNAL "Use this variable to always build static libraries on non-unix platforms")
endif()
# build the MITK_INCLUDE_DIRS variable
set(MITK_INCLUDE_DIRS
${ITK_INCLUDE_DIRS}
${VTK_INCLUDE_DIRS}
${PROJECT_BINARY_DIR} # contains mitkConfig.h and similar files
${MODULES_CONF_DIRS} # contains module *Exports.h files
)
set(CORE_DIRECTORIES Common DataManagement Algorithms IO Rendering Interactions Controllers Service)
foreach(d ${CORE_DIRECTORIES})
list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/Core/Code/${d})
endforeach()
#list(APPEND MITK_INCLUDE_DIRS
#${ITK_INCLUDE_DIRS}
#${VTK_INCLUDE_DIRS}
# )
foreach(d Utilities Utilities/ipPic Utilities/pic2vtk Utilities/tinyxml Utilities/mbilog)
list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${d})
endforeach()
list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/Utilities/mbilog)
if(WIN32)
list(APPEND MITK_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipPic/win32)
endif()
# additional include dirs variables
set(ANN_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ann/include)
set(IPSEGMENTATION_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipSegmentation)
# variables containing librariy names
set(MITK_CORE_LIBRARIES Mitk)
set(VTK_FOR_MITK_LIBRARIES
vtkGraphics
vtkCommon
vtkFiltering
vtkGraphics
vtkHybrid
vtkImaging
vtkIO
vtkParallel
vtkRendering
vtkVolumeRendering
vtkWidgets
${VTK_JPEG_LIBRARIES}
${VTK_PNG_LIBRARIES}
${VTK_ZLIB_LIBRARIES}
${VTK_EXPAT_LIBRARIES}
${VTK_FREETYPE_LIBRARIES}
)
# TODO: maybe solve this with lib depends mechanism of CMake
set(UTIL_FOR_MITK_LIBRARIES mitkIpPic mitkIpFunc mbilog)
set(LIBRARIES_FOR_MITK_CORE
${UTIL_FOR_MITK_LIBRARIES}
${VTK_FOR_MITK_LIBRARIES}
${ITK_LIBRARIES}
)
set(MITK_LIBRARIES
${MITK_CORE_LIBRARIES}
${LIBRARIES_FOR_MITK_CORE}
pic2vtk
ipSegmentation
ann
)
# variables used in CMake macros which are called from external projects
set(MITK_VTK_LIBRARY_DIRS ${VTK_LIBRARY_DIRS})
set(MITK_ITK_LIBRARY_DIRS ${ITK_LIBRARY_DIRS})
# variables containing link directories
set(MITK_LIBRARY_DIRS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(MITK_LINK_DIRECTORIES
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
${ITK_LIBRARY_DIRS}
${VTK_LIBRARY_DIRS}
${GDCM_LIBRARY_DIRS})
# Qt support
if(MITK_USE_QT)
find_package(Qt4 REQUIRED)
set(QMITK_INCLUDE_DIRS
${MITK_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/Modules/Qmitk
${PROJECT_BINARY_DIR}/Modules/Qmitk
)
set(QMITK_LIBRARIES Qmitk ${MITK_LIBRARIES})
set(QMITK_LINK_DIRECTORIES ${MITK_LINK_DIRECTORIES})
endif()
if(MITK_BUILD_ALL_PLUGINS)
set(MITK_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL")
endif()
# create a list of types for template instantiations of itk image access functions
function(_create_type_seq TYPES seq_var seqdim_var)
set(_seq )
set(_seq_dim )
string(REPLACE "," ";" _pixeltypes "${TYPES}")
foreach(_pixeltype ${_pixeltypes})
set(_seq "${_seq}(${_pixeltype})")
set(_seq_dim "${_seq_dim}((${_pixeltype},dim))")
endforeach()
set(${seq_var} "${_seq}" PARENT_SCOPE)
set(${seqdim_var} "${_seq_dim}" PARENT_SCOPE)
endfunction()
set(MITK_ACCESSBYITK_PIXEL_TYPES )
set(MITK_ACCESSBYITK_PIXEL_TYPES_SEQ )
set(MITK_ACCESSBYITK_TYPES_DIMN_SEQ )
# concatenate only the simple pixel types to the MITK_ACCESSBYITK_PIXEL_TYPE_SEQ list
# see Bug 12682 for detailed information
foreach(_type INTEGRAL FLOATING)
set(_typelist "${MITK_ACCESSBYITK_${_type}_PIXEL_TYPES}")
if(_typelist)
if(MITK_ACCESSBYITK_PIXEL_TYPES)
set(MITK_ACCESSBYITK_PIXEL_TYPES "${MITK_ACCESSBYITK_PIXEL_TYPES},${_typelist}")
else()
set(MITK_ACCESSBYITK_PIXEL_TYPES "${_typelist}")
endif()
endif()
_create_type_seq("${_typelist}"
MITK_ACCESSBYITK_${_type}_PIXEL_TYPES_SEQ
MITK_ACCESSBYITK_${_type}_TYPES_DIMN_SEQ)
set(MITK_ACCESSBYITK_PIXEL_TYPES_SEQ "${MITK_ACCESSBYITK_PIXEL_TYPES_SEQ}${MITK_ACCESSBYITK_${_type}_PIXEL_TYPES_SEQ}")
set(MITK_ACCESSBYITK_TYPES_DIMN_SEQ "${MITK_ACCESSBYITK_TYPES_DIMN_SEQ}${MITK_ACCESSBYITK_${_type}_TYPES_DIMN_SEQ}")
endforeach()
# separate processing of the COMPOSITE list to avoid its concatenation to to global list
_create_type_seq(${MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES}
MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES_SEQ
MITK_ACCESSBYITK_COMPOSITE_TYPES_DIMN_SEQ)
set(MITK_ACCESSBYITK_DIMENSIONS_SEQ )
string(REPLACE "," ";" _dimensions "${MITK_ACCESSBYITK_DIMENSIONS}")
foreach(_dimension ${_dimensions})
set(MITK_ACCESSBYITK_DIMENSIONS_SEQ "${MITK_ACCESSBYITK_DIMENSIONS_SEQ}(${_dimension})")
endforeach()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f135c68c0..333f3c1b1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,949 +1,963 @@
if(APPLE)
# With XCode 4.3, the SDK location changed. Older CMake
# versions are not able to find it.
cmake_minimum_required(VERSION 2.8.8)
else()
cmake_minimum_required(VERSION 2.8.4)
endif()
#-----------------------------------------------------------------------------
# Set a default build type if none was specified
#-----------------------------------------------------------------------------
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
#-----------------------------------------------------------------------------
# Superbuild Option - Enabled by default
#-----------------------------------------------------------------------------
option(MITK_USE_SUPERBUILD "Build MITK and the projects it depends on via SuperBuild.cmake." ON)
if(MITK_USE_SUPERBUILD)
project(MITK-superbuild)
set(MITK_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set(MITK_BINARY_DIR ${PROJECT_BINARY_DIR})
else()
project(MITK)
endif()
#-----------------------------------------------------------------------------
# Warn if source or build path is too long
#-----------------------------------------------------------------------------
if(WIN32)
set(_src_dir_length_max 50)
set(_bin_dir_length_max 50)
if(MITK_USE_SUPERBUILD)
set(_src_dir_length_max 43) # _src_dir_length_max - strlen(ITK-src)
set(_bin_dir_length_max 40) # _bin_dir_length_max - strlen(MITK-build)
endif()
string(LENGTH "${MITK_SOURCE_DIR}" _src_n)
string(LENGTH "${MITK_BINARY_DIR}" _bin_n)
# The warnings should be converted to errors
if(_src_n GREATER _src_dir_length_max)
message(WARNING "MITK source code directory path length is too long (${_src_n} > ${_src_dir_length_max})."
"Please move the MITK source code directory to a directory with a shorter path." )
endif()
if(_bin_n GREATER _bin_dir_length_max)
message(WARNING "MITK build directory path length is too long (${_bin_n} > ${_bin_dir_length_max})."
"Please move the MITK build directory to a directory with a shorter path." )
endif()
endif()
#-----------------------------------------------------------------------------
# See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details
#-----------------------------------------------------------------------------
set(project_policies
CMP0001 # NEW: CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.
CMP0002 # NEW: Logical target names must be globally unique.
CMP0003 # NEW: Libraries linked via full path no longer produce linker search paths.
CMP0004 # NEW: Libraries linked may NOT have leading or trailing whitespace.
CMP0005 # NEW: Preprocessor definition values are now escaped automatically.
CMP0006 # NEW: Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION.
CMP0007 # NEW: List command no longer ignores empty elements.
CMP0008 # NEW: Libraries linked by full-path must have a valid library file name.
CMP0009 # NEW: FILE GLOB_RECURSE calls should not follow symlinks by default.
CMP0010 # NEW: Bad variable reference syntax is an error.
CMP0011 # NEW: Included scripts do automatic cmake_policy PUSH and POP.
CMP0012 # NEW: if() recognizes numbers and boolean constants.
CMP0013 # NEW: Duplicate binary directories are not allowed.
CMP0014 # NEW: Input directories must have CMakeLists.txt
)
foreach(policy ${project_policies})
if(POLICY ${policy})
cmake_policy(SET ${policy} NEW)
endif()
endforeach()
#-----------------------------------------------------------------------------
# Update CMake module path
#------------------------------------------------------------------------------
set(CMAKE_MODULE_PATH
${MITK_SOURCE_DIR}/CMake
${CMAKE_MODULE_PATH}
)
#-----------------------------------------------------------------------------
# CMake function(s) and macro(s)
#-----------------------------------------------------------------------------
include(mitkMacroEmptyExternalProject)
include(mitkFunctionGenerateProjectXml)
include(mitkFunctionSuppressWarnings)
SUPPRESS_VC_DEPRECATED_WARNINGS()
#-----------------------------------------------------------------------------
# Output directories.
#-----------------------------------------------------------------------------
foreach(type LIBRARY RUNTIME ARCHIVE)
# Make sure the directory exists
if(DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY
AND NOT EXISTS ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY})
message("Creating directory MITK_CMAKE_${type}_OUTPUT_DIRECTORY: ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}")
file(MAKE_DIRECTORY "${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}")
endif()
if(MITK_USE_SUPERBUILD)
set(output_dir ${MITK_BINARY_DIR}/bin)
if(NOT DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY)
set(MITK_CMAKE_${type}_OUTPUT_DIRECTORY ${MITK_BINARY_DIR}/MITK-build/bin)
endif()
else()
if(NOT DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY)
set(output_dir ${MITK_BINARY_DIR}/bin)
else()
set(output_dir ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY})
endif()
endif()
set(CMAKE_${type}_OUTPUT_DIRECTORY ${output_dir} CACHE INTERNAL "Single output directory for building all libraries.")
mark_as_advanced(CMAKE_${type}_OUTPUT_DIRECTORY)
endforeach()
#-----------------------------------------------------------------------------
# Additional MITK Options (also shown during superbuild)
#-----------------------------------------------------------------------------
option(BUILD_SHARED_LIBS "Build MITK with shared libraries" ON)
option(WITH_COVERAGE "Enable/Disable coverage" OFF)
option(BUILD_TESTING "Test the project" ON)
option(MITK_BUILD_ALL_APPS "Build all MITK applications" OFF)
set(MITK_BUILD_TUTORIAL OFF CACHE INTERNAL "Deprecated! Use MITK_BUILD_EXAMPLES instead!")
option(MITK_BUILD_EXAMPLES "Build the MITK Examples" ${MITK_BUILD_TUTORIAL})
option(MITK_USE_Boost "Use the Boost C++ library" OFF)
option(MITK_USE_BLUEBERRY "Build the BlueBerry platform" ON)
option(MITK_USE_CTK "Use CTK in MITK" ${MITK_USE_BLUEBERRY})
option(MITK_USE_QT "Use Nokia's Qt library" ${MITK_USE_CTK})
option(MITK_USE_DCMTK "EXPERIMENTAL, superbuild only: Use DCMTK in MITK" ${MITK_USE_CTK})
option(MITK_DCMTK_BUILD_SHARED_LIBS "EXPERIMENTAL, superbuild only: build DCMTK as shared libs" OFF)
option(MITK_USE_OpenCV "Use Intel's OpenCV library" OFF)
option(MITK_USE_OpenCL "Use OpenCL GPU-Computing library" OFF)
option(MITK_USE_SOFA "Use Simulation Open Framework Architecture" OFF)
option(MITK_USE_Python "Use Python wrapping in MITK" OFF)
set(MITK_USE_CableSwig ${MITK_USE_Python})
mark_as_advanced(MITK_BUILD_ALL_APPS
MITK_USE_CTK
MITK_USE_DCMTK
)
if(MITK_USE_Boost)
option(MITK_USE_SYSTEM_Boost "Use the system Boost" OFF)
set(MITK_USE_Boost_LIBRARIES "" CACHE STRING "A semi-colon separated list of required Boost libraries")
endif()
if(MITK_USE_BLUEBERRY)
option(MITK_BUILD_ALL_PLUGINS "Build all MITK plugins" OFF)
mark_as_advanced(MITK_BUILD_ALL_PLUGINS)
if(NOT MITK_USE_CTK)
message("Forcing MITK_USE_CTK to ON because of MITK_USE_BLUEBERRY")
set(MITK_USE_CTK ON CACHE BOOL "Use CTK in MITK" FORCE)
endif()
endif()
if(MITK_USE_CTK)
if(NOT MITK_USE_QT)
message("Forcing MITK_USE_QT to ON because of MITK_USE_CTK")
set(MITK_USE_QT ON CACHE BOOL "Use Nokia's Qt library in MITK" FORCE)
endif()
if(NOT MITK_USE_DCMTK)
message("Setting MITK_USE_DCMTK to ON because DCMTK needs to be build for CTK")
set(MITK_USE_DCMTK ON CACHE BOOL "Use DCMTK in MITK" FORCE)
endif()
endif()
if(MITK_USE_QT)
# find the package at the very beginning, so that QT4_FOUND is available
find_package(Qt4 4.6.2 REQUIRED)
endif()
# Customize the default pixel types for multiplex macros
set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
"int, unsigned int, short, unsigned short, char, unsigned char"
CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
"double, float"
CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
"itk::RGBPixel, itk::RGBAPixel"
CACHE STRING "List of composite pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_DIMENSIONS
"2,3"
CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros")
mark_as_advanced(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
MITK_ACCESSBYITK_DIMENSIONS
)
# consistency checks
if(NOT MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES)
set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
"int, unsigned int, short, unsigned short, char, unsigned char"
CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE)
endif()
if(NOT MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES)
set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
"double, float"
CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE)
endif()
if(NOT MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES)
set(MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
"itk::RGBPixel, itk::RGBAPixel"
CACHE STRING "List of composite pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE)
endif()
if(NOT MITK_ACCESSBYITK_DIMENSIONS)
set(MITK_ACCESSBYITK_DIMENSIONS
"2,3"
CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros")
endif()
#-----------------------------------------------------------------------------
# Additional CXX/C Flags
#-----------------------------------------------------------------------------
set(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional C Flags")
mark_as_advanced(ADDITIONAL_C_FLAGS)
set(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX Flags")
mark_as_advanced(ADDITIONAL_CXX_FLAGS)
#-----------------------------------------------------------------------------
# Project.xml
#-----------------------------------------------------------------------------
# A list of topologically ordered targets
set(CTEST_PROJECT_SUBPROJECTS)
if(MITK_USE_BLUEBERRY)
list(APPEND CTEST_PROJECT_SUBPROJECTS BlueBerry)
endif()
list(APPEND CTEST_PROJECT_SUBPROJECTS
MITK-Core
MITK-CoreUI
MITK-IGT
MITK-ToF
MITK-DTI
MITK-Registration
MITK-Modules # all modules not contained in a specific subproject
MITK-Plugins # all plugins not contained in a specific subproject
MITK-Examples
Unlabeled # special "subproject" catching all unlabeled targets and tests
)
# Configure CTestConfigSubProject.cmake that could be used by CTest scripts
configure_file(${MITK_SOURCE_DIR}/CTestConfigSubProject.cmake.in
${MITK_BINARY_DIR}/CTestConfigSubProject.cmake)
if(CTEST_PROJECT_ADDITIONAL_TARGETS)
# those targets will be executed at the end of the ctest driver script
# and they also get their own subproject label
set(subproject_list "${CTEST_PROJECT_SUBPROJECTS};${CTEST_PROJECT_ADDITIONAL_TARGETS}")
else()
set(subproject_list "${CTEST_PROJECT_SUBPROJECTS}")
endif()
# Generate Project.xml file expected by the CTest driver script
mitkFunctionGenerateProjectXml(${MITK_BINARY_DIR} MITK "${subproject_list}" ${MITK_USE_SUPERBUILD})
#-----------------------------------------------------------------------------
# Superbuild script
#-----------------------------------------------------------------------------
if(MITK_USE_SUPERBUILD)
include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake")
return()
endif()
#*****************************************************************************
#**************************** END OF SUPERBUILD ****************************
#*****************************************************************************
#-----------------------------------------------------------------------------
# CMake function(s) and macro(s)
#-----------------------------------------------------------------------------
include(CheckCXXSourceCompiles)
include(mitkFunctionCheckCompilerFlags)
include(mitkFunctionGetGccVersion)
include(MacroParseArguments)
include(mitkFunctionSuppressWarnings) # includes several functions
include(mitkFunctionOrganizeSources)
include(mitkFunctionGetVersion)
include(mitkFunctionGetVersionDescription)
include(mitkFunctionCreateWindowsBatchScript)
include(mitkFunctionInstallProvisioningFiles)
include(mitkFunctionInstallAutoLoadModules)
include(mitkFunctionCompileSnippets)
include(mitkMacroCreateModuleConf)
include(mitkMacroCreateModule)
include(mitkMacroCheckModule)
include(mitkMacroCreateModuleTests)
include(mitkFunctionAddCustomModuleTest)
include(mitkMacroUseModule)
include(mitkMacroMultiplexPicType)
include(mitkMacroInstall)
include(mitkMacroInstallHelperApp)
include(mitkMacroInstallTargets)
include(mitkMacroGenerateToolsLibrary)
include(mitkMacroGetLinuxDistribution)
#-----------------------------------------------------------------------------
# Prerequesites
#-----------------------------------------------------------------------------
find_package(ITK REQUIRED)
find_package(VTK REQUIRED)
if(ITK_USE_SYSTEM_GDCM)
find_package(GDCM PATHS ${ITK_GDCM_DIR} REQUIRED)
endif()
#-----------------------------------------------------------------------------
# Set MITK specific options and variables (NOT available during superbuild)
#-----------------------------------------------------------------------------
# ASK THE USER TO SHOW THE CONSOLE WINDOW FOR CoreApp and mitkWorkbench
option(MITK_SHOW_CONSOLE_WINDOW "Use this to enable or disable the console window when starting MITK GUI Applications" ON)
mark_as_advanced(MITK_SHOW_CONSOLE_WINDOW)
# TODO: check if necessary
option(USE_ITKZLIB "Use the ITK zlib for pic compression." ON)
mark_as_advanced(USE_ITKZLIB)
if(NOT MITK_FAST_TESTING)
if(DEFINED MITK_CTEST_SCRIPT_MODE
AND (MITK_CTEST_SCRIPT_MODE STREQUAL "continuous" OR MITK_CTEST_SCRIPT_MODE STREQUAL "experimental") )
set(MITK_FAST_TESTING 1)
endif()
endif()
#-----------------------------------------------------------------------------
# Get MITK version info
#-----------------------------------------------------------------------------
mitkFunctionGetVersion(${MITK_SOURCE_DIR} MITK)
mitkFunctionGetVersionDescription(${MITK_SOURCE_DIR} MITK)
#-----------------------------------------------------------------------------
# Installation preparation
#
# These should be set before any MITK install macros are used
#-----------------------------------------------------------------------------
# on Mac OSX all BlueBerry plugins get copied into every
# application bundle (.app directory) specified here
if(MITK_USE_BLUEBERRY AND APPLE)
include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/AppList.cmake")
foreach(mitk_app ${MITK_APPS})
# extract option_name
string(REPLACE "^^" "\\;" target_info ${mitk_app})
set(target_info_list ${target_info})
list(GET target_info_list 1 option_name)
list(GET target_info_list 0 app_name)
# check if the application is enabled
if(${option_name} OR MITK_BUILD_ALL_APPS)
set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} ${app_name})
endif()
endforeach()
endif()
#-----------------------------------------------------------------------------
# Set symbol visibility Flags
#-----------------------------------------------------------------------------
# MinGW does not export all symbols automatically, so no need to set flags
if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
set(VISIBILITY_CXX_FLAGS ) #"-fvisibility=hidden -fvisibility-inlines-hidden")
endif()
#-----------------------------------------------------------------------------
# Set coverage Flags
#-----------------------------------------------------------------------------
if(WITH_COVERAGE)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(coverage_flags "-g -fprofile-arcs -ftest-coverage -O0 -DNDEBUG")
set(COVERAGE_CXX_FLAGS ${coverage_flags})
set(COVERAGE_C_FLAGS ${coverage_flags})
endif()
endif()
#-----------------------------------------------------------------------------
# MITK C/CXX Flags
#-----------------------------------------------------------------------------
set(MITK_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}")
set(MITK_CXX_FLAGS "${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
include(mitkSetupC++0xVariables)
set(cflags )
if(WIN32)
set(cflags "${cflags} -DPOCO_NO_UNWINDOWS -DWIN32_LEAN_AND_MEAN")
endif()
+if(NOT MSVC_VERSION)
+ foreach(_flag
+ -Wall
+ -Wextra
+ -Wpointer-arith
+ -Winvalid-pch
+ -Wcast-align
+ -Wwrite-strings
+ -Wno-gnu
+ -fdiagnostics-show-option
+ )
+ mitkFunctionCheckCompilerFlags(${_flag} cflags)
+ endforeach()
+endif()
if(CMAKE_COMPILER_IS_GNUCXX)
- set(cflags "${cflags} -Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings")
- mitkFunctionCheckCompilerFlags("-fdiagnostics-show-option" cflags)
mitkFunctionCheckCompilerFlags("-Wl,--no-undefined" cflags)
mitkFunctionCheckCompilerFlags("-Wl,--as-needed" cflags)
if(MITK_USE_C++0x)
mitkFunctionCheckCompilerFlags("-std=c++0x" MITK_CXX_FLAGS)
endif()
mitkFunctionGetGccVersion(${CMAKE_CXX_COMPILER} GCC_VERSION)
# With older version of gcc supporting the flag -fstack-protector-all, an extra dependency to libssp.so
# is introduced. If gcc is smaller than 4.4.0 and the build type is Release let's not include the flag.
# Doing so should allow to build package made for distribution using older linux distro.
if(${GCC_VERSION} VERSION_GREATER "4.4.0" OR (CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${GCC_VERSION} VERSION_LESS "4.4.0"))
mitkFunctionCheckCompilerFlags("-fstack-protector-all" cflags)
endif()
if(MINGW)
# suppress warnings about auto imported symbols
set(MITK_CXX_FLAGS "-Wl,--enable-auto-import ${MITK_CXX_FLAGS}")
# we need to define a Windows version
set(MITK_CXX_FLAGS "-D_WIN32_WINNT=0x0500 ${MITK_CXX_FLAGS}")
endif()
#set(MITK_CXX_FLAGS "-Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${MITK_CXX_FLAGS}")
set(MITK_CXX_FLAGS "-Woverloaded-virtual -Wstrict-null-sentinel ${MITK_CXX_FLAGS}")
set(MITK_CXX_FLAGS_RELEASE "-D_FORTIFY_SOURCE=2 ${MITK_CXX_FLAGS_RELEASE}")
endif()
set(MITK_C_FLAGS "${cflags} ${MITK_C_FLAGS}")
set(MITK_CXX_FLAGS "${cflags} ${MITK_CXX_FLAGS}")
#-----------------------------------------------------------------------------
# MITK Packages
#-----------------------------------------------------------------------------
set(MITK_MODULES_PACKAGE_DEPENDS_DIR ${MITK_SOURCE_DIR}/CMake/PackageDepends)
set(MODULES_PACKAGE_DEPENDS_DIRS ${MITK_MODULES_PACKAGE_DEPENDS_DIR})
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if(BUILD_TESTING)
enable_testing()
include(CTest)
mark_as_advanced(TCL_TCLSH DART_ROOT)
option(MITK_ENABLE_GUI_TESTING OFF "Enable the MITK GUI tests")
# Setup file for setting custom ctest vars
configure_file(
CMake/CTestCustom.cmake.in
${MITK_BINARY_DIR}/CTestCustom.cmake
@ONLY
)
# Configuration for the CMake-generated test driver
set(CMAKE_TESTDRIVER_EXTRA_INCLUDES "#include ")
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "
try
{")
set(CMAKE_TESTDRIVER_AFTER_TESTMAIN " }
catch( std::exception & excp )
{
fprintf(stderr,\"%s\\n\",excp.what());
return EXIT_FAILURE;
}
catch( ... )
{
printf(\"Exception caught in the test driver\\n\");
return EXIT_FAILURE;
}
")
set(MITK_TEST_OUTPUT_DIR "${MITK_BINARY_DIR}/test_output")
if(NOT EXISTS ${MITK_TEST_OUTPUT_DIR})
file(MAKE_DIRECTORY ${MITK_TEST_OUTPUT_DIR})
endif()
# Test the external project template
if(MITK_USE_BLUEBERRY)
include(mitkTestProjectTemplate)
endif()
# Test the package target
include(mitkPackageTest)
endif()
configure_file(mitkTestingConfig.h.in ${MITK_BINARY_DIR}/mitkTestingConfig.h)
#-----------------------------------------------------------------------------
# MITK_SUPERBUILD_BINARY_DIR
#-----------------------------------------------------------------------------
# If MITK_SUPERBUILD_BINARY_DIR isn't defined, it means MITK is *NOT* build using Superbuild.
# In that specific case, MITK_SUPERBUILD_BINARY_DIR should default to MITK_BINARY_DIR
if(NOT DEFINED MITK_SUPERBUILD_BINARY_DIR)
set(MITK_SUPERBUILD_BINARY_DIR ${MITK_BINARY_DIR})
endif()
#-----------------------------------------------------------------------------
# Compile Utilities and set-up MITK variables
#-----------------------------------------------------------------------------
include(mitkSetupVariables)
#-----------------------------------------------------------------------------
# Cleanup
#-----------------------------------------------------------------------------
file(GLOB _MODULES_CONF_FILES ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME}/*.cmake)
if(_MODULES_CONF_FILES)
file(REMOVE ${_MODULES_CONF_FILES})
endif()
add_subdirectory(Utilities)
if(MITK_USE_BLUEBERRY)
# We need to hack a little bit because MITK applications may need
# to enable certain BlueBerry plug-ins. However, these plug-ins
# are validated separately from the MITK plug-ins and know nothing
# about potential MITK plug-in dependencies of the applications. Hence
# we cannot pass the MITK application list to the BlueBerry
# ctkMacroSetupPlugins call but need to extract the BlueBerry dependencies
# from the applications and set them explicitly.
include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/AppList.cmake")
foreach(mitk_app ${MITK_APPS})
# extract target_dir and option_name
string(REPLACE "^^" "\\;" target_info ${mitk_app})
set(target_info_list ${target_info})
list(GET target_info_list 0 target_dir)
list(GET target_info_list 1 option_name)
# check if the application is enabled and if target_libraries.cmake exists
if((${option_name} OR MITK_BUILD_ALL_APPS) AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/target_libraries.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/target_libraries.cmake")
foreach(_target_dep ${target_libraries})
if(_target_dep MATCHES org_blueberry_)
string(REPLACE _ . _app_bb_dep ${_target_dep})
# explicitly set the build option for the BlueBerry plug-in
set(BLUEBERRY_BUILD_${_app_bb_dep} ON CACHE BOOL "Build the ${_app_bb_dep} plug-in")
endif()
endforeach()
endif()
endforeach()
set(mbilog_DIR "${mbilog_BINARY_DIR}")
if(MITK_BUILD_ALL_PLUGINS)
set(BLUEBERRY_BUILD_ALL_PLUGINS ON)
endif()
+ set(BLUEBERRY_XPDOC_OUTPUT_DIR ${MITK_DOXYGEN_OUTPUT_DIR}/html/extension-points/html/)
+
add_subdirectory(BlueBerry)
set(BlueBerry_DIR ${CMAKE_CURRENT_BINARY_DIR}/BlueBerry
CACHE PATH "The directory containing a CMake configuration file for BlueBerry" FORCE)
include(mitkMacroCreateCTKPlugin)
endif()
#-----------------------------------------------------------------------------
# Set C/CXX Flags for MITK code
#-----------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MITK_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MITK_CXX_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MITK_C_FLAGS}")
if(MITK_USE_QT)
add_definitions(-DQWT_DLL)
endif()
#-----------------------------------------------------------------------------
# Add custom targets representing CDash subprojects
#-----------------------------------------------------------------------------
foreach(subproject ${CTEST_PROJECT_SUBPROJECTS})
if(NOT TARGET ${subproject} AND NOT subproject MATCHES "Unlabeled")
add_custom_target(${subproject})
endif()
endforeach()
#-----------------------------------------------------------------------------
# Add subdirectories
#-----------------------------------------------------------------------------
link_directories(${MITK_LINK_DIRECTORIES})
add_subdirectory(Core)
include(${CMAKE_CURRENT_BINARY_DIR}/Core/Code/CppMicroServices/CppMicroServicesConfig.cmake)
add_subdirectory(Modules)
if(MITK_USE_BLUEBERRY)
find_package(BlueBerry REQUIRED)
set(MITK_DEFAULT_SUBPROJECTS MITK-Plugins)
# Plug-in testing (needs some work to be enabled again)
if(BUILD_TESTING)
include(berryTestingHelpers)
set(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp")
get_target_property(_is_macosx_bundle CoreApp MACOSX_BUNDLE)
if(APPLE AND _is_macosx_bundle)
set(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.app/Contents/MacOS/CoreApp")
endif()
set(BLUEBERRY_TEST_APP_ID "org.mitk.qt.coreapplication")
endif()
include("${CMAKE_CURRENT_SOURCE_DIR}/Plugins/PluginList.cmake")
set(mitk_plugins_fullpath )
foreach(mitk_plugin ${MITK_EXT_PLUGINS})
list(APPEND mitk_plugins_fullpath Plugins/${mitk_plugin})
endforeach()
if(EXISTS ${MITK_PRIVATE_MODULES}/PluginList.cmake)
include(${MITK_PRIVATE_MODULES}/PluginList.cmake)
foreach(mitk_plugin ${MITK_PRIVATE_PLUGINS})
list(APPEND mitk_plugins_fullpath ${MITK_PRIVATE_MODULES}/${mitk_plugin})
endforeach()
endif()
# Specify which plug-ins belong to this project
macro(GetMyTargetLibraries all_target_libraries varname)
set(re_ctkplugin_mitk "^org_mitk_[a-zA-Z0-9_]+$")
set(re_ctkplugin_bb "^org_blueberry_[a-zA-Z0-9_]+$")
set(_tmp_list)
list(APPEND _tmp_list ${all_target_libraries})
ctkMacroListFilter(_tmp_list re_ctkplugin_mitk re_ctkplugin_bb OUTPUT_VARIABLE ${varname})
endmacro()
# Get infos about application directories and build options
include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/AppList.cmake")
set(mitk_apps_fullpath )
foreach(mitk_app ${MITK_APPS})
list(APPEND mitk_apps_fullpath "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${mitk_app}")
endforeach()
ctkMacroSetupPlugins(${mitk_plugins_fullpath}
BUILD_OPTION_PREFIX MITK_BUILD_
APPS ${mitk_apps_fullpath}
BUILD_ALL ${MITK_BUILD_ALL_PLUGINS}
COMPACT_OPTIONS)
set(MITK_PLUGIN_USE_FILE "${MITK_BINARY_DIR}/MitkPluginUseFile.cmake")
if(${PROJECT_NAME}_PLUGIN_LIBRARIES)
ctkFunctionGeneratePluginUseFile(${MITK_PLUGIN_USE_FILE})
else()
file(REMOVE ${MITK_PLUGIN_USE_FILE})
set(MITK_PLUGIN_USE_FILE )
endif()
endif()
# Construct a list of paths containing runtime directories
# for MITK applications on Windows
set(MITK_RUNTIME_PATH
"${VTK_LIBRARY_DIRS}/%VS_BUILD_TYPE%;${ITK_LIBRARY_DIRS}/%VS_BUILD_TYPE%;${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/%VS_BUILD_TYPE%"
)
if(QT4_FOUND)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${QT_LIBRARY_DIR}/../bin")
endif()
if(MITK_USE_BLUEBERRY)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CTK_RUNTIME_LIBRARY_DIRS}/%VS_BUILD_TYPE%")
if(DEFINED CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY)
if(IS_ABSOLUTE "${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}")
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}/%VS_BUILD_TYPE%")
else()
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}/%VS_BUILD_TYPE%")
endif()
else()
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins/%VS_BUILD_TYPE%")
endif()
endif()
if(GDCM_DIR)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${GDCM_DIR}/bin/%VS_BUILD_TYPE%")
endif()
if(OpenCV_DIR)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${OpenCV_DIR}/bin/%VS_BUILD_TYPE%")
endif()
if(SOFA_DIR)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${SOFA_DIR}/bin/%VS_BUILD_TYPE%")
endif()
# DCMTK is statically build
#if(DCMTK_DIR)
# set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${DCMTK_DIR}/bin/%VS_BUILD_TYPE%")
#endif()
if(MITK_USE_Boost AND MITK_USE_Boost_LIBRARIES AND NOT MITK_USE_SYSTEM_Boost)
set(MITK_RUNTIME_PATH "${MITK_RUNTIME_PATH};${Boost_LIBRARY_DIRS}")
endif()
#-----------------------------------------------------------------------------
# Python Wrapping
#-----------------------------------------------------------------------------
set(MITK_WRAPPING_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Wrapping)
set(MITK_WRAPPING_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Wrapping)
option(MITK_USE_Python "Build cswig Python wrapper support (requires CableSwig)." OFF)
if(MITK_USE_Python)
add_subdirectory(Wrapping)
endif()
#-----------------------------------------------------------------------------
# Documentation
#-----------------------------------------------------------------------------
add_subdirectory(Documentation)
#-----------------------------------------------------------------------------
# Installation
#-----------------------------------------------------------------------------
# set MITK cpack variables
# These are the default variables, which can be overwritten ( see below )
include(mitkSetupCPack)
set(use_default_config ON)
# MITK_APPS is set in Applications/AppList.cmake (included somewhere above
# if MITK_USE_BLUEBERRY is set to ON).
if(MITK_APPS)
set(activated_apps_no 0)
list(LENGTH MITK_APPS app_count)
# Check how many apps have been enabled
# If more than one app has been activated, the we use the
# default CPack configuration. Otherwise that apps configuration
# will be used, if present.
foreach(mitk_app ${MITK_APPS})
# extract option_name
string(REPLACE "^^" "\\;" target_info ${mitk_app})
set(target_info_list ${target_info})
list(GET target_info_list 1 option_name)
# check if the application is enabled
if(${option_name} OR MITK_BUILD_ALL_APPS)
MATH(EXPR activated_apps_no "${activated_apps_no} + 1")
endif()
endforeach()
if(app_count EQUAL 1 AND (activated_apps_no EQUAL 1 OR MITK_BUILD_ALL_APPS))
# Corner case if there is only one app in total
set(use_project_cpack ON)
elseif(activated_apps_no EQUAL 1 AND NOT MITK_BUILD_ALL_APPS)
# Only one app is enabled (no "build all" flag set)
set(use_project_cpack ON)
else()
# Less or more then one app is enabled
set(use_project_cpack OFF)
endif()
foreach(mitk_app ${MITK_APPS})
# extract target_dir and option_name
string(REPLACE "^^" "\\;" target_info ${mitk_app})
set(target_info_list ${target_info})
list(GET target_info_list 0 target_dir)
list(GET target_info_list 1 option_name)
# check if the application is enabled
if(${option_name} OR MITK_BUILD_ALL_APPS)
# check whether application specific configuration files will be used
if(use_project_cpack)
# use files if they exist
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/CPackOptions.cmake")
include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/CPackOptions.cmake")
endif()
if(EXISTS "${PROJECT_SOURCE_DIR}/Applications/${target_dir}/CPackConfig.cmake.in")
set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/Applications/${target_dir}/CPackConfig.cmake")
configure_file(${PROJECT_SOURCE_DIR}/Applications/${target_dir}/CPackConfig.cmake.in
${CPACK_PROJECT_CONFIG_FILE} @ONLY)
set(use_default_config OFF)
endif()
endif()
# add link to the list
list(APPEND CPACK_CREATE_DESKTOP_LINKS "${target_dir}")
endif()
endforeach()
endif()
# if no application specific configuration file was used, use default
if(use_default_config)
configure_file(${MITK_SOURCE_DIR}/MITKCPackOptions.cmake.in
${MITK_BINARY_DIR}/MITKCPackOptions.cmake @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${MITK_BINARY_DIR}/MITKCPackOptions.cmake")
endif()
# include CPack model once all variables are set
include(CPack)
# Additional installation rules
include(mitkInstallRules)
#-----------------------------------------------------------------------------
# Last configuration steps
#-----------------------------------------------------------------------------
# This is for installation support of external projects depending on
# MITK plugins and modules. The export file should not be used for linking to MITK
# libraries without using LINK_DIRECTORIES, since the exports are incomplete
# yet (depending libraries are not exported).
set(MITK_EXPORTS_FILE "${MITK_BINARY_DIR}/MitkExports.cmake")
file(REMOVE ${MITK_EXPORTS_FILE})
set(targets_to_export)
get_property(module_targets GLOBAL PROPERTY MITK_MODULE_TARGETS)
if(module_targets)
list(APPEND targets_to_export ${module_targets})
endif()
if(MITK_USE_BLUEBERRY)
if(MITK_PLUGIN_LIBRARIES)
list(APPEND targets_to_export ${MITK_PLUGIN_LIBRARIES})
endif()
endif()
export(TARGETS ${targets_to_export} APPEND
FILE ${MITK_EXPORTS_FILE})
set(MITK_EXPORTED_TARGET_PROPERTIES )
foreach(target_to_export ${targets_to_export})
get_target_property(autoload_targets ${target_to_export} MITK_AUTOLOAD_TARGETS)
if(autoload_targets)
set(MITK_EXPORTED_TARGET_PROPERTIES "${MITK_EXPORTED_TARGET_PROPERTIES}
set_target_properties(${target_to_export} PROPERTIES MITK_AUTOLOAD_TARGETS \"${autoload_targets}\")")
endif()
get_target_property(autoload_dir ${target_to_export} MITK_AUTOLOAD_DIRECTORY)
if(autoload_dir)
set(MITK_EXPORTED_TARGET_PROPERTIES "${MITK_EXPORTED_TARGET_PROPERTIES}
set_target_properties(${target_to_export} PROPERTIES MITK_AUTOLOAD_DIRECTORY \"${autoload_dir}\")")
endif()
endforeach()
configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactory.cpp.in
${MITK_BINARY_DIR}/ToolExtensionITKFactory.cpp.in COPYONLY)
configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactoryLoader.cpp.in
${MITK_BINARY_DIR}/ToolExtensionITKFactoryLoader.cpp.in COPYONLY)
configure_file(${MITK_SOURCE_DIR}/CMake/ToolGUIExtensionITKFactory.cpp.in
${MITK_BINARY_DIR}/ToolGUIExtensionITKFactory.cpp.in COPYONLY)
set(VISIBILITY_AVAILABLE 0)
set(visibility_test_flag "")
mitkFunctionCheckCompilerFlags("-fvisibility=hidden" visibility_test_flag)
if(visibility_test_flag)
# The compiler understands -fvisiblity=hidden (probably gcc >= 4 or Clang)
set(VISIBILITY_AVAILABLE 1)
endif()
configure_file(mitkExportMacros.h.in ${MITK_BINARY_DIR}/mitkExportMacros.h)
configure_file(mitkVersion.h.in ${MITK_BINARY_DIR}/mitkVersion.h)
configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h)
set(VECMATH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/vecmath)
set(IPFUNC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipFunc)
set(UTILITIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
file(GLOB _MODULES_CONF_FILES RELATIVE ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME} ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME}/*.cmake)
set(MITK_MODULE_NAMES)
foreach(_module ${_MODULES_CONF_FILES})
string(REPLACE Config.cmake "" _module_name ${_module})
list(APPEND MITK_MODULE_NAMES ${_module_name})
endforeach()
configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h)
configure_file(MITKConfig.cmake.in ${MITK_BINARY_DIR}/MITKConfig.cmake @ONLY)
# If we are under Windows, create two batch files which correctly
# set up the environment for the application and for Visual Studio
if(WIN32)
include(mitkFunctionCreateWindowsBatchScript)
set(VS_SOLUTION_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.sln")
foreach(VS_BUILD_TYPE debug release)
mitkFunctionCreateWindowsBatchScript("${MITK_SOURCE_DIR}/CMake/StartVS.bat.in"
${PROJECT_BINARY_DIR}/StartVS_${VS_BUILD_TYPE}.bat
${VS_BUILD_TYPE})
endforeach()
endif(WIN32)
#-----------------------------------------------------------------------------
# MITK Applications
#-----------------------------------------------------------------------------
# This must come after MITKConfig.h was generated, since applications
# might do a find_package(MITK REQUIRED).
add_subdirectory(Applications)
#-----------------------------------------------------------------------------
# MITK Examples
#-----------------------------------------------------------------------------
if(MITK_BUILD_EXAMPLES)
# This must come after MITKConfig.h was generated, since applications
# might do a find_package(MITK REQUIRED).
add_subdirectory(Examples)
endif()
diff --git a/Core/Code/CppMicroServices/CMake/usCTestScript.cmake b/Core/Code/CppMicroServices/CMake/usCTestScript.cmake
index af6ee829a7..7feac62e8e 100644
--- a/Core/Code/CppMicroServices/CMake/usCTestScript.cmake
+++ b/Core/Code/CppMicroServices/CMake/usCTestScript.cmake
@@ -1,131 +1,131 @@
macro(build_and_test)
set(CTEST_SOURCE_DIRECTORY ${US_SOURCE_DIR})
set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_PROJECT_NAME}_${CTEST_DASHBOARD_NAME}")
#if(NOT CTEST_BUILD_NAME)
# set(CTEST_BUILD_NAME "${CMAKE_SYSTEM}_${CTEST_COMPILER}_${CTEST_DASHBOARD_NAME}")
#endif()
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
ctest_start("Experimental")
if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt")
file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "${CTEST_INITIAL_CACHE}")
endif()
ctest_configure(RETURN_VALUE res)
if (res)
message(FATAL_ERROR "CMake configure error")
endif()
ctest_build(RETURN_VALUE res)
if (res)
message(FATAL_ERROR "CMake build error")
endif()
ctest_test(RETURN_VALUE res PARALLEL_LEVEL ${CTEST_PARALLEL_LEVEL})
if (res)
message(FATAL_ERROR "CMake test error")
endif()
if(WITH_MEMCHECK AND CTEST_MEMORYCHECK_COMMAND)
ctest_memcheck()
endif()
if(WITH_COVERAGE AND CTEST_COVERAGE_COMMAND)
ctest_coverage()
endif()
#ctest_submit()
endmacro()
-function(create_initial_cache var _shared _threading _sf _c++11 _autoload)
+function(create_initial_cache var _shared _threading _sf _cxx11 _autoload)
set(_initial_cache "
US_BUILD_TESTING:BOOL=ON
US_BUILD_SHARED_LIBS:BOOL=${_shared}
US_ENABLE_THREADING_SUPPORT:BOOL=${_threading}
US_ENABLE_SERVICE_FACTORY_SUPPORT:BOOL=${_sf}
- US_USE_C++11:BOOL=${_c++11}
+ US_USE_C++11:BOOL=${_cxx11}
US_ENABLE_AUTOLOADING_SUPPORT:BOOL=${_autoload}
")
set(${var} ${_initial_cache} PARENT_SCOPE)
if(_shared)
set(CTEST_DASHBOARD_NAME "shared")
else()
set(CTEST_DASHBOARD_NAME "static")
endif()
if(_threading)
set(CTEST_DASHBOARD_NAME "${CTEST_DASHBOARD_NAME}-threading")
endif()
if(_sf)
set(CTEST_DASHBOARD_NAME "${CTEST_DASHBOARD_NAME}-servicefactory")
endif()
- if(_c++11)
+ if(_cxx11)
set(CTEST_DASHBOARD_NAME "${CTEST_DASHBOARD_NAME}-cxx11")
endif()
if(_autoload)
set(CTEST_DASHBOARD_NAME "${CTEST_DASHBOARD_NAME}-autoloading")
endif()
set(CTEST_DASHBOARD_NAME ${CTEST_DASHBOARD_NAME} PARENT_SCOPE)
endfunction()
#=========================================================
set(CTEST_PROJECT_NAME CppMicroServices)
if(NOT CTEST_PARALLEL_LEVEL)
set(CTEST_PARALLEL_LEVEL 1)
endif()
# SHARED THREADING SERVICE_FACTORY C++11 AUTOLOAD
set(config0 0 0 0 0 0 )
set(config1 0 0 0 0 1 )
set(config2 0 0 0 1 0 )
set(config3 0 0 0 1 1 )
set(config4 0 0 1 0 0 )
set(config5 0 0 1 0 1 )
set(config6 0 0 1 1 0 )
set(config7 0 0 1 1 1 )
set(config8 0 1 0 0 0 )
set(config9 0 1 0 0 1 )
set(config10 0 1 0 1 0 )
set(config11 0 1 0 1 1 )
set(config12 0 1 1 0 0 )
set(config13 0 1 1 0 1 )
set(config14 0 1 1 1 0 )
set(config15 0 1 1 1 1 )
set(config16 1 0 0 0 0 )
set(config17 1 0 0 0 1 )
set(config18 1 0 0 1 0 )
set(config19 1 0 0 1 1 )
set(config20 1 0 1 0 0 )
set(config21 1 0 1 0 1 )
set(config22 1 0 1 1 0 )
set(config23 1 0 1 1 1 )
set(config24 1 1 0 0 0 )
set(config25 1 1 0 0 1 )
set(config26 1 1 0 1 0 )
set(config27 1 1 0 1 1 )
set(config28 1 1 1 0 0 )
set(config29 1 1 1 0 1 )
set(config30 1 1 1 1 0 )
set(config31 1 1 1 1 1 )
foreach(i ${US_BUILD_CONFIGURATION})
create_initial_cache(CTEST_INITIAL_CACHE ${config${i}})
message("Testing build configuration: ${CTEST_DASHBOARD_NAME}")
build_and_test()
endforeach()
diff --git a/Core/Code/CppMicroServices/CMakeLists.txt b/Core/Code/CppMicroServices/CMakeLists.txt
index 502194688a..be5a542de2 100644
--- a/Core/Code/CppMicroServices/CMakeLists.txt
+++ b/Core/Code/CppMicroServices/CMakeLists.txt
@@ -1,357 +1,358 @@
project(CppMicroServices)
set(${PROJECT_NAME}_MAJOR_VERSION 0)
set(${PROJECT_NAME}_MINOR_VERSION 99)
set(${PROJECT_NAME}_PATCH_VERSION 0)
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION})
cmake_minimum_required(VERSION 2.8)
#-----------------------------------------------------------------------------
# Update CMake module path
#------------------------------------------------------------------------------
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/CMake
${CMAKE_MODULE_PATH}
)
#-----------------------------------------------------------------------------
# CMake function(s) and macro(s)
#-----------------------------------------------------------------------------
include(MacroParseArguments)
include(CheckCXXSourceCompiles)
include(usFunctionCheckCompilerFlags)
include(usFunctionEmbedResources)
include(usFunctionGetGccVersion)
include(usFunctionGenerateModuleInit)
#-----------------------------------------------------------------------------
# Init output directories
#-----------------------------------------------------------------------------
set(US_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
set(US_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
set(US_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
foreach(_type ARCHIVE LIBRARY RUNTIME)
if(NOT CMAKE_${_type}_OUTPUT_DIRECTORY)
set(CMAKE_${_type}_OUTPUT_DIRECTORY ${US_${_type}_OUTPUT_DIRECTORY})
endif()
endforeach()
#-----------------------------------------------------------------------------
# Set a default build type if none was specified
#-----------------------------------------------------------------------------
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
#-----------------------------------------------------------------------------
# CMake options
#-----------------------------------------------------------------------------
function(us_cache_var _var_name _var_default _var_type _var_help)
set(_advanced 0)
set(_force)
foreach(_argn ${ARGN})
if(_argn STREQUAL ADVANCED)
set(_advanced 1)
elseif(_argn STREQUAL FORCE)
set(_force FORCE)
endif()
endforeach()
if(US_IS_EMBEDDED)
if(NOT DEFINED ${_var_name} OR _force)
set(${_var_name} ${_var_default} PARENT_SCOPE)
endif()
else()
set(${_var_name} ${_var_default} CACHE ${_var_type} "${_var_help}" ${_force})
if(_advanced)
mark_as_advanced(${_var_name})
endif()
endif()
endfunction()
# Determine if we are being build inside a larger project
if(NOT DEFINED US_IS_EMBEDDED)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(US_IS_EMBEDDED 0)
else()
set(US_IS_EMBEDDED 1)
set(CppMicroServices_EXPORTS 1)
endif()
endif()
us_cache_var(US_ENABLE_AUTOLOADING_SUPPORT OFF BOOL "Enable module auto-loading support")
us_cache_var(US_ENABLE_SERVICE_FACTORY_SUPPORT ON BOOL "Enable Service Factory support" ADVANCED)
us_cache_var(US_ENABLE_THREADING_SUPPORT OFF BOOL "Enable threading support")
+us_cache_var(US_ENABLE_DEBUG_OUTPUT OFF BOOL "Enable debug messages" ADVANCED)
us_cache_var(US_BUILD_SHARED_LIBS ON BOOL "Build shared libraries")
us_cache_var(US_BUILD_TESTING OFF BOOL "Build tests")
if(MSVC10 OR MSVC11)
# Visual Studio 2010 and newer have support for C++11 enabled by default
set(US_USE_C++11 1)
else()
us_cache_var(US_USE_C++11 OFF BOOL "Enable the use of C++11 features" ADVANCED)
endif()
us_cache_var(US_NAMESPACE "us" STRING "The namespace for the C++ micro services entities")
us_cache_var(US_HEADER_PREFIX "" STRING "The file name prefix for the public C++ micro services header files")
us_cache_var(US_BASECLASS_NAME "" STRING "The fully-qualified name of the base class")
if(US_ENABLE_SERVICE_FACTORY_SUPPORT)
us_cache_var(US_BASECLASS_PACKAGE "" STRING "The name of the package providing the base class definition" ADVANCED)
set(bc_inc_d_doc "A list of include directories containing the header files for the base class")
us_cache_var(US_BASECLASS_INCLUDE_DIRS "" STRING "${bc_inc_d_doc}" ADVANCED)
set(bc_lib_d_doc "A list of library directories for the base class")
us_cache_var(US_BASECLASS_LIBRARY_DIRS "" STRING "${bc_lib_d_doc}" ADVANCED)
set(bc_lib_doc "A list of libraries needed for the base class")
us_cache_var(US_BASECLASS_LIBRARIES "" STRING "${bc_lib_doc}" ADVANCED)
us_cache_var(US_BASECLASS_HEADER "" STRING "The name of the header file containing the base class declaration" ADVANCED)
endif()
set(BUILD_SHARED_LIBS ${US_BUILD_SHARED_LIBS})
# Sanity checks
if(US_ENABLE_SERVICE_FACTORY_SUPPORT OR US_BUILD_TESTING)
if(US_BASECLASS_PACKAGE)
find_package(${US_BASECLASS_PACKAGE} REQUIRED)
# Try to get the include dirs
foreach(_suffix DIRECTORIES DIRS DIRECTORY DIR)
if(${US_BASECLASS_PACKAGE}_INCLUDE_${_suffix} AND NOT US_BASECLASS_INCLUDE_DIRS)
us_cache_var(US_BASECLASS_INCLUDE_DIRS "${${US_BASECLASS_PACKAGE}_INCLUDE_${_suffix}}" STRING "${bc_inc_d_doc}" FORCE)
break()
endif()
endforeach()
# Try to get the library dirs
foreach(_suffix DIRECTORIES DIRS DIRECTORY DIR)
if(${US_BASECLASS_PACKAGE}_LIBRARY_${_suffix} AND NOT US_BASECLASS_LIBRARY_DIRS)
us_cache_var(US_BASECLASS_LIBRARY_DIRS "${${US_BASECLASS_PACKAGE}_LIBRARY_${_suffix}}" STRING "${bc_lib_d_doc}" FORCE)
break()
endif()
endforeach()
# Try to get the libraries
foreach(_suffix LIBRARIES LIBS LIBRARY LIB)
if(${US_BASECLASS_PACKAGE}_${_suffix} AND NOT US_BASECLASS_LIBRARIES)
us_cache_var(US_BASECLASS_LIBRARIES "${${US_BASECLASS_PACKAGE}_${_suffix}}" STRING "${bc_lib_doc}" FORCE)
break()
endif()
endforeach()
if(NOT US_BASECLASS_NAME)
message(FATAL_ERROR "US_BASECLASS_NAME not set")
elseif(NOT US_BASECLASS_HEADER)
message(FATAL_ERROR "US_BASECLASS_HEADER not set")
endif()
endif()
if(US_ENABLE_SERVICE_FACTORY_SUPPORT AND US_BASECLASS_NAME AND NOT US_BASECLASS_HEADER)
message(FATAL_ERROR "US_ENABLE_SERVICE_FACTORY_SUPPORT requires a US_BASECLASS_HEADER value")
endif()
endif()
set(_us_baseclass_default 0)
if(NOT US_BASECLASS_NAME)
message(WARNING "Using build in base class \"::${US_NAMESPACE}::Base\"")
set(_us_baseclass_default 1)
set(US_BASECLASS_NAME "${US_NAMESPACE}::Base")
set(US_BASECLASS_HEADER "usBase.h")
endif()
if(US_BUILD_TESTING AND US_BASECLASS_NAME AND NOT US_BASECLASS_HEADER)
message(FATAL_ERROR "US_BUILD_TESTING requires a US_BASECLASS_HEADER value")
endif()
set(US_BASECLASS_INCLUDE "#include <${US_BASECLASS_HEADER}>")
string(REPLACE "::" ";" _bc_token "${US_BASECLASS_NAME}")
list(GET _bc_token -1 _bc_name)
list(REMOVE_AT _bc_token -1)
set(US_BASECLASS_FORWARD_DECLARATION "")
foreach(_namespace_tok ${_bc_token})
if(_namespace_tok)
set(US_BASECLASS_FORWARD_DECLARATION "${US_BASECLASS_FORWARD_DECLARATION}namespace ${_namespace_tok} { ")
endif()
endforeach()
set(US_BASECLASS_FORWARD_DECLARATION "${US_BASECLASS_FORWARD_DECLARATION}class ${_bc_name}; ")
foreach(_namespace_tok ${_bc_token})
if(_namespace_tok)
set(US_BASECLASS_FORWARD_DECLARATION "${US_BASECLASS_FORWARD_DECLARATION}}")
endif()
endforeach()
#-----------------------------------------------------------------------------
# US C/CXX Flags
#-----------------------------------------------------------------------------
set(US_C_FLAGS "${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}")
set(US_CXX_FLAGS "${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
# This is used as a preprocessor define
set(US_USE_CXX11 ${US_USE_C++11})
# Set C++ compiler flags
if(NOT MSVC)
foreach(_cxxflag -Werror -Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align
-Wwrite-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast
-Wstrict-null-sentinel -Wsign-promo -fdiagnostics-show-option -D_FORTIFY_SOURCE=2)
usFunctionCheckCompilerFlags(${_cxxflag} US_CXX_FLAGS)
endforeach()
if(US_USE_C++11)
usFunctionCheckCompilerFlags("-std=c++0x" US_CXX_FLAGS)
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
usFunctionGetGccVersion(${CMAKE_CXX_COMPILER} GCC_VERSION)
# With older versions of gcc the flag -fstack-protector-all requires an extra dependency to libssp.so.
# If the gcc version is lower than 4.4.0 and the build type is Release let's not include the flag.
if(${GCC_VERSION} VERSION_GREATER "4.4.0" OR (CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${GCC_VERSION} VERSION_LESS "4.4.0"))
usFunctionCheckCompilerFlags("-fstack-protector-all" US_CXX_FLAGS)
endif()
if(MINGW)
# suppress warnings about auto imported symbols
set(US_CXX_FLAGS "-Wl,--enable-auto-import ${US_CXX_FLAGS}")
# we need to define a Windows version
set(US_CXX_FLAGS "-D_WIN32_WINNT=0x0500 ${US_CXX_FLAGS}")
else()
# Enable visibility support
if(NOT ${GCC_VERSION} VERSION_LESS "4.5")
usFunctionCheckCompilerFlags("-fvisibility=hidden -fvisibility-inlines-hidden" US_CXX_FLAGS)
endif()
endif()
elseif(MSVC)
set(US_CXX_FLAGS "/MP /wd4996 ${US_CXX_FLAGS}")
endif()
if(NOT US_IS_EMBEDDED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${US_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${US_C_FLAGS}")
endif()
#-----------------------------------------------------------------------------
# US Link Flags
#-----------------------------------------------------------------------------
set(US_LINK_FLAGS )
if(NOT MSVC)
foreach(_linkflag -Wl,--no-undefined)
set(_add_flag)
usFunctionCheckCompilerFlags("${_linkflag}" _add_flag)
if(_add_flag)
set(US_LINK_FLAGS "${US_LINK_FLAGS} ${_linkflag}")
endif()
endforeach()
endif()
#-----------------------------------------------------------------------------
# US Header Checks
#-----------------------------------------------------------------------------
include(CheckIncludeFile)
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT)
#-----------------------------------------------------------------------------
# US include dirs and libraries
#-----------------------------------------------------------------------------
set(US_INCLUDE_DIRS
${PROJECT_BINARY_DIR}/include
)
set(US_INTERNAL_INCLUDE_DIRS
${PROJECT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src/util
${CMAKE_CURRENT_SOURCE_DIR}/src/service
${CMAKE_CURRENT_SOURCE_DIR}/src/module
)
if(US_ENABLE_SERVICE_FACTORY_SUPPORT)
list(APPEND US_INTERNAL_INCLUDE_DIRS ${US_BASECLASS_INCLUDE_DIRS})
endif()
# link libraries for third party libs
if(US_IS_EMBEDDED)
set(US_LINK_LIBRARIES ${US_EMBEDDING_LIBRARY})
else()
set(US_LINK_LIBRARIES ${PROJECT_NAME})
endif()
# link libraries for the CppMicroServices lib
set(_link_libraries )
if(UNIX)
list(APPEND _link_libraries dl)
endif()
list(APPEND US_LINK_LIBRARIES ${_link_libraries})
if(US_ENABLE_SERVICE_FACTORY_SUPPORT)
list(APPEND US_LINK_LIBRARIES ${US_BASECLASS_LIBRARIES})
endif()
set(US_LINK_DIRS )
if(US_ENABLE_SERVICE_FACTORY_SUPPORT)
list(APPEND US_LINK_DIRS ${US_BASECLASS_LIBRARY_DIRS})
endif()
#-----------------------------------------------------------------------------
# Source directory
#-----------------------------------------------------------------------------
set(us_config_h_file "${PROJECT_BINARY_DIR}/include/usConfig.h")
configure_file(usConfig.h.in ${us_config_h_file})
set(US_RCC_EXECUTABLE_NAME usResourceCompiler)
set(CppMicroServices_RCC_EXECUTABLE_NAME ${US_RCC_EXECUTABLE_NAME})
set(US_RCC_EXECUTABLE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${US_RCC_EXECUTABLE_NAME}")
set(CppMicroServices_RCC_EXECUTABLE ${US_RCC_EXECUTABLE})
add_subdirectory(tools)
add_subdirectory(src)
#-----------------------------------------------------------------------------
# US testing
#-----------------------------------------------------------------------------
if(US_BUILD_TESTING)
enable_testing()
add_subdirectory(test)
endif()
#-----------------------------------------------------------------------------
# Documentation
#-----------------------------------------------------------------------------
add_subdirectory(documentation)
#-----------------------------------------------------------------------------
# Last configuration steps
#-----------------------------------------------------------------------------
configure_file(${PROJECT_NAME}Config.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake @ONLY)
diff --git a/Core/Code/CppMicroServices/documentation/doxygen/MicroServices_Debugging.dox b/Core/Code/CppMicroServices/documentation/doxygen/MicroServices_Debugging.dox
index 9e3c9ed92e..4e3c735c8f 100644
--- a/Core/Code/CppMicroServices/documentation/doxygen/MicroServices_Debugging.dox
+++ b/Core/Code/CppMicroServices/documentation/doxygen/MicroServices_Debugging.dox
@@ -1,69 +1,70 @@
/**
* \ingroup MicroServicesUtils
*
* \enum MsgType
* This enum describes the messages that can be sent to a message handler (MsgHandler).
* You can use the enum to identify and associate the various message types with the
* appropriate actions.
*/
-
+
/**
* \ingroup MicroServicesUtils
*
* \var MsgType DebugMsg
* A debug message.
*/
-
+
/**
* \ingroup MicroServicesUtils
*
* \var MsgType InfoMsg
* An informational message.
*/
-
+
/**
* \ingroup MicroServicesUtils
*
* \var MsgType WarningMsg
* A warning message.
*/
-
+
/**
* \ingroup MicroServicesUtils
*
* \var MsgType ErrorMsg
* An error message.
*/
-
+
/**
* \ingroup MicroServicesUtils
*
* \typedef MsgHandler
* A message handler callback function.
*/
-
+
/**
* \ingroup MicroServicesUtils
*
* \fn MsgHandler installMsgHandler(MsgHandler)
* \brief Installs a message handler which has been defined previously.
*
* Returns a pointer to the previous message handler (which may be 0).
*
* The message handler is a function that prints out debug messages, warnings,
* and fatal error messages. The C++ Micro Services library (debug mode) contains
* warning messages that are printed when internal errors (usually invalid function
* arguments) occur. The library built in release mode also contains such warnings
- * unless US_NO_WARNING_OUTPUT and/or US_NO_DEBUG_OUTPUT have been set during
- * compilation. If you implement your own message handler, you get total control of
- * these messages.
+ * unless US_NO_WARNING_OUTPUT has been set during compilation. In both debug and release mode
+ * debugging message are suppressed by default, unless US_ENABLE_DEBUGGING_OUTPUT
+ * has been set during compilation. If you implement your own message handler,
+ * you get total control of these messages.
*
* The default message handler prints the message to the standard output. If it is
* an error message, the application aborts immediately.
*
* Only one message handler can be defined, since this is usually done on an
* application-wide basis to control debug output.
*
* To restore the message handler, call installMsgHandler(0).
*/
diff --git a/Core/Code/CppMicroServices/src/module/usModuleAbstractTracked.tpp b/Core/Code/CppMicroServices/src/module/usModuleAbstractTracked.tpp
index a40324c462..d344538f03 100644
--- a/Core/Code/CppMicroServices/src/module/usModuleAbstractTracked.tpp
+++ b/Core/Code/CppMicroServices/src/module/usModuleAbstractTracked.tpp
@@ -1,314 +1,314 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include
US_BEGIN_NAMESPACE
template
-const bool ModuleAbstractTracked::DEBUG = false;
+const bool ModuleAbstractTracked::DEBUG_OUTPUT = false;
template
ModuleAbstractTracked::ModuleAbstractTracked()
{
closed = false;
}
template
ModuleAbstractTracked::~ModuleAbstractTracked()
{
}
template
void ModuleAbstractTracked::SetInitial(const std::list& initiallist)
{
initial = initiallist;
- if (DEBUG)
+ if (DEBUG_OUTPUT)
{
for(typename std::list::const_iterator item = initiallist.begin();
item != initiallist.end(); ++item)
{
US_DEBUG << "ModuleAbstractTracked::setInitial: " << (*item);
}
}
}
template
void ModuleAbstractTracked::TrackInitial()
{
while (true)
{
S item(0);
{
typename Self::Lock l(this);
if (closed || (initial.size() == 0))
{
/*
* if there are no more initial items
*/
return; /* we are done */
}
/*
* move the first item from the initial list to the adding list
* within this synchronized block.
*/
item = initial.front();
initial.pop_front();
if (tracked[item])
{
/* if we are already tracking this item */
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::trackInitial[already tracked]: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::trackInitial[already tracked]: " << item;
continue; /* skip this item */
}
if (std::find(adding.begin(), adding.end(), item) != adding.end())
{
/*
* if this item is already in the process of being added.
*/
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::trackInitial[already adding]: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::trackInitial[already adding]: " << item;
continue; /* skip this item */
}
adding.push_back(item);
}
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::trackInitial: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::trackInitial: " << item;
TrackAdding(item, R());
/*
* Begin tracking it. We call trackAdding
* since we have already put the item in the
* adding list.
*/
}
}
template
void ModuleAbstractTracked::Close()
{
closed = true;
}
template
void ModuleAbstractTracked::Track(S item, R related)
{
T object(0);
{
typename Self::Lock l(this);
if (closed)
{
return;
}
object = tracked[item];
if (!object)
{ /* we are not tracking the item */
if (std::find(adding.begin(), adding.end(),item) != adding.end())
{
/* if this item is already in the process of being added. */
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::track[already adding]: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::track[already adding]: " << item;
return;
}
adding.push_back(item); /* mark this item is being added */
}
else
{ /* we are currently tracking this item */
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::track[modified]: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::track[modified]: " << item;
Modified(); /* increment modification count */
}
}
if (!object)
{ /* we are not tracking the item */
TrackAdding(item, related);
}
else
{
/* Call customizer outside of synchronized region */
CustomizerModified(item, related, object);
/*
* If the customizer throws an unchecked exception, it is safe to
* let it propagate
*/
}
}
template
void ModuleAbstractTracked::Untrack(S item, R related)
{
T object(0);
{
typename Self::Lock l(this);
std::size_t initialSize = initial.size();
initial.remove(item);
if (initialSize != initial.size())
{ /* if this item is already in the list
* of initial references to process
*/
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::untrack[removed from initial]: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::untrack[removed from initial]: " << item;
return; /* we have removed it from the list and it will not be
* processed
*/
}
std::size_t addingSize = adding.size();
adding.remove(item);
if (addingSize != adding.size())
{ /* if the item is in the process of
* being added
*/
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::untrack[being added]: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::untrack[being added]: " << item;
return; /*
* in case the item is untracked while in the process of
* adding
*/
}
object = tracked[item];
/*
* must remove from tracker before
* calling customizer callback
*/
tracked.erase(item);
if (!object)
{ /* are we actually tracking the item */
return;
}
Modified(); /* increment modification count */
}
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::untrack[removed]: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::untrack[removed]: " << item;
/* Call customizer outside of synchronized region */
CustomizerRemoved(item, related, object);
/*
* If the customizer throws an unchecked exception, it is safe to let it
* propagate
*/
}
template
std::size_t ModuleAbstractTracked::Size() const
{
return tracked.size();
}
template
bool ModuleAbstractTracked::IsEmpty() const
{
return tracked.empty();
}
template
T ModuleAbstractTracked::GetCustomizedObject(S item) const
{
typename TrackingMap::const_iterator i = tracked.find(item);
if (i != tracked.end()) return i->second;
return T();
}
template
void ModuleAbstractTracked::GetTracked(std::list& items) const
{
for (typename TrackingMap::const_iterator i = tracked.begin();
i != tracked.end(); ++i)
{
items.push_back(i->first);
}
}
template
void ModuleAbstractTracked::Modified()
{
trackingCount.Ref();
}
template
int ModuleAbstractTracked::GetTrackingCount() const
{
return trackingCount;
}
template
void ModuleAbstractTracked::CopyEntries(TrackingMap& map) const
{
map.insert(tracked.begin(), tracked.end());
}
template
bool ModuleAbstractTracked::CustomizerAddingFinal(S item, const T& custom)
{
typename Self::Lock l(this);
std::size_t addingSize = adding.size();
adding.remove(item);
if (addingSize != adding.size() && !closed)
{
/*
* if the item was not untracked during the customizer
* callback
*/
if (custom)
{
tracked[item] = custom;
Modified(); /* increment modification count */
this->NotifyAll(); /* notify any waiters */
}
return false;
}
else
{
return true;
}
}
template
void ModuleAbstractTracked::TrackAdding(S item, R related)
{
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::trackAdding:" << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::trackAdding:" << item;
T object(0);
bool becameUntracked = false;
/* Call customizer outside of synchronized region */
try
{
object = CustomizerAdding(item, related);
becameUntracked = this->CustomizerAddingFinal(item, object);
}
catch (...)
{
/*
* If the customizer throws an exception, it will
* propagate after the cleanup code.
*/
this->CustomizerAddingFinal(item, object);
throw;
}
/*
* The item became untracked during the customizer callback.
*/
if (becameUntracked && object)
{
- US_DEBUG(DEBUG) << "ModuleAbstractTracked::trackAdding[removed]: " << item;
+ US_DEBUG(DEBUG_OUTPUT) << "ModuleAbstractTracked::trackAdding[removed]: " << item;
/* Call customizer outside of synchronized region */
CustomizerRemoved(item, related, object);
/*
* If the customizer throws an unchecked exception, it is safe to
* let it propagate
*/
}
}
US_END_NAMESPACE
diff --git a/Core/Code/CppMicroServices/src/module/usModuleAbstractTracked_p.h b/Core/Code/CppMicroServices/src/module/usModuleAbstractTracked_p.h
index 982c97d99d..ccdc3627d4 100644
--- a/Core/Code/CppMicroServices/src/module/usModuleAbstractTracked_p.h
+++ b/Core/Code/CppMicroServices/src/module/usModuleAbstractTracked_p.h
@@ -1,291 +1,291 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#ifndef USMODULEABSTRACTTRACKED_H
#define USMODULEABSTRACTTRACKED_H
#include
#include "usAtomicInt_p.h"
#include "usAny.h"
US_BEGIN_NAMESPACE
/**
* This class is not intended to be used directly. It is exported to support
* the CppMicroServices module system.
*
* Abstract class to track items. If a Tracker is reused (closed then reopened),
* then a new ModuleAbstractTracked object is used. This class acts as a map of tracked
* item -> customized object. Subclasses of this class will act as the listener
* object for the tracker. This class is used to synchronize access to the
* tracked items. This is not a public class. It is only for use by the
* implementation of the Tracker class.
*
* @tparam S The tracked item. It is the key.
* @tparam T The value mapped to the tracked item.
* @tparam R The reason the tracked item is being tracked or untracked.
* @ThreadSafe
*/
template
class ModuleAbstractTracked : public US_DEFAULT_THREADING >
{
public:
/* set this to true to compile in debug messages */
- static const bool DEBUG; // = false;
+ static const bool DEBUG_OUTPUT; // = false;
typedef std::map TrackingMap;
/**
* ModuleAbstractTracked constructor.
*/
ModuleAbstractTracked();
virtual ~ModuleAbstractTracked();
/**
* Set initial list of items into tracker before events begin to be
* received.
*
* This method must be called from Tracker's open method while synchronized
* on this object in the same synchronized block as the add listener call.
*
* @param list The initial list of items to be tracked. null
* entries in the list are ignored.
* @GuardedBy this
*/
void SetInitial(const std::list& list);
/**
* Track the initial list of items. This is called after events can begin to
* be received.
*
* This method must be called from Tracker's open method while not
* synchronized on this object after the add listener call.
*
*/
void TrackInitial();
/**
* Called by the owning Tracker object when it is closed.
*/
void Close();
/**
* Begin to track an item.
*
* @param item S to be tracked.
* @param related Action related object.
*/
void Track(S item, R related);
/**
* Discontinue tracking the item.
*
* @param item S to be untracked.
* @param related Action related object.
*/
void Untrack(S item, R related);
/**
* Returns the number of tracked items.
*
* @return The number of tracked items.
*
* @GuardedBy this
*/
std::size_t Size() const;
/**
* Returns if the tracker is empty.
*
* @return Whether the tracker is empty.
*
* @GuardedBy this
*/
bool IsEmpty() const;
/**
* Return the customized object for the specified item
*
* @param item The item to lookup in the map
* @return The customized object for the specified item.
*
* @GuardedBy this
*/
T GetCustomizedObject(S item) const;
/**
* Return the list of tracked items.
*
* @return The tracked items.
* @GuardedBy this
*/
void GetTracked(std::list& items) const;
/**
* Increment the modification count. If this method is overridden, the
* overriding method MUST call this method to increment the tracking count.
*
* @GuardedBy this
*/
virtual void Modified();
/**
* Returns the tracking count for this ServiceTracker
object.
*
* The tracking count is initialized to 0 when this object is opened. Every
* time an item is added, modified or removed from this object the tracking
* count is incremented.
*
* @GuardedBy this
* @return The tracking count for this object.
*/
int GetTrackingCount() const;
/**
* Copy the tracked items and associated values into the specified map.
*
* @param map The map into which to copy the tracked items and associated
* values. This map must not be a user provided map so that user code
* is not executed while synchronized on this.
* @return The specified map.
* @GuardedBy this
*/
void CopyEntries(TrackingMap& map) const;
/**
* Call the specific customizer adding method. This method must not be
* called while synchronized on this object.
*
* @param item S to be tracked.
* @param related Action related object.
* @return Customized object for the tracked item or null
if
* the item is not to be tracked.
*/
virtual T CustomizerAdding(S item, const R& related) = 0;
/**
* Call the specific customizer modified method. This method must not be
* called while synchronized on this object.
*
* @param item Tracked item.
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
virtual void CustomizerModified(S item, const R& related,
T object) = 0;
/**
* Call the specific customizer removed method. This method must not be
* called while synchronized on this object.
*
* @param item Tracked item.
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
virtual void CustomizerRemoved(S item, const R& related,
T object) = 0;
/**
* List of items in the process of being added. This is used to deal with
* nesting of events. Since events may be synchronously delivered, events
* can be nested. For example, when processing the adding of a service and
* the customizer causes the service to be unregistered, notification to the
* nested call to untrack that the service was unregistered can be made to
* the track method.
*
* Since the std::vector implementation is not synchronized, all access to
* this list must be protected by the same synchronized object for
* thread-safety.
*
* @GuardedBy this
*/
std::list adding;
/**
* true if the tracked object is closed.
*
* This field is volatile because it is set by one thread and read by
* another.
*/
volatile bool closed;
/**
* Initial list of items for the tracker. This is used to correctly process
* the initial items which could be modified before they are tracked. This
* is necessary since the initial set of tracked items are not "announced"
* by events and therefore the event which makes the item untracked could be
* delivered before we track the item.
*
* An item must not be in both the initial and adding lists at the same
* time. An item must be moved from the initial list to the adding list
* "atomically" before we begin tracking it.
*
* Since the LinkedList implementation is not synchronized, all access to
* this list must be protected by the same synchronized object for
* thread-safety.
*
* @GuardedBy this
*/
std::list initial;
/**
* Common logic to add an item to the tracker used by track and
* trackInitial. The specified item must have been placed in the adding list
* before calling this method.
*
* @param item S to be tracked.
* @param related Action related object.
*/
void TrackAdding(S item, R related);
private:
typedef ModuleAbstractTracked Self;
/**
* Map of tracked items to customized objects.
*
* @GuardedBy this
*/
TrackingMap tracked;
/**
* Modification count. This field is initialized to zero and incremented by
* modified.
*
* @GuardedBy this
*/
AtomicInt trackingCount;
bool CustomizerAddingFinal(S item, const T& custom);
};
US_END_NAMESPACE
#include "usModuleAbstractTracked.tpp"
#endif // USMODULEABSTRACTTRACKED_H
diff --git a/Core/Code/CppMicroServices/src/service/usServiceTracker.tpp b/Core/Code/CppMicroServices/src/service/usServiceTracker.tpp
index 17ab4757a5..608c628c61 100644
--- a/Core/Code/CppMicroServices/src/service/usServiceTracker.tpp
+++ b/Core/Code/CppMicroServices/src/service/usServiceTracker.tpp
@@ -1,448 +1,448 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "usServiceTrackerPrivate.h"
#include "usTrackedService_p.h"
#include "usServiceException.h"
#include "usModuleContext.h"
#include
#include
US_BEGIN_NAMESPACE
template
ServiceTracker::~ServiceTracker()
{
Close();
delete d;
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4355)
#endif
template
ServiceTracker::ServiceTracker(ModuleContext* context,
const ServiceReference& reference,
_ServiceTrackerCustomizer* customizer)
: d(new _ServiceTrackerPrivate(this, context, reference, customizer))
{
}
template
ServiceTracker::ServiceTracker(ModuleContext* context, const std::string& clazz,
_ServiceTrackerCustomizer* customizer)
: d(new _ServiceTrackerPrivate(this, context, clazz, customizer))
{
}
template
ServiceTracker::ServiceTracker(ModuleContext* context, const LDAPFilter& filter,
_ServiceTrackerCustomizer* customizer)
: d(new _ServiceTrackerPrivate(this, context, filter, customizer))
{
}
template
ServiceTracker::ServiceTracker(ModuleContext *context, ServiceTrackerCustomizer *customizer)
: d(new _ServiceTrackerPrivate(this, context, us_service_interface_iid(), customizer))
{
const char* clazz = us_service_interface_iid();
if (clazz == 0) throw ServiceException("The service interface class has no US_DECLARE_SERVICE_INTERFACE macro");
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
template
void ServiceTracker::Open()
{
_TrackedService* t;
{
typename _ServiceTrackerPrivate::Lock l(d);
if (d->trackedService)
{
return;
}
- US_DEBUG(d->DEBUG) << "ServiceTracker::Open: " << d->filter;
+ US_DEBUG(d->DEBUG_OUTPUT) << "ServiceTracker::Open: " << d->filter;
t = new _TrackedService(this, d->customizer);
{
typename _TrackedService::Lock l(*t);
try {
d->context->AddServiceListener(t, &_TrackedService::ServiceChanged, d->listenerFilter);
std::list references;
if (!d->trackClass.empty())
{
references = d->GetInitialReferences(d->trackClass, std::string());
}
else
{
if (d->trackReference.GetModule() != 0)
{
references.push_back(d->trackReference);
}
else
{ /* user supplied filter */
references = d->GetInitialReferences(std::string(),
(d->listenerFilter.empty()) ? d->filter.ToString() : d->listenerFilter);
}
}
/* set tracked with the initial references */
t->SetInitial(references);
}
catch (const std::invalid_argument& e)
{
throw std::runtime_error(std::string("unexpected std::invalid_argument exception: ")
+ e.what());
}
}
d->trackedService = t;
}
/* Call tracked outside of synchronized region */
t->TrackInitial(); /* process the initial references */
}
template
void ServiceTracker::Close()
{
_TrackedService* outgoing;
std::list references;
{
typename _ServiceTrackerPrivate::Lock l(d);
outgoing = d->trackedService;
if (outgoing == 0)
{
return;
}
- US_DEBUG(d->DEBUG) << "ServiceTracker::close:" << d->filter;
+ US_DEBUG(d->DEBUG_OUTPUT) << "ServiceTracker::close:" << d->filter;
outgoing->Close();
GetServiceReferences(references);
d->trackedService = 0;
try
{
d->context->RemoveServiceListener(outgoing, &_TrackedService::ServiceChanged);
}
catch (const std::logic_error& /*e*/)
{
/* In case the context was stopped. */
}
}
d->Modified(); /* clear the cache */
{
typename _TrackedService::Lock l(outgoing);
outgoing->NotifyAll(); /* wake up any waiters */
}
for(std::list::const_iterator ref = references.begin();
ref != references.end(); ++ref)
{
outgoing->Untrack(*ref, ServiceEvent());
}
- if (d->DEBUG)
+ if (d->DEBUG_OUTPUT)
{
typename _ServiceTrackerPrivate::Lock l(d);
if ((d->cachedReference.GetModule() == 0) && (d->cachedService == 0))
{
US_DEBUG(true) << "ServiceTracker::close[cached cleared]:"
<< d->filter;
}
}
delete outgoing;
d->trackedService = 0;
}
template
T ServiceTracker::WaitForService(unsigned long timeoutMillis)
{
T object = GetService();
while (object == 0)
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return 0;
}
{
typename _TrackedService::Lock l(t);
if (t->Size() == 0)
{
t->Wait(timeoutMillis);
}
}
object = GetService();
}
return object;
}
template
void ServiceTracker::GetServiceReferences(std::list& refs) const
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return;
}
{
typename _TrackedService::Lock l(t);
d->GetServiceReferences_unlocked(refs, t);
}
}
template
ServiceReference ServiceTracker::GetServiceReference() const
{
ServiceReference reference(0);
{
typename _ServiceTrackerPrivate::Lock l(d);
reference = d->cachedReference;
}
if (reference.GetModule() != 0)
{
- US_DEBUG(d->DEBUG) << "ServiceTracker::getServiceReference[cached]:"
+ US_DEBUG(d->DEBUG_OUTPUT) << "ServiceTracker::getServiceReference[cached]:"
<< d->filter;
return reference;
}
- US_DEBUG(d->DEBUG) << "ServiceTracker::getServiceReference:" << d->filter;
+ US_DEBUG(d->DEBUG_OUTPUT) << "ServiceTracker::getServiceReference:" << d->filter;
std::list references;
GetServiceReferences(references);
std::size_t length = references.size();
if (length == 0)
{ /* if no service is being tracked */
throw ServiceException("No service is being tracked");
}
std::list::const_iterator selectedRef;
if (length > 1)
{ /* if more than one service, select highest ranking */
std::vector rankings(length);
int count = 0;
int maxRanking = std::numeric_limits::min();
std::list::const_iterator refIter = references.begin();
for (std::size_t i = 0; i < length; i++)
{
Any rankingAny = refIter->GetProperty(ServiceConstants::SERVICE_RANKING());
int ranking = 0;
if (rankingAny.Type() == typeid(int))
{
ranking = any_cast(rankingAny);
}
rankings[i] = ranking;
if (ranking > maxRanking)
{
selectedRef = refIter;
maxRanking = ranking;
count = 1;
}
else
{
if (ranking == maxRanking)
{
count++;
}
}
++refIter;
}
if (count > 1)
{ /* if still more than one service, select lowest id */
long int minId = std::numeric_limits::max();
refIter = references.begin();
for (std::size_t i = 0; i < length; i++)
{
if (rankings[i] == maxRanking)
{
Any idAny = refIter->GetProperty(ServiceConstants::SERVICE_ID());
long int id = 0;
if (idAny.Type() == typeid(long int))
{
id = any_cast(idAny);
}
if (id < minId)
{
selectedRef = refIter;
minId = id;
}
}
++refIter;
}
}
}
{
typename _ServiceTrackerPrivate::Lock l(d);
d->cachedReference = *selectedRef;
return d->cachedReference;
}
}
template
T ServiceTracker::GetService(const ServiceReference& reference) const
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return 0;
}
{
typename _TrackedService::Lock l(t);
return t->GetCustomizedObject(reference);
}
}
template
void ServiceTracker::GetServices(std::list& services) const
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return;
}
{
typename _TrackedService::Lock l(t);
std::list references;
d->GetServiceReferences_unlocked(references, t);
for(std::list::const_iterator ref = references.begin();
ref != references.end(); ++ref)
{
services.push_back(t->GetCustomizedObject(*ref));
}
}
}
template
T ServiceTracker::GetService() const
{
T service = d->cachedService;
if (service != 0)
{
- US_DEBUG(d->DEBUG) << "ServiceTracker::getService[cached]:"
+ US_DEBUG(d->DEBUG_OUTPUT) << "ServiceTracker::getService[cached]:"
<< d->filter;
return service;
}
- US_DEBUG(d->DEBUG) << "ServiceTracker::getService:" << d->filter;
+ US_DEBUG(d->DEBUG_OUTPUT) << "ServiceTracker::getService:" << d->filter;
try
{
ServiceReference reference = GetServiceReference();
if (reference.GetModule() == 0)
{
return 0;
}
return d->cachedService = GetService(reference);
}
catch (const ServiceException&)
{
return 0;
}
}
template
void ServiceTracker::Remove(const ServiceReference& reference)
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return;
}
t->Untrack(reference, ServiceEvent());
}
template
int ServiceTracker::Size() const
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return 0;
}
{
typename _TrackedService::Lock l(t);
return static_cast(t->Size());
}
}
template
int ServiceTracker::GetTrackingCount() const
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return -1;
}
{
typename _TrackedService::Lock l(t);
return t->GetTrackingCount();
}
}
template
void ServiceTracker::GetTracked(TrackingMap& map) const
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return;
}
{
typename _TrackedService::Lock l(t);
t->CopyEntries(map);
}
}
template
bool ServiceTracker::IsEmpty() const
{
_TrackedService* t = d->Tracked();
if (t == 0)
{ /* if ServiceTracker is not open */
return true;
}
{
typename _TrackedService::Lock l(t);
return t->IsEmpty();
}
}
template
T ServiceTracker::AddingService(const ServiceReference& reference)
{
return dynamic_cast(d->context->GetService(reference));
}
template
void ServiceTracker::ModifiedService(const ServiceReference& /*reference*/, T /*service*/)
{
/* do nothing */
}
template
void ServiceTracker::RemovedService(const ServiceReference& reference, T /*service*/)
{
d->context->UngetService(reference);
}
US_END_NAMESPACE
diff --git a/Core/Code/CppMicroServices/src/service/usServiceTrackerPrivate.h b/Core/Code/CppMicroServices/src/service/usServiceTrackerPrivate.h
index 2bb0dfcb0a..1229b68ca0 100644
--- a/Core/Code/CppMicroServices/src/service/usServiceTrackerPrivate.h
+++ b/Core/Code/CppMicroServices/src/service/usServiceTrackerPrivate.h
@@ -1,172 +1,172 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#ifndef USSERVICETRACKERPRIVATE_H
#define USSERVICETRACKERPRIVATE_H
#include "usServiceReference.h"
#include "usLDAPFilter.h"
US_BEGIN_NAMESPACE
/**
* \ingroup MicroServices
*/
template
class ServiceTrackerPrivate : US_DEFAULT_THREADING >
{
public:
ServiceTrackerPrivate(ServiceTracker* st,
ModuleContext* context,
const ServiceReference& reference,
ServiceTrackerCustomizer* customizer);
ServiceTrackerPrivate(ServiceTracker* st,
ModuleContext* context, const std::string& clazz,
ServiceTrackerCustomizer* customizer);
ServiceTrackerPrivate(ServiceTracker* st,
ModuleContext* context, const LDAPFilter& filter,
ServiceTrackerCustomizer* customizer);
~ServiceTrackerPrivate();
/**
* Returns the list of initial ServiceReference
s that will be
* tracked by this ServiceTracker
.
*
* @param className The class name with which the service was registered, or
* null
for all services.
* @param filterString The filter criteria or null
for all
* services.
* @return The list of initial ServiceReference
s.
* @throws std::invalid_argument If the specified filterString has an
* invalid syntax.
*/
std::list GetInitialReferences(const std::string& className,
const std::string& filterString);
void GetServiceReferences_unlocked(std::list& refs, TrackedService* t) const;
/* set this to true to compile in debug messages */
- static const bool DEBUG; // = false;
+ static const bool DEBUG_OUTPUT; // = false;
/**
* The Module Context used by this ServiceTracker
.
*/
ModuleContext* const context;
/**
* The filter used by this ServiceTracker
which specifies the
* search criteria for the services to track.
*/
LDAPFilter filter;
/**
* The ServiceTrackerCustomizer
for this tracker.
*/
ServiceTrackerCustomizer* customizer;
/**
* Filter string for use when adding the ServiceListener. If this field is
* set, then certain optimizations can be taken since we don't have a user
* supplied filter.
*/
std::string listenerFilter;
/**
* Class name to be tracked. If this field is set, then we are tracking by
* class name.
*/
std::string trackClass;
/**
* Reference to be tracked. If this field is set, then we are tracking a
* single ServiceReference.
*/
ServiceReference trackReference;
/**
* Tracked services: ServiceReference
-> customized Object and
* ServiceListenerEntry
object
*/
TrackedService* trackedService;
/**
* Accessor method for the current TrackedService object. This method is only
* intended to be used by the unsynchronized methods which do not modify the
* trackedService field.
*
* @return The current Tracked object.
*/
TrackedService* Tracked() const;
/**
* Called by the TrackedService object whenever the set of tracked services is
* modified. Clears the cache.
*/
/*
* This method must not be synchronized since it is called by TrackedService while
* TrackedService is synchronized. We don't want synchronization interactions
* between the listener thread and the user thread.
*/
void Modified();
/**
* Cached ServiceReference for getServiceReference.
*/
mutable ServiceReference cachedReference;
/**
* Cached service object for GetService.
*
* This field is volatile since it is accessed by multiple threads.
*/
mutable T volatile cachedService;
private:
inline ServiceTracker* q_func()
{
return static_cast *>(q_ptr);
}
inline const ServiceTracker* q_func() const
{
return static_cast *>(q_ptr);
}
friend class ServiceTracker;
ServiceTracker * const q_ptr;
};
US_END_NAMESPACE
#include "usServiceTrackerPrivate.tpp"
#endif // USSERVICETRACKERPRIVATE_H
diff --git a/Core/Code/CppMicroServices/src/service/usServiceTrackerPrivate.tpp b/Core/Code/CppMicroServices/src/service/usServiceTrackerPrivate.tpp
index 5346e14b40..e48033f6a1 100644
--- a/Core/Code/CppMicroServices/src/service/usServiceTrackerPrivate.tpp
+++ b/Core/Code/CppMicroServices/src/service/usServiceTrackerPrivate.tpp
@@ -1,144 +1,144 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "usTrackedService_p.h"
#include "usModuleContext.h"
#include "usLDAPFilter.h"
#include
US_BEGIN_NAMESPACE
template
-const bool ServiceTrackerPrivate::DEBUG = true;
+const bool ServiceTrackerPrivate::DEBUG_OUTPUT = true;
template
ServiceTrackerPrivate::ServiceTrackerPrivate(
ServiceTracker* st, ModuleContext* context,
const ServiceReference& reference,
ServiceTrackerCustomizer* customizer)
: context(context), customizer(customizer), trackReference(reference),
trackedService(0), cachedReference(0), cachedService(0), q_ptr(st)
{
this->customizer = customizer ? customizer : q_func();
std::stringstream ss;
ss << "(" << ServiceConstants::SERVICE_ID() << "="
<< any_cast(reference.GetProperty(ServiceConstants::SERVICE_ID())) << ")";
this->listenerFilter = ss.str();
try
{
this->filter = LDAPFilter(listenerFilter);
}
catch (const std::invalid_argument& e)
{
/*
* we could only get this exception if the ServiceReference was
* invalid
*/
std::invalid_argument ia(std::string("unexpected std::invalid_argument exception: ") + e.what());
throw ia;
}
}
template
ServiceTrackerPrivate::ServiceTrackerPrivate(
ServiceTracker* st,
ModuleContext* context, const std::string& clazz,
ServiceTrackerCustomizer* customizer)
: context(context), customizer(customizer), trackClass(clazz),
trackReference(0), trackedService(0), cachedReference(0),
cachedService(0), q_ptr(st)
{
this->customizer = customizer ? customizer : q_func();
this->listenerFilter = std::string("(") + US_PREPEND_NAMESPACE(ServiceConstants)::OBJECTCLASS() + "="
+ clazz + ")";
try
{
this->filter = LDAPFilter(listenerFilter);
}
catch (const std::invalid_argument& e)
{
/*
* we could only get this exception if the clazz argument was
* malformed
*/
std::invalid_argument ia(
std::string("unexpected std::invalid_argument exception: ") + e.what());
throw ia;
}
}
template
ServiceTrackerPrivate::ServiceTrackerPrivate(
ServiceTracker* st,
ModuleContext* context, const LDAPFilter& filter,
ServiceTrackerCustomizer* customizer)
: context(context), filter(filter), customizer(customizer),
listenerFilter(filter.ToString()), trackReference(0),
trackedService(0), cachedReference(0), cachedService(0), q_ptr(st)
{
this->customizer = customizer ? customizer : q_func();
if (context == 0)
{
throw std::invalid_argument("The module context cannot be null.");
}
}
template
ServiceTrackerPrivate::~ServiceTrackerPrivate()
{
}
template
std::list ServiceTrackerPrivate::GetInitialReferences(
const std::string& className, const std::string& filterString)
{
return context->GetServiceReferences(className, filterString);
}
template
void ServiceTrackerPrivate::GetServiceReferences_unlocked(std::list& refs, TrackedService* t) const
{
if (t->Size() == 0)
{
return;
}
t->GetTracked(refs);
}
template
TrackedService* ServiceTrackerPrivate::Tracked() const
{
return trackedService;
}
template
void ServiceTrackerPrivate::Modified()
{
cachedReference = 0; /* clear cached value */
cachedService = 0; /* clear cached value */
- US_DEBUG(DEBUG) << "ServiceTracker::Modified(): " << filter;
+ US_DEBUG(DEBUG_OUTPUT) << "ServiceTracker::Modified(): " << filter;
}
US_END_NAMESPACE
diff --git a/Core/Code/CppMicroServices/src/service/usTrackedService.tpp b/Core/Code/CppMicroServices/src/service/usTrackedService.tpp
index e1c1f709c0..8917c200fd 100644
--- a/Core/Code/CppMicroServices/src/service/usTrackedService.tpp
+++ b/Core/Code/CppMicroServices/src/service/usTrackedService.tpp
@@ -1,123 +1,123 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
US_BEGIN_NAMESPACE
template
TrackedService::TrackedService(ServiceTracker* serviceTracker,
ServiceTrackerCustomizer* customizer)
: serviceTracker(serviceTracker), customizer(customizer)
{
}
template
void TrackedService::ServiceChanged(const ServiceEvent event)
{
/*
* Check if we had a delayed call (which could happen when we
* close).
*/
if (this->closed)
{
return;
}
ServiceReference reference = event.GetServiceReference();
- US_DEBUG(serviceTracker->d->DEBUG) << "TrackedService::ServiceChanged["
+ US_DEBUG(serviceTracker->d->DEBUG_OUTPUT) << "TrackedService::ServiceChanged["
<< event.GetType() << "]: " << reference;
switch (event.GetType())
{
case ServiceEvent::REGISTERED :
case ServiceEvent::MODIFIED :
{
if (!serviceTracker->d->listenerFilter.empty())
{ // service listener added with filter
this->Track(reference, event);
/*
* If the customizer throws an unchecked exception, it
* is safe to let it propagate
*/
}
else
{ // service listener added without filter
if (serviceTracker->d->filter.Match(reference))
{
this->Track(reference, event);
/*
* If the customizer throws an unchecked exception,
* it is safe to let it propagate
*/
}
else
{
this->Untrack(reference, event);
/*
* If the customizer throws an unchecked exception,
* it is safe to let it propagate
*/
}
}
break;
}
case ServiceEvent::MODIFIED_ENDMATCH :
case ServiceEvent::UNREGISTERING :
this->Untrack(reference, event);
/*
* If the customizer throws an unchecked exception, it is
* safe to let it propagate
*/
break;
}
}
template
void TrackedService::Modified()
{
Superclass::Modified(); /* increment the modification count */
serviceTracker->d->Modified();
}
template
T TrackedService::CustomizerAdding(ServiceReference item,
const ServiceEvent& /*related*/)
{
return customizer->AddingService(item);
}
template
void TrackedService::CustomizerModified(ServiceReference item,
const ServiceEvent& /*related*/,
T object)
{
customizer->ModifiedService(item, object);
}
template
void TrackedService::CustomizerRemoved(ServiceReference item,
const ServiceEvent& /*related*/,
T object)
{
customizer->RemovedService(item, object);
}
US_END_NAMESPACE
diff --git a/Core/Code/CppMicroServices/src/util/usUtils_p.h b/Core/Code/CppMicroServices/src/util/usUtils_p.h
index d8183bd33e..32c88713e2 100644
--- a/Core/Code/CppMicroServices/src/util/usUtils_p.h
+++ b/Core/Code/CppMicroServices/src/util/usUtils_p.h
@@ -1,225 +1,225 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#ifndef USUTILS_H
#define USUTILS_H
#include
#include
#include
#include
//-------------------------------------------------------------------
// Logging
//-------------------------------------------------------------------
US_BEGIN_NAMESPACE
US_EXPORT void message_output(MsgType, const char* buf);
struct LogMsg {
LogMsg(int t, const char* file, int ln, const char* func)
: type(static_cast(t)), enabled(true), buffer()
{ buffer << "In " << func << " at " << file << ":" << ln << " : "; }
~LogMsg() { if(enabled) message_output(type, buffer.str().c_str()); }
template
LogMsg& operator<<(T t)
{
if (enabled) buffer << t;
return *this;
}
LogMsg& operator()(bool flag)
{
this->enabled = flag;
return *this;
}
private:
MsgType type;
bool enabled;
std::stringstream buffer;
};
struct NoLogMsg {
template
NoLogMsg& operator<<(T)
{
return *this;
}
NoLogMsg& operator()(bool)
{
return *this;
}
};
US_END_NAMESPACE
-#if !defined(US_NO_DEBUG_OUTPUT)
+#if defined(US_ENABLE_DEBUG_OUTPUT)
#define US_DEBUG US_PREPEND_NAMESPACE(LogMsg)(0, __FILE__, __LINE__, __FUNCTION__)
#else
#define US_DEBUG true ? US_PREPEND_NAMESPACE(NoLogMsg)() : US_PREPEND_NAMESPACE(NoLogMsg)()
#endif
#if !defined(US_NO_INFO_OUTPUT)
#define US_INFO US_PREPEND_NAMESPACE(LogMsg)(1, __FILE__, __LINE__, __FUNCTION__)
#else
#define US_INFO true ? US_PREPEND_NAMESPACE(NoLogMsg)() : US_PREPEND_NAMESPACE(NoLogMsg)()
#endif
#if !defined(US_NO_WARNING_OUTPUT)
#define US_WARN US_PREPEND_NAMESPACE(LogMsg)(2, __FILE__, __LINE__, __FUNCTION__)
#else
#define US_WARN true ? US_PREPEND_NAMESPACE(LogMsg)() : US_PREPEND_NAMESPACE(LogMsg)()
#endif
#define US_ERROR US_PREPEND_NAMESPACE(LogMsg)(3, __FILE__, __LINE__, __FUNCTION__)
//-------------------------------------------------------------------
// Module auto-loading
//-------------------------------------------------------------------
US_BEGIN_NAMESPACE
struct ModuleInfo;
void AutoLoadModules(const ModuleInfo& moduleInfo);
US_END_NAMESPACE
//-------------------------------------------------------------------
// Error handling
//-------------------------------------------------------------------
US_BEGIN_NAMESPACE
US_EXPORT std::string GetLastErrorStr();
US_END_NAMESPACE
//-------------------------------------------------------------------
// Functors
//-------------------------------------------------------------------
#include
#include
#if defined(US_USE_CXX11) || defined(__GNUC__)
#ifdef US_USE_CXX11
#include
#define US_MODULE_LISTENER_FUNCTOR std::function
#define US_SERVICE_LISTENER_FUNCTOR std::function
#else
#include
#define US_MODULE_LISTENER_FUNCTOR std::tr1::function
#define US_SERVICE_LISTENER_FUNCTOR std::tr1::function
#endif
US_BEGIN_NAMESPACE
template
US_MODULE_LISTENER_FUNCTOR ModuleListenerMemberFunctor(X* x, void (X::*memFn)(const US_PREPEND_NAMESPACE(ModuleEvent)))
{ return std::bind1st(std::mem_fun(memFn), x); }
US_END_NAMESPACE
US_BEGIN_NAMESPACE
struct ModuleListenerCompare : std::binary_function,
std::pair, bool>
{
bool operator()(const std::pair& p1,
const std::pair& p2) const
{
return p1.second == p2.second &&
p1.first.target() == p2.first.target();
}
};
US_END_NAMESPACE
US_BEGIN_NAMESPACE
template
US_SERVICE_LISTENER_FUNCTOR ServiceListenerMemberFunctor(X* x, void (X::*memFn)(const US_PREPEND_NAMESPACE(ServiceEvent)))
{ return std::bind1st(std::mem_fun(memFn), x); }
US_END_NAMESPACE
US_BEGIN_NAMESPACE
struct ServiceListenerCompare : std::binary_function
{
bool operator()(const US_SERVICE_LISTENER_FUNCTOR& f1,
const US_SERVICE_LISTENER_FUNCTOR& f2) const
{
return f1.target() == f2.target();
}
};
US_END_NAMESPACE
#else
#include
#define US_MODULE_LISTENER_FUNCTOR US_PREPEND_NAMESPACE(Functor)
US_BEGIN_NAMESPACE
template
US_MODULE_LISTENER_FUNCTOR ModuleListenerMemberFunctor(X* x, MemFn memFn)
{ return Functor(x, memFn); }
US_END_NAMESPACE
US_BEGIN_NAMESPACE
struct ModuleListenerCompare : std::binary_function,
std::pair, bool>
{
bool operator()(const std::pair& p1,
const std::pair& p2) const
{ return p1.second == p2.second && p1.first == p2.first; }
};
US_END_NAMESPACE
#define US_SERVICE_LISTENER_FUNCTOR US_PREPEND_NAMESPACE(Functor)
US_BEGIN_NAMESPACE
template
US_SERVICE_LISTENER_FUNCTOR ServiceListenerMemberFunctor(X* x, MemFn memFn)
{ return Functor(x, memFn); }
US_END_NAMESPACE
US_BEGIN_NAMESPACE
struct ServiceListenerCompare : std::binary_function
{
bool operator()(const US_SERVICE_LISTENER_FUNCTOR& f1,
const US_SERVICE_LISTENER_FUNCTOR& f2) const
{ return f1 == f2; }
};
US_END_NAMESPACE
#endif
#endif // USUTILS_H
diff --git a/Core/Code/CppMicroServices/test/usDebugOutputTest.cpp b/Core/Code/CppMicroServices/test/usDebugOutputTest.cpp
index 721ad6e351..c3aab61b92 100644
--- a/Core/Code/CppMicroServices/test/usDebugOutputTest.cpp
+++ b/Core/Code/CppMicroServices/test/usDebugOutputTest.cpp
@@ -1,100 +1,100 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include
#include "usTestingMacros.h"
US_USE_NAMESPACE
static int lastMsgType = -1;
static std::string lastMsg;
void handleMessages(MsgType type, const char* msg)
{
lastMsgType = type;
lastMsg.assign(msg);
}
void resetLastMsg()
{
lastMsgType = -1;
lastMsg.clear();
}
int usDebugOutputTest(int /*argc*/, char* /*argv*/[])
{
US_TEST_BEGIN("DebugOutputTest");
// Use the default message handler
{
US_DEBUG << "Msg";
US_DEBUG(false) << "Msg";
US_INFO << "Msg";
US_INFO(false) << "Msg";
US_WARN << "Msg";
US_WARN(false) << "Msg";
}
US_TEST_CONDITION(lastMsg.empty(), "Testing default message handler");
resetLastMsg();
installMsgHandler(handleMessages);
{
US_DEBUG << "Msg";
}
-#ifdef NDEBUG
+#if !defined(US_ENABLE_DEBUG_OUTPUT)
US_TEST_CONDITION(lastMsgType == -1 && lastMsg.empty(), "Testing suppressed debug message")
#else
US_TEST_CONDITION(lastMsgType == 0 && lastMsg.find("Msg") != std::string::npos, "Testing debug message")
#endif
resetLastMsg();
{
US_DEBUG(false) << "No msg";
}
US_TEST_CONDITION(lastMsgType == -1 && lastMsg.empty(), "Testing disabled debug message")
resetLastMsg();
{
US_INFO << "Info msg";
}
US_TEST_CONDITION(lastMsgType == 1 && lastMsg.find("Info msg") != std::string::npos, "Testing informational message")
resetLastMsg();
{
US_WARN << "Warn msg";
}
US_TEST_CONDITION(lastMsgType == 2 && lastMsg.find("Warn msg") != std::string::npos, "Testing warning message")
resetLastMsg();
// We cannot test US_ERROR since it will call abort().
installMsgHandler(0);
{
US_INFO << "Info msg";
}
US_TEST_CONDITION(lastMsgType == -1 && lastMsg.empty(), "Testing message handler reset")
US_TEST_END()
}
diff --git a/Core/Code/CppMicroServices/test/usStaticModuleResourceTest.cpp b/Core/Code/CppMicroServices/test/usStaticModuleResourceTest.cpp
index dc73a7fe72..2405f4572a 100644
--- a/Core/Code/CppMicroServices/test/usStaticModuleResourceTest.cpp
+++ b/Core/Code/CppMicroServices/test/usStaticModuleResourceTest.cpp
@@ -1,151 +1,151 @@
/*=============================================================================
Library: CppMicroServices
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include
#include
#include
#include
#include
#include
#include
#include "usTestUtilSharedLibrary.h"
#include "usTestingMacros.h"
#include
#include
US_USE_NAMESPACE
namespace {
std::string GetResourceContent(const ModuleResource& resource)
{
std::string line;
ModuleResourceStream rs(resource);
std::getline(rs, line);
return line;
}
struct ResourceComparator {
bool operator()(const ModuleResource& mr1, const ModuleResource& mr2) const
{
return mr1 < mr2;
}
};
void testResourceOperators(Module* module)
{
std::vector